Mercurial > hg > truffle
comparison src/share/vm/utilities/globalDefinitions.cpp @ 113:ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author | coleenp |
---|---|
date | Sun, 13 Apr 2008 17:43:42 -0400 |
parents | d5fc211aea19 |
children | d1605aabd0a1 |
comparison
equal
deleted
inserted
replaced
110:a49a647afe9a | 113:ba764ed4b6f2 |
---|---|
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 # include "incls/_precompiled.incl" | 25 # include "incls/_precompiled.incl" |
26 # include "incls/_globalDefinitions.cpp.incl" | 26 # include "incls/_globalDefinitions.cpp.incl" |
27 | |
28 | |
29 // Basic error support | 27 // Basic error support |
28 | |
29 // Info for oops within a java object. Defaults are zero so | |
30 // things will break badly if incorrectly initialized. | |
31 int heapOopSize = 0; | |
32 int LogBytesPerHeapOop = 0; | |
33 int LogBitsPerHeapOop = 0; | |
34 int BytesPerHeapOop = 0; | |
35 int BitsPerHeapOop = 0; | |
30 | 36 |
31 void basic_fatal(const char* msg) { | 37 void basic_fatal(const char* msg) { |
32 fatal(msg); | 38 fatal(msg); |
33 } | 39 } |
34 | 40 |
35 | |
36 // Something to help porters sleep at night | 41 // Something to help porters sleep at night |
37 | 42 |
38 void check_basic_types() { | 43 void basic_types_init() { |
39 #ifdef ASSERT | 44 #ifdef ASSERT |
40 #ifdef _LP64 | 45 #ifdef _LP64 |
41 assert(min_intx == (intx)CONST64(0x8000000000000000), "correct constant"); | 46 assert(min_intx == (intx)CONST64(0x8000000000000000), "correct constant"); |
42 assert(max_intx == CONST64(0x7FFFFFFFFFFFFFFF), "correct constant"); | 47 assert(max_intx == CONST64(0x7FFFFFFFFFFFFFFF), "correct constant"); |
43 assert(max_uintx == CONST64(0xFFFFFFFFFFFFFFFF), "correct constant"); | 48 assert(max_uintx == CONST64(0xFFFFFFFFFFFFFFFF), "correct constant"); |
90 case T_FLOAT: | 95 case T_FLOAT: |
91 case T_DOUBLE: | 96 case T_DOUBLE: |
92 case T_LONG: | 97 case T_LONG: |
93 case T_OBJECT: | 98 case T_OBJECT: |
94 case T_ADDRESS: // random raw pointer | 99 case T_ADDRESS: // random raw pointer |
100 case T_NARROWOOP: // compressed pointer | |
95 case T_CONFLICT: // might as well support a bottom type | 101 case T_CONFLICT: // might as well support a bottom type |
96 case T_VOID: // padding or other unaddressed word | 102 case T_VOID: // padding or other unaddressed word |
97 // layout type must map to itself | 103 // layout type must map to itself |
98 assert(vt == ft, ""); | 104 assert(vt == ft, ""); |
99 break; | 105 break; |
132 os::java_to_os_priority[8] = JavaPriority8_To_OSPriority; | 138 os::java_to_os_priority[8] = JavaPriority8_To_OSPriority; |
133 if( JavaPriority9_To_OSPriority != -1 ) | 139 if( JavaPriority9_To_OSPriority != -1 ) |
134 os::java_to_os_priority[9] = JavaPriority9_To_OSPriority; | 140 os::java_to_os_priority[9] = JavaPriority9_To_OSPriority; |
135 if(JavaPriority10_To_OSPriority != -1 ) | 141 if(JavaPriority10_To_OSPriority != -1 ) |
136 os::java_to_os_priority[10] = JavaPriority10_To_OSPriority; | 142 os::java_to_os_priority[10] = JavaPriority10_To_OSPriority; |
143 | |
144 // Set the size of basic types here (after argument parsing but before | |
145 // stub generation). | |
146 if (UseCompressedOops) { | |
147 // Size info for oops within java objects is fixed | |
148 heapOopSize = jintSize; | |
149 LogBytesPerHeapOop = LogBytesPerInt; | |
150 LogBitsPerHeapOop = LogBitsPerInt; | |
151 BytesPerHeapOop = BytesPerInt; | |
152 BitsPerHeapOop = BitsPerInt; | |
153 } else { | |
154 heapOopSize = oopSize; | |
155 LogBytesPerHeapOop = LogBytesPerWord; | |
156 LogBitsPerHeapOop = LogBitsPerWord; | |
157 BytesPerHeapOop = BytesPerWord; | |
158 BitsPerHeapOop = BitsPerWord; | |
159 } | |
160 _type2aelembytes[T_OBJECT] = heapOopSize; | |
161 _type2aelembytes[T_ARRAY] = heapOopSize; | |
137 } | 162 } |
138 | 163 |
139 | 164 |
140 // Map BasicType to signature character | 165 // Map BasicType to signature character |
141 char type2char_tab[T_CONFLICT+1]={ 0, 0, 0, 0, 'Z', 'C', 'F', 'D', 'B', 'S', 'I', 'J', 'L', '[', 'V', 0, 0}; | 166 char type2char_tab[T_CONFLICT+1]={ 0, 0, 0, 0, 'Z', 'C', 'F', 'D', 'B', 'S', 'I', 'J', 'L', '[', 'V', 0, 0, 0}; |
142 | 167 |
143 // Map BasicType to Java type name | 168 // Map BasicType to Java type name |
144 const char* type2name_tab[T_CONFLICT+1] = { | 169 const char* type2name_tab[T_CONFLICT+1] = { |
145 NULL, NULL, NULL, NULL, | 170 NULL, NULL, NULL, NULL, |
146 "boolean", | 171 "boolean", |
153 "long", | 178 "long", |
154 "object", | 179 "object", |
155 "array", | 180 "array", |
156 "void", | 181 "void", |
157 "*address*", | 182 "*address*", |
183 "*narrowoop*", | |
158 "*conflict*" | 184 "*conflict*" |
159 }; | 185 }; |
160 | 186 |
161 | 187 |
162 BasicType name2type(const char* name) { | 188 BasicType name2type(const char* name) { |
168 return T_ILLEGAL; | 194 return T_ILLEGAL; |
169 } | 195 } |
170 | 196 |
171 | 197 |
172 // Map BasicType to size in words | 198 // Map BasicType to size in words |
173 int type2size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, -1}; | 199 int type2size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, 1, -1}; |
174 | 200 |
175 BasicType type2field[T_CONFLICT+1] = { | 201 BasicType type2field[T_CONFLICT+1] = { |
176 (BasicType)0, // 0, | 202 (BasicType)0, // 0, |
177 (BasicType)0, // 1, | 203 (BasicType)0, // 1, |
178 (BasicType)0, // 2, | 204 (BasicType)0, // 2, |
187 T_LONG, // T_LONG = 11, | 213 T_LONG, // T_LONG = 11, |
188 T_OBJECT, // T_OBJECT = 12, | 214 T_OBJECT, // T_OBJECT = 12, |
189 T_OBJECT, // T_ARRAY = 13, | 215 T_OBJECT, // T_ARRAY = 13, |
190 T_VOID, // T_VOID = 14, | 216 T_VOID, // T_VOID = 14, |
191 T_ADDRESS, // T_ADDRESS = 15, | 217 T_ADDRESS, // T_ADDRESS = 15, |
192 T_CONFLICT // T_CONFLICT = 16, | 218 T_NARROWOOP, // T_NARROWOOP= 16, |
219 T_CONFLICT // T_CONFLICT = 17, | |
193 }; | 220 }; |
194 | 221 |
195 | 222 |
196 BasicType type2wfield[T_CONFLICT+1] = { | 223 BasicType type2wfield[T_CONFLICT+1] = { |
197 (BasicType)0, // 0, | 224 (BasicType)0, // 0, |
208 T_LONG, // T_LONG = 11, | 235 T_LONG, // T_LONG = 11, |
209 T_OBJECT, // T_OBJECT = 12, | 236 T_OBJECT, // T_OBJECT = 12, |
210 T_OBJECT, // T_ARRAY = 13, | 237 T_OBJECT, // T_ARRAY = 13, |
211 T_VOID, // T_VOID = 14, | 238 T_VOID, // T_VOID = 14, |
212 T_ADDRESS, // T_ADDRESS = 15, | 239 T_ADDRESS, // T_ADDRESS = 15, |
213 T_CONFLICT // T_CONFLICT = 16, | 240 T_NARROWOOP, // T_NARROWOOP = 16, |
241 T_CONFLICT // T_CONFLICT = 17, | |
214 }; | 242 }; |
215 | 243 |
216 | 244 |
217 int _type2aelembytes[T_CONFLICT+1] = { | 245 int _type2aelembytes[T_CONFLICT+1] = { |
218 0, // 0 | 246 0, // 0 |
229 T_LONG_aelem_bytes, // T_LONG = 11, | 257 T_LONG_aelem_bytes, // T_LONG = 11, |
230 T_OBJECT_aelem_bytes, // T_OBJECT = 12, | 258 T_OBJECT_aelem_bytes, // T_OBJECT = 12, |
231 T_ARRAY_aelem_bytes, // T_ARRAY = 13, | 259 T_ARRAY_aelem_bytes, // T_ARRAY = 13, |
232 0, // T_VOID = 14, | 260 0, // T_VOID = 14, |
233 T_OBJECT_aelem_bytes, // T_ADDRESS = 15, | 261 T_OBJECT_aelem_bytes, // T_ADDRESS = 15, |
234 0 // T_CONFLICT = 16, | 262 T_NARROWOOP_aelem_bytes,// T_NARROWOOP= 16, |
263 0 // T_CONFLICT = 17, | |
235 }; | 264 }; |
236 | 265 |
237 #ifdef ASSERT | 266 #ifdef ASSERT |
238 int type2aelembytes(BasicType t, bool allow_address) { | 267 int type2aelembytes(BasicType t, bool allow_address) { |
239 assert(allow_address || t != T_ADDRESS, " "); | 268 assert(allow_address || t != T_ADDRESS, " "); |
243 | 272 |
244 // Support for 64-bit integer arithmetic | 273 // Support for 64-bit integer arithmetic |
245 | 274 |
246 // The following code is mostly taken from JVM typedefs_md.h and system_md.c | 275 // The following code is mostly taken from JVM typedefs_md.h and system_md.c |
247 | 276 |
248 static const jlong high_bit = (jlong)1 << (jlong)63; | 277 static const jlong high_bit = (jlong)1 << (jlong)63; |
249 static const jlong other_bits = ~high_bit; | 278 static const jlong other_bits = ~high_bit; |
250 | 279 |
251 jlong float2long(jfloat f) { | 280 jlong float2long(jfloat f) { |
252 jlong tmp = (jlong) f; | 281 jlong tmp = (jlong) f; |
253 if (tmp != high_bit) { | 282 if (tmp != high_bit) { |