Mercurial > hg > graal-compiler
annotate src/cpu/ppc/vm/bytes_ppc.hpp @ 21638:b6aadfd3dfbe
fixed compile error in FilterTypes.java
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 16:10:50 +0200 |
parents | 56e7f5560e60 |
children |
rev | line source |
---|---|
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1 /* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
5 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
6 * This code is free software; you can redistribute it and/or modify it |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
7 * under the terms of the GNU General Public License version 2 only, as |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
8 * published by the Free Software Foundation. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
9 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
10 * This code is distributed in the hope that it will be useful, but WITHOUT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
13 * version 2 for more details (a copy is included in the LICENSE file that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
14 * accompanied this code). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
15 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License version |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
17 * 2 along with this work; if not, write to the Free Software Foundation, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
19 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
22 * questions. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
23 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
24 */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
25 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
26 #ifndef CPU_PPC_VM_BYTES_PPC_HPP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
27 #define CPU_PPC_VM_BYTES_PPC_HPP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
28 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
29 #include "memory/allocation.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
30 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
31 class Bytes: AllStatic { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
32 public: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
33 // Efficient reading and writing of unaligned unsigned data in platform-specific byte ordering |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
34 // PowerPC needs to check for alignment. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
35 |
14445 | 36 // Can I count on address always being a pointer to an unsigned char? Yes. |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
37 |
17830
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
38 #if defined(VM_LITTLE_ENDIAN) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
39 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
40 // Returns true, if the byte ordering used by Java is different from the native byte ordering |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
41 // of the underlying machine. For example, true for Intel x86, False, for Solaris on Sparc. |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
42 static inline bool is_Java_byte_ordering_different() { return true; } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
43 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
44 // Forward declarations of the compiler-dependent implementation |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
45 static inline u2 swap_u2(u2 x); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
46 static inline u4 swap_u4(u4 x); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
47 static inline u8 swap_u8(u8 x); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
48 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
49 static inline u2 get_native_u2(address p) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
50 return (intptr_t(p) & 1) == 0 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
51 ? *(u2*)p |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
52 : ( u2(p[1]) << 8 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
53 | ( u2(p[0]) ); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
54 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
55 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
56 static inline u4 get_native_u4(address p) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
57 switch (intptr_t(p) & 3) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
58 case 0: return *(u4*)p; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
59 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
60 case 2: return ( u4( ((u2*)p)[1] ) << 16 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
61 | ( u4( ((u2*)p)[0] ) ); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
62 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
63 default: return ( u4(p[3]) << 24 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
64 | ( u4(p[2]) << 16 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
65 | ( u4(p[1]) << 8 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
66 | u4(p[0]); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
67 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
68 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
69 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
70 static inline u8 get_native_u8(address p) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
71 switch (intptr_t(p) & 7) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
72 case 0: return *(u8*)p; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
73 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
74 case 4: return ( u8( ((u4*)p)[1] ) << 32 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
75 | ( u8( ((u4*)p)[0] ) ); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
76 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
77 case 2: return ( u8( ((u2*)p)[3] ) << 48 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
78 | ( u8( ((u2*)p)[2] ) << 32 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
79 | ( u8( ((u2*)p)[1] ) << 16 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
80 | ( u8( ((u2*)p)[0] ) ); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
81 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
82 default: return ( u8(p[7]) << 56 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
83 | ( u8(p[6]) << 48 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
84 | ( u8(p[5]) << 40 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
85 | ( u8(p[4]) << 32 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
86 | ( u8(p[3]) << 24 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
87 | ( u8(p[2]) << 16 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
88 | ( u8(p[1]) << 8 ) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
89 | u8(p[0]); |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
90 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
91 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
92 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
93 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
94 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
95 static inline void put_native_u2(address p, u2 x) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
96 if ( (intptr_t(p) & 1) == 0 ) *(u2*)p = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
97 else { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
98 p[1] = x >> 8; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
99 p[0] = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
100 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
101 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
102 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
103 static inline void put_native_u4(address p, u4 x) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
104 switch ( intptr_t(p) & 3 ) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
105 case 0: *(u4*)p = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
106 break; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
107 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
108 case 2: ((u2*)p)[1] = x >> 16; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
109 ((u2*)p)[0] = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
110 break; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
111 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
112 default: ((u1*)p)[3] = x >> 24; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
113 ((u1*)p)[2] = x >> 16; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
114 ((u1*)p)[1] = x >> 8; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
115 ((u1*)p)[0] = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
116 break; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
117 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
118 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
119 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
120 static inline void put_native_u8(address p, u8 x) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
121 switch ( intptr_t(p) & 7 ) { |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
122 case 0: *(u8*)p = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
123 break; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
124 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
125 case 4: ((u4*)p)[1] = x >> 32; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
126 ((u4*)p)[0] = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
127 break; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
128 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
129 case 2: ((u2*)p)[3] = x >> 48; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
130 ((u2*)p)[2] = x >> 32; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
131 ((u2*)p)[1] = x >> 16; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
132 ((u2*)p)[0] = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
133 break; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
134 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
135 default: ((u1*)p)[7] = x >> 56; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
136 ((u1*)p)[6] = x >> 48; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
137 ((u1*)p)[5] = x >> 40; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
138 ((u1*)p)[4] = x >> 32; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
139 ((u1*)p)[3] = x >> 24; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
140 ((u1*)p)[2] = x >> 16; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
141 ((u1*)p)[1] = x >> 8; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
142 ((u1*)p)[0] = x; |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
143 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
144 } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
145 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
146 // Efficient reading and writing of unaligned unsigned data in Java byte ordering (i.e. big-endian ordering) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
147 // (no byte-order reversal is needed since Power CPUs are big-endian oriented). |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
148 static inline u2 get_Java_u2(address p) { return swap_u2(get_native_u2(p)); } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
149 static inline u4 get_Java_u4(address p) { return swap_u4(get_native_u4(p)); } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
150 static inline u8 get_Java_u8(address p) { return swap_u8(get_native_u8(p)); } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
151 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
152 static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, swap_u2(x)); } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
153 static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, swap_u4(x)); } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
154 static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, swap_u8(x)); } |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
155 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
156 #else // !defined(VM_LITTLE_ENDIAN) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
157 |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
158 // Returns true, if the byte ordering used by Java is different from the nativ byte ordering |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
159 // of the underlying machine. For example, true for Intel x86, False, for Solaris on Sparc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
160 static inline bool is_Java_byte_ordering_different() { return false; } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
161 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
162 // Thus, a swap between native and Java ordering is always a no-op: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
163 static inline u2 swap_u2(u2 x) { return x; } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
164 static inline u4 swap_u4(u4 x) { return x; } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
165 static inline u8 swap_u8(u8 x) { return x; } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
166 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
167 static inline u2 get_native_u2(address p) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
168 return (intptr_t(p) & 1) == 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
169 ? *(u2*)p |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
170 : ( u2(p[0]) << 8 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
171 | ( u2(p[1]) ); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
172 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
173 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
174 static inline u4 get_native_u4(address p) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
175 switch (intptr_t(p) & 3) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
176 case 0: return *(u4*)p; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
177 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
178 case 2: return ( u4( ((u2*)p)[0] ) << 16 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
179 | ( u4( ((u2*)p)[1] ) ); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
180 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
181 default: return ( u4(p[0]) << 24 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
182 | ( u4(p[1]) << 16 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
183 | ( u4(p[2]) << 8 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
184 | u4(p[3]); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
185 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
186 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
187 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
188 static inline u8 get_native_u8(address p) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
189 switch (intptr_t(p) & 7) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
190 case 0: return *(u8*)p; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
191 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
192 case 4: return ( u8( ((u4*)p)[0] ) << 32 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
193 | ( u8( ((u4*)p)[1] ) ); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
194 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
195 case 2: return ( u8( ((u2*)p)[0] ) << 48 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
196 | ( u8( ((u2*)p)[1] ) << 32 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
197 | ( u8( ((u2*)p)[2] ) << 16 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
198 | ( u8( ((u2*)p)[3] ) ); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
199 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
200 default: return ( u8(p[0]) << 56 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
201 | ( u8(p[1]) << 48 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
202 | ( u8(p[2]) << 40 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
203 | ( u8(p[3]) << 32 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
204 | ( u8(p[4]) << 24 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
205 | ( u8(p[5]) << 16 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
206 | ( u8(p[6]) << 8 ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
207 | u8(p[7]); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
208 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
209 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
210 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
211 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
212 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
213 static inline void put_native_u2(address p, u2 x) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
214 if ( (intptr_t(p) & 1) == 0 ) { *(u2*)p = x; } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
215 else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
216 p[0] = x >> 8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
217 p[1] = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
218 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
219 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
220 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
221 static inline void put_native_u4(address p, u4 x) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
222 switch ( intptr_t(p) & 3 ) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
223 case 0: *(u4*)p = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
224 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
225 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
226 case 2: ((u2*)p)[0] = x >> 16; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
227 ((u2*)p)[1] = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
228 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
229 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
230 default: ((u1*)p)[0] = x >> 24; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
231 ((u1*)p)[1] = x >> 16; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
232 ((u1*)p)[2] = x >> 8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
233 ((u1*)p)[3] = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
234 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
235 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
236 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
237 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
238 static inline void put_native_u8(address p, u8 x) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
239 switch ( intptr_t(p) & 7 ) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
240 case 0: *(u8*)p = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
241 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
242 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
243 case 4: ((u4*)p)[0] = x >> 32; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
244 ((u4*)p)[1] = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
245 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
246 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
247 case 2: ((u2*)p)[0] = x >> 48; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
248 ((u2*)p)[1] = x >> 32; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
249 ((u2*)p)[2] = x >> 16; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
250 ((u2*)p)[3] = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
251 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
252 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
253 default: ((u1*)p)[0] = x >> 56; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
254 ((u1*)p)[1] = x >> 48; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
255 ((u1*)p)[2] = x >> 40; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
256 ((u1*)p)[3] = x >> 32; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
257 ((u1*)p)[4] = x >> 24; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
258 ((u1*)p)[5] = x >> 16; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
259 ((u1*)p)[6] = x >> 8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
260 ((u1*)p)[7] = x; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
261 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
262 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
263 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
264 // Efficient reading and writing of unaligned unsigned data in Java byte ordering (i.e. big-endian ordering) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
265 // (no byte-order reversal is needed since Power CPUs are big-endian oriented). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
266 static inline u2 get_Java_u2(address p) { return get_native_u2(p); } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
267 static inline u4 get_Java_u4(address p) { return get_native_u4(p); } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
268 static inline u8 get_Java_u8(address p) { return get_native_u8(p); } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
269 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
270 static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, x); } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
271 static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, x); } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
272 static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, x); } |
17830
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
273 |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
274 #endif // VM_LITTLE_ENDIAN |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
275 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
276 |
17830
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
277 #if defined(TARGET_OS_ARCH_linux_ppc) |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
278 #include "bytes_linux_ppc.inline.hpp" |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
279 #endif |
56e7f5560e60
8036767: PPC64: Support for little endian execution model
kvn
parents:
14445
diff
changeset
|
280 |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
281 #endif // CPU_PPC_VM_BYTES_PPC_HPP |