Mercurial > hg > truffle
annotate src/share/vm/utilities/globalDefinitions.cpp @ 15306:7e0563f0d249
Rename LIRFrameStateBuilder to BaselineFrameStateBuilder.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 22 Apr 2014 20:16:38 +0200 |
parents | 4ca6dc0799b6 |
children | 89152779163c |
rev | line source |
---|---|
0 | 1 /* |
14909 | 2 * Copyright (c) 1997, 2012, 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:
196
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
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:
196
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "runtime/os.hpp" | |
27 #include "utilities/globalDefinitions.hpp" | |
28 #include "utilities/top.hpp" | |
29 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
30 // Basic error support |
0 | 31 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
32 // Info for oops within a java object. Defaults are zero so |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
33 // things will break badly if incorrectly initialized. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
34 int heapOopSize = 0; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
35 int LogBytesPerHeapOop = 0; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
36 int LogBitsPerHeapOop = 0; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
37 int BytesPerHeapOop = 0; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
38 int BitsPerHeapOop = 0; |
0 | 39 |
1571
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
40 // Object alignment, in units of HeapWords. |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
41 // Defaults are -1 so things will break badly if incorrectly initialized. |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
42 int MinObjAlignment = -1; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
43 int MinObjAlignmentInBytes = -1; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
44 int MinObjAlignmentInBytesMask = 0; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
45 |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
46 int LogMinObjAlignment = -1; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
47 int LogMinObjAlignmentInBytes = -1; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
48 |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
49 // Oop encoding heap max |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
50 uint64_t OopEncodingHeapMax = 0; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
196
diff
changeset
|
51 |
0 | 52 void basic_fatal(const char* msg) { |
53 fatal(msg); | |
54 } | |
55 | |
56 // Something to help porters sleep at night | |
57 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
58 void basic_types_init() { |
0 | 59 #ifdef ASSERT |
60 #ifdef _LP64 | |
61 assert(min_intx == (intx)CONST64(0x8000000000000000), "correct constant"); | |
62 assert(max_intx == CONST64(0x7FFFFFFFFFFFFFFF), "correct constant"); | |
63 assert(max_uintx == CONST64(0xFFFFFFFFFFFFFFFF), "correct constant"); | |
64 assert( 8 == sizeof( intx), "wrong size for basic type"); | |
65 assert( 8 == sizeof( jobject), "wrong size for basic type"); | |
66 #else | |
67 assert(min_intx == (intx)0x80000000, "correct constant"); | |
68 assert(max_intx == 0x7FFFFFFF, "correct constant"); | |
69 assert(max_uintx == 0xFFFFFFFF, "correct constant"); | |
70 assert( 4 == sizeof( intx), "wrong size for basic type"); | |
71 assert( 4 == sizeof( jobject), "wrong size for basic type"); | |
72 #endif | |
73 assert( (~max_juint) == 0, "max_juint has all its bits"); | |
74 assert( (~max_uintx) == 0, "max_uintx has all its bits"); | |
75 assert( (~max_julong) == 0, "max_julong has all its bits"); | |
76 assert( 1 == sizeof( jbyte), "wrong size for basic type"); | |
77 assert( 2 == sizeof( jchar), "wrong size for basic type"); | |
78 assert( 2 == sizeof( jshort), "wrong size for basic type"); | |
79 assert( 4 == sizeof( juint), "wrong size for basic type"); | |
80 assert( 4 == sizeof( jint), "wrong size for basic type"); | |
81 assert( 1 == sizeof( jboolean), "wrong size for basic type"); | |
82 assert( 8 == sizeof( jlong), "wrong size for basic type"); | |
83 assert( 4 == sizeof( jfloat), "wrong size for basic type"); | |
84 assert( 8 == sizeof( jdouble), "wrong size for basic type"); | |
85 assert( 1 == sizeof( u1), "wrong size for basic type"); | |
86 assert( 2 == sizeof( u2), "wrong size for basic type"); | |
87 assert( 4 == sizeof( u4), "wrong size for basic type"); | |
88 | |
89 int num_type_chars = 0; | |
90 for (int i = 0; i < 99; i++) { | |
91 if (type2char((BasicType)i) != 0) { | |
92 assert(char2type(type2char((BasicType)i)) == i, "proper inverses"); | |
93 num_type_chars++; | |
94 } | |
95 } | |
96 assert(num_type_chars == 11, "must have tested the right number of mappings"); | |
97 assert(char2type(0) == T_ILLEGAL, "correct illegality"); | |
98 | |
99 { | |
100 for (int i = T_BOOLEAN; i <= T_CONFLICT; i++) { | |
101 BasicType vt = (BasicType)i; | |
102 BasicType ft = type2field[vt]; | |
103 switch (vt) { | |
104 // the following types might plausibly show up in memory layouts: | |
105 case T_BOOLEAN: | |
106 case T_BYTE: | |
107 case T_CHAR: | |
108 case T_SHORT: | |
109 case T_INT: | |
110 case T_FLOAT: | |
111 case T_DOUBLE: | |
112 case T_LONG: | |
113 case T_OBJECT: | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
114 case T_ADDRESS: // random raw pointer |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
115 case T_METADATA: // metadata pointer |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
116 case T_NARROWOOP: // compressed pointer |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
117 case T_NARROWKLASS: // compressed klass pointer |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
118 case T_CONFLICT: // might as well support a bottom type |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
119 case T_VOID: // padding or other unaddressed word |
0 | 120 // layout type must map to itself |
121 assert(vt == ft, ""); | |
122 break; | |
123 default: | |
124 // non-layout type must map to a (different) layout type | |
125 assert(vt != ft, ""); | |
126 assert(ft == type2field[ft], ""); | |
127 } | |
128 // every type must map to same-sized layout type: | |
129 assert(type2size[vt] == type2size[ft], ""); | |
130 } | |
131 } | |
132 // These are assumed, e.g., when filling HeapWords with juints. | |
133 assert(is_power_of_2(sizeof(juint)), "juint must be power of 2"); | |
134 assert(is_power_of_2(HeapWordSize), "HeapWordSize must be power of 2"); | |
135 assert((size_t)HeapWordSize >= sizeof(juint), | |
136 "HeapWord should be at least as large as juint"); | |
137 assert(sizeof(NULL) == sizeof(char*), "NULL must be same size as pointer"); | |
138 #endif | |
139 | |
140 if( JavaPriority1_To_OSPriority != -1 ) | |
141 os::java_to_os_priority[1] = JavaPriority1_To_OSPriority; | |
142 if( JavaPriority2_To_OSPriority != -1 ) | |
143 os::java_to_os_priority[2] = JavaPriority2_To_OSPriority; | |
144 if( JavaPriority3_To_OSPriority != -1 ) | |
145 os::java_to_os_priority[3] = JavaPriority3_To_OSPriority; | |
146 if( JavaPriority4_To_OSPriority != -1 ) | |
147 os::java_to_os_priority[4] = JavaPriority4_To_OSPriority; | |
148 if( JavaPriority5_To_OSPriority != -1 ) | |
149 os::java_to_os_priority[5] = JavaPriority5_To_OSPriority; | |
150 if( JavaPriority6_To_OSPriority != -1 ) | |
151 os::java_to_os_priority[6] = JavaPriority6_To_OSPriority; | |
152 if( JavaPriority7_To_OSPriority != -1 ) | |
153 os::java_to_os_priority[7] = JavaPriority7_To_OSPriority; | |
154 if( JavaPriority8_To_OSPriority != -1 ) | |
155 os::java_to_os_priority[8] = JavaPriority8_To_OSPriority; | |
156 if( JavaPriority9_To_OSPriority != -1 ) | |
157 os::java_to_os_priority[9] = JavaPriority9_To_OSPriority; | |
158 if(JavaPriority10_To_OSPriority != -1 ) | |
159 os::java_to_os_priority[10] = JavaPriority10_To_OSPriority; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
160 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
161 // Set the size of basic types here (after argument parsing but before |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
162 // stub generation). |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
163 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
164 // Size info for oops within java objects is fixed |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
165 heapOopSize = jintSize; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
166 LogBytesPerHeapOop = LogBytesPerInt; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
167 LogBitsPerHeapOop = LogBitsPerInt; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
168 BytesPerHeapOop = BytesPerInt; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
169 BitsPerHeapOop = BitsPerInt; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
170 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
171 heapOopSize = oopSize; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
172 LogBytesPerHeapOop = LogBytesPerWord; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
173 LogBitsPerHeapOop = LogBitsPerWord; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
174 BytesPerHeapOop = BytesPerWord; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
175 BitsPerHeapOop = BitsPerWord; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
176 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
177 _type2aelembytes[T_OBJECT] = heapOopSize; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
178 _type2aelembytes[T_ARRAY] = heapOopSize; |
0 | 179 } |
180 | |
181 | |
182 // Map BasicType to signature character | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
183 char type2char_tab[T_CONFLICT+1]={ 0, 0, 0, 0, 'Z', 'C', 'F', 'D', 'B', 'S', 'I', 'J', 'L', '[', 'V', 0, 0, 0, 0, 0}; |
0 | 184 |
185 // Map BasicType to Java type name | |
186 const char* type2name_tab[T_CONFLICT+1] = { | |
187 NULL, NULL, NULL, NULL, | |
188 "boolean", | |
189 "char", | |
190 "float", | |
191 "double", | |
192 "byte", | |
193 "short", | |
194 "int", | |
195 "long", | |
196 "object", | |
197 "array", | |
198 "void", | |
199 "*address*", | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
200 "*narrowoop*", |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
201 "*metadata*", |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
202 "*narrowklass*", |
0 | 203 "*conflict*" |
204 }; | |
205 | |
206 | |
207 BasicType name2type(const char* name) { | |
208 for (int i = T_BOOLEAN; i <= T_VOID; i++) { | |
209 BasicType t = (BasicType)i; | |
210 if (type2name_tab[t] != NULL && 0 == strcmp(type2name_tab[t], name)) | |
211 return t; | |
212 } | |
213 return T_ILLEGAL; | |
214 } | |
215 | |
216 | |
217 // Map BasicType to size in words | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
218 int type2size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, -1}; |
0 | 219 |
220 BasicType type2field[T_CONFLICT+1] = { | |
221 (BasicType)0, // 0, | |
222 (BasicType)0, // 1, | |
223 (BasicType)0, // 2, | |
224 (BasicType)0, // 3, | |
225 T_BOOLEAN, // T_BOOLEAN = 4, | |
226 T_CHAR, // T_CHAR = 5, | |
227 T_FLOAT, // T_FLOAT = 6, | |
228 T_DOUBLE, // T_DOUBLE = 7, | |
229 T_BYTE, // T_BYTE = 8, | |
230 T_SHORT, // T_SHORT = 9, | |
231 T_INT, // T_INT = 10, | |
232 T_LONG, // T_LONG = 11, | |
233 T_OBJECT, // T_OBJECT = 12, | |
234 T_OBJECT, // T_ARRAY = 13, | |
235 T_VOID, // T_VOID = 14, | |
236 T_ADDRESS, // T_ADDRESS = 15, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
237 T_NARROWOOP, // T_NARROWOOP= 16, |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
238 T_METADATA, // T_METADATA = 17, |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
239 T_NARROWKLASS, // T_NARROWKLASS = 18, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
240 T_CONFLICT // T_CONFLICT = 19, |
0 | 241 }; |
242 | |
243 | |
244 BasicType type2wfield[T_CONFLICT+1] = { | |
245 (BasicType)0, // 0, | |
246 (BasicType)0, // 1, | |
247 (BasicType)0, // 2, | |
248 (BasicType)0, // 3, | |
249 T_INT, // T_BOOLEAN = 4, | |
250 T_INT, // T_CHAR = 5, | |
251 T_FLOAT, // T_FLOAT = 6, | |
252 T_DOUBLE, // T_DOUBLE = 7, | |
253 T_INT, // T_BYTE = 8, | |
254 T_INT, // T_SHORT = 9, | |
255 T_INT, // T_INT = 10, | |
256 T_LONG, // T_LONG = 11, | |
257 T_OBJECT, // T_OBJECT = 12, | |
258 T_OBJECT, // T_ARRAY = 13, | |
259 T_VOID, // T_VOID = 14, | |
260 T_ADDRESS, // T_ADDRESS = 15, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
261 T_NARROWOOP, // T_NARROWOOP = 16, |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
262 T_METADATA, // T_METADATA = 17, |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
263 T_NARROWKLASS, // T_NARROWKLASS = 18, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
264 T_CONFLICT // T_CONFLICT = 19, |
0 | 265 }; |
266 | |
267 | |
29
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
0
diff
changeset
|
268 int _type2aelembytes[T_CONFLICT+1] = { |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
269 0, // 0 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
270 0, // 1 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
271 0, // 2 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
272 0, // 3 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
273 T_BOOLEAN_aelem_bytes, // T_BOOLEAN = 4, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
274 T_CHAR_aelem_bytes, // T_CHAR = 5, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
275 T_FLOAT_aelem_bytes, // T_FLOAT = 6, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
276 T_DOUBLE_aelem_bytes, // T_DOUBLE = 7, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
277 T_BYTE_aelem_bytes, // T_BYTE = 8, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
278 T_SHORT_aelem_bytes, // T_SHORT = 9, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
279 T_INT_aelem_bytes, // T_INT = 10, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
280 T_LONG_aelem_bytes, // T_LONG = 11, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
281 T_OBJECT_aelem_bytes, // T_OBJECT = 12, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
282 T_ARRAY_aelem_bytes, // T_ARRAY = 13, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
283 0, // T_VOID = 14, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
284 T_OBJECT_aelem_bytes, // T_ADDRESS = 15, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
285 T_NARROWOOP_aelem_bytes, // T_NARROWOOP= 16, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
286 T_OBJECT_aelem_bytes, // T_METADATA = 17, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
287 T_NARROWKLASS_aelem_bytes, // T_NARROWKLASS= 18, |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6739
diff
changeset
|
288 0 // T_CONFLICT = 19, |
0 | 289 }; |
290 | |
29
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
0
diff
changeset
|
291 #ifdef ASSERT |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
0
diff
changeset
|
292 int type2aelembytes(BasicType t, bool allow_address) { |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
0
diff
changeset
|
293 assert(allow_address || t != T_ADDRESS, " "); |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
0
diff
changeset
|
294 return _type2aelembytes[t]; |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
0
diff
changeset
|
295 } |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
0
diff
changeset
|
296 #endif |
0 | 297 |
298 // Support for 64-bit integer arithmetic | |
299 | |
300 // The following code is mostly taken from JVM typedefs_md.h and system_md.c | |
301 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
29
diff
changeset
|
302 static const jlong high_bit = (jlong)1 << (jlong)63; |
0 | 303 static const jlong other_bits = ~high_bit; |
304 | |
305 jlong float2long(jfloat f) { | |
306 jlong tmp = (jlong) f; | |
307 if (tmp != high_bit) { | |
308 return tmp; | |
309 } else { | |
310 if (g_isnan((jdouble)f)) { | |
311 return 0; | |
312 } | |
313 if (f < 0) { | |
314 return high_bit; | |
315 } else { | |
316 return other_bits; | |
317 } | |
318 } | |
319 } | |
320 | |
321 | |
322 jlong double2long(jdouble f) { | |
323 jlong tmp = (jlong) f; | |
324 if (tmp != high_bit) { | |
325 return tmp; | |
326 } else { | |
327 if (g_isnan(f)) { | |
328 return 0; | |
329 } | |
330 if (f < 0) { | |
331 return high_bit; | |
332 } else { | |
333 return other_bits; | |
334 } | |
335 } | |
336 } | |
337 | |
338 // least common multiple | |
339 size_t lcm(size_t a, size_t b) { | |
340 size_t cur, div, next; | |
341 | |
342 cur = MAX2(a, b); | |
343 div = MIN2(a, b); | |
344 | |
345 assert(div != 0, "lcm requires positive arguments"); | |
346 | |
347 | |
348 while ((next = cur % div) != 0) { | |
349 cur = div; div = next; | |
350 } | |
351 | |
352 | |
353 julong result = julong(a) * b / div; | |
354 assert(result <= (size_t)max_uintx, "Integer overflow in lcm"); | |
355 | |
356 return size_t(result); | |
357 } | |
9060
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
358 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
359 #ifndef PRODUCT |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
360 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
361 void GlobalDefinitions::test_globals() { |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
362 intptr_t page_sizes[] = { os::vm_page_size(), 4096, 8192, 65536, 2*1024*1024 }; |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
363 const int num_page_sizes = sizeof(page_sizes) / sizeof(page_sizes[0]); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
364 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
365 for (int i = 0; i < num_page_sizes; i++) { |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
366 intptr_t page_size = page_sizes[i]; |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
367 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
368 address a_page = (address)(10*page_size); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
369 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
370 // Check that address within page is returned as is |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
371 assert(clamp_address_in_page(a_page, a_page, page_size) == a_page, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
372 assert(clamp_address_in_page(a_page + 128, a_page, page_size) == a_page + 128, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
373 assert(clamp_address_in_page(a_page + page_size - 1, a_page, page_size) == a_page + page_size - 1, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
374 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
375 // Check that address above page returns start of next page |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
376 assert(clamp_address_in_page(a_page + page_size, a_page, page_size) == a_page + page_size, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
377 assert(clamp_address_in_page(a_page + page_size + 1, a_page, page_size) == a_page + page_size, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
378 assert(clamp_address_in_page(a_page + page_size*5 + 1, a_page, page_size) == a_page + page_size, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
379 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
380 // Check that address below page returns start of page |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
381 assert(clamp_address_in_page(a_page - 1, a_page, page_size) == a_page, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
382 assert(clamp_address_in_page(a_page - 2*page_size - 1, a_page, page_size) == a_page, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
383 assert(clamp_address_in_page(a_page - 5*page_size - 1, a_page, page_size) == a_page, "incorrect"); |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
384 } |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
385 } |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
386 |
cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
mikael
parents:
6848
diff
changeset
|
387 #endif // PRODUCT |