Mercurial > hg > graal-compiler
annotate src/cpu/x86/vm/bytes_x86.hpp @ 21451:24dd9af9ac26
SPARCArithmetic: add register hint for Unary2Op.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 21 May 2015 15:00:11 +0200 |
parents | f08d439fab8c |
children |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef CPU_X86_VM_BYTES_X86_HPP |
26 #define CPU_X86_VM_BYTES_X86_HPP | |
27 | |
28 #include "memory/allocation.hpp" | |
29 | |
0 | 30 class Bytes: AllStatic { |
31 private: | |
32 #ifndef AMD64 | |
33 // Helper function for swap_u8 | |
34 static inline u8 swap_u8_base(u4 x, u4 y); // compiler-dependent implementation | |
35 #endif // AMD64 | |
36 | |
37 public: | |
38 // Returns true if the byte ordering used by Java is different from the native byte ordering | |
39 // of the underlying machine. For example, this is true for Intel x86, but false for Solaris | |
40 // on Sparc. | |
41 static inline bool is_Java_byte_ordering_different(){ return true; } | |
42 | |
43 | |
44 // Efficient reading and writing of unaligned unsigned data in platform-specific byte ordering | |
45 // (no special code is needed since x86 CPUs can access unaligned data) | |
46 static inline u2 get_native_u2(address p) { return *(u2*)p; } | |
47 static inline u4 get_native_u4(address p) { return *(u4*)p; } | |
48 static inline u8 get_native_u8(address p) { return *(u8*)p; } | |
49 | |
50 static inline void put_native_u2(address p, u2 x) { *(u2*)p = x; } | |
51 static inline void put_native_u4(address p, u4 x) { *(u4*)p = x; } | |
52 static inline void put_native_u8(address p, u8 x) { *(u8*)p = x; } | |
53 | |
54 | |
55 // Efficient reading and writing of unaligned unsigned data in Java | |
56 // byte ordering (i.e. big-endian ordering). Byte-order reversal is | |
57 // needed since x86 CPUs use little-endian format. | |
58 static inline u2 get_Java_u2(address p) { return swap_u2(get_native_u2(p)); } | |
59 static inline u4 get_Java_u4(address p) { return swap_u4(get_native_u4(p)); } | |
60 static inline u8 get_Java_u8(address p) { return swap_u8(get_native_u8(p)); } | |
61 | |
62 static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, swap_u2(x)); } | |
63 static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, swap_u4(x)); } | |
64 static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, swap_u8(x)); } | |
65 | |
66 | |
67 // Efficient swapping of byte ordering | |
68 static inline u2 swap_u2(u2 x); // compiler-dependent implementation | |
69 static inline u4 swap_u4(u4 x); // compiler-dependent implementation | |
70 static inline u8 swap_u8(u8 x); | |
71 }; | |
72 | |
73 | |
74 // The following header contains the implementations of swap_u2, swap_u4, and swap_u8[_base] | |
1972 | 75 #ifdef TARGET_OS_ARCH_linux_x86 |
76 # include "bytes_linux_x86.inline.hpp" | |
77 #endif | |
78 #ifdef TARGET_OS_ARCH_solaris_x86 | |
79 # include "bytes_solaris_x86.inline.hpp" | |
80 #endif | |
81 #ifdef TARGET_OS_ARCH_windows_x86 | |
82 # include "bytes_windows_x86.inline.hpp" | |
83 #endif | |
3960 | 84 #ifdef TARGET_OS_ARCH_bsd_x86 |
85 # include "bytes_bsd_x86.inline.hpp" | |
86 #endif | |
1972 | 87 |
88 | |
89 #endif // CPU_X86_VM_BYTES_X86_HPP |