src/cpu/mips/vm/bytes_mips.hpp

changeset 9459
814e9e335067
parent 9251
1ccc5a3b3671
child 9645
ac996ba07f9d
     1.1 --- a/src/cpu/mips/vm/bytes_mips.hpp	Thu Feb 21 10:14:02 2019 +0800
     1.2 +++ b/src/cpu/mips/vm/bytes_mips.hpp	Tue Mar 05 17:00:17 2019 +0800
     1.3 @@ -1,6 +1,6 @@
     1.4  /*
     1.5   * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 - * Copyright (c) 2015, 2018, Loongson Technology. All rights reserved.
     1.7 + * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved.
     1.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9   *
    1.10   * This code is free software; you can redistribute it and/or modify it
    1.11 @@ -101,6 +101,7 @@
    1.12  
    1.13      return res;
    1.14    }
    1.15 +
    1.16    //use mips unaligned load instructions
    1.17    static inline void put_native_u2(address p, u2 x)   {
    1.18      if((intptr_t)p & 0x1) {
    1.19 @@ -110,23 +111,24 @@
    1.20        *(u2*)p  = x;
    1.21      }
    1.22    }
    1.23 +
    1.24    static inline void put_native_u4(address p, u4 x)   {
    1.25      // refer to sparc implementation.
    1.26      // Note that sparc is big-endian, while mips is little-endian
    1.27 -        switch ( intptr_t(p) & 3 ) {
    1.28 -        case 0:  *(u4*)p = x;
    1.29 -            break;
    1.30 +    switch ( intptr_t(p) & 3 ) {
    1.31 +    case 0:  *(u4*)p = x;
    1.32 +        break;
    1.33  
    1.34 -        case 2:  ((u2*)p)[1] = x >> 16;
    1.35 -           ((u2*)p)[0] = x;
    1.36 -           break;
    1.37 +    case 2:  ((u2*)p)[1] = x >> 16;
    1.38 +       ((u2*)p)[0] = x;
    1.39 +       break;
    1.40  
    1.41 -        default: ((u1*)p)[3] = x >> 24;
    1.42 -           ((u1*)p)[2] = x >> 16;
    1.43 -           ((u1*)p)[1] = x >>  8;
    1.44 -           ((u1*)p)[0] = x;
    1.45 -           break;
    1.46 -        }
    1.47 +    default: ((u1*)p)[3] = x >> 24;
    1.48 +       ((u1*)p)[2] = x >> 16;
    1.49 +       ((u1*)p)[1] = x >>  8;
    1.50 +       ((u1*)p)[0] = x;
    1.51 +       break;
    1.52 +    }
    1.53     }
    1.54    static inline void put_native_u8(address p, u8 x)   {
    1.55      // refer to sparc implementation.

mercurial