diff -r 076aa91d2dd8 -r 814e9e335067 src/cpu/mips/vm/bytes_mips.hpp --- a/src/cpu/mips/vm/bytes_mips.hpp Thu Feb 21 10:14:02 2019 +0800 +++ b/src/cpu/mips/vm/bytes_mips.hpp Tue Mar 05 17:00:17 2019 +0800 @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, 2018, Loongson Technology. All rights reserved. + * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,6 +101,7 @@ return res; } + //use mips unaligned load instructions static inline void put_native_u2(address p, u2 x) { if((intptr_t)p & 0x1) { @@ -110,23 +111,24 @@ *(u2*)p = x; } } + static inline void put_native_u4(address p, u4 x) { // refer to sparc implementation. // Note that sparc is big-endian, while mips is little-endian - switch ( intptr_t(p) & 3 ) { - case 0: *(u4*)p = x; - break; + switch ( intptr_t(p) & 3 ) { + case 0: *(u4*)p = x; + break; - case 2: ((u2*)p)[1] = x >> 16; - ((u2*)p)[0] = x; - break; + case 2: ((u2*)p)[1] = x >> 16; + ((u2*)p)[0] = x; + break; - default: ((u1*)p)[3] = x >> 24; - ((u1*)p)[2] = x >> 16; - ((u1*)p)[1] = x >> 8; - ((u1*)p)[0] = x; - break; - } + default: ((u1*)p)[3] = x >> 24; + ((u1*)p)[2] = x >> 16; + ((u1*)p)[1] = x >> 8; + ((u1*)p)[0] = x; + break; + } } static inline void put_native_u8(address p, u8 x) { // refer to sparc implementation.