comparison src/share/vm/utilities/globalDefinitions.hpp @ 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 f3de1255b035
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
57 const int WordAlignmentMask = (1 << LogBytesPerWord) - 1; 57 const int WordAlignmentMask = (1 << LogBytesPerWord) - 1;
58 const int LongAlignmentMask = (1 << LogBytesPerLong) - 1; 58 const int LongAlignmentMask = (1 << LogBytesPerLong) - 1;
59 59
60 const int WordsPerLong = 2; // Number of stack entries for longs 60 const int WordsPerLong = 2; // Number of stack entries for longs
61 61
62 const int oopSize = sizeof(char*); 62 const int oopSize = sizeof(char*); // Full-width oop
63 extern int heapOopSize; // Oop within a java object
63 const int wordSize = sizeof(char*); 64 const int wordSize = sizeof(char*);
64 const int longSize = sizeof(jlong); 65 const int longSize = sizeof(jlong);
65 const int jintSize = sizeof(jint); 66 const int jintSize = sizeof(jint);
66 const int size_tSize = sizeof(size_t); 67 const int size_tSize = sizeof(size_t);
67 68
69 const int BytesPerOop = BytesPerWord; // Full-width oop
70
71 extern int LogBytesPerHeapOop; // Oop within a java object
72 extern int LogBitsPerHeapOop;
73 extern int BytesPerHeapOop;
74 extern int BitsPerHeapOop;
75
76 const int BitsPerJavaInteger = 32;
77 const int BitsPerSize_t = size_tSize * BitsPerByte;
78
68 // Size of a char[] needed to represent a jint as a string in decimal. 79 // Size of a char[] needed to represent a jint as a string in decimal.
69 const int jintAsStringSize = 12; 80 const int jintAsStringSize = 12;
70
71 const int LogBytesPerOop = LogBytesPerWord;
72 const int LogBitsPerOop = LogBitsPerWord;
73 const int BytesPerOop = 1 << LogBytesPerOop;
74 const int BitsPerOop = 1 << LogBitsPerOop;
75
76 const int BitsPerJavaInteger = 32;
77 const int BitsPerSize_t = size_tSize * BitsPerByte;
78 81
79 // In fact this should be 82 // In fact this should be
80 // log2_intptr(sizeof(class JavaThread)) - log2_intptr(64); 83 // log2_intptr(sizeof(class JavaThread)) - log2_intptr(64);
81 // see os::set_memory_serialize_page() 84 // see os::set_memory_serialize_page()
82 #ifdef _LP64 85 #ifdef _LP64
97 private: 100 private:
98 char* i; 101 char* i;
99 }; 102 };
100 103
101 // HeapWordSize must be 2^LogHeapWordSize. 104 // HeapWordSize must be 2^LogHeapWordSize.
102 const int HeapWordSize = sizeof(HeapWord); 105 const int HeapWordSize = sizeof(HeapWord);
103 #ifdef _LP64 106 #ifdef _LP64
104 const int LogHeapWordSize = 3; 107 const int LogHeapWordSize = 3;
105 #else 108 #else
106 const int LogHeapWordSize = 2; 109 const int LogHeapWordSize = 2;
107 #endif 110 #endif
108 const int HeapWordsPerOop = oopSize / HeapWordSize; 111 const int HeapWordsPerLong = BytesPerLong / HeapWordSize;
109 const int HeapWordsPerLong = BytesPerLong / HeapWordSize; 112 const int LogHeapWordsPerLong = LogBytesPerLong - LogHeapWordSize;
110 113
111 // The larger HeapWordSize for 64bit requires larger heaps 114 // The larger HeapWordSize for 64bit requires larger heaps
112 // for the same application running in 64bit. See bug 4967770. 115 // for the same application running in 64bit. See bug 4967770.
113 // The minimum alignment to a heap word size is done. Other 116 // The minimum alignment to a heap word size is done. Other
114 // parts of the memory system may required additional alignment 117 // parts of the memory system may required additional alignment
282 285
283 const int MinObjAlignment = HeapWordsPerLong; 286 const int MinObjAlignment = HeapWordsPerLong;
284 const int MinObjAlignmentInBytes = MinObjAlignment * HeapWordSize; 287 const int MinObjAlignmentInBytes = MinObjAlignment * HeapWordSize;
285 const int MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1; 288 const int MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1;
286 289
290 const int LogMinObjAlignment = LogHeapWordsPerLong;
291 const int LogMinObjAlignmentInBytes = LogMinObjAlignment + LogHeapWordSize;
292
287 // Machine dependent stuff 293 // Machine dependent stuff
288 294
289 #include "incls/_globalDefinitions_pd.hpp.incl" 295 #include "incls/_globalDefinitions_pd.hpp.incl"
290 296
291 // The byte alignment to be used by Arena::Amalloc. See bugid 4169348. 297 // The byte alignment to be used by Arena::Amalloc. See bugid 4169348.
369 union jlong_accessor { 375 union jlong_accessor {
370 jint words[2]; 376 jint words[2];
371 jlong long_value; 377 jlong long_value;
372 }; 378 };
373 379
374 void check_basic_types(); // cannot define here; uses assert 380 void basic_types_init(); // cannot define here; uses assert
375 381
376 382
377 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java 383 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
378 enum BasicType { 384 enum BasicType {
379 T_BOOLEAN = 4, 385 T_BOOLEAN = 4,
386 T_LONG = 11, 392 T_LONG = 11,
387 T_OBJECT = 12, 393 T_OBJECT = 12,
388 T_ARRAY = 13, 394 T_ARRAY = 13,
389 T_VOID = 14, 395 T_VOID = 14,
390 T_ADDRESS = 15, 396 T_ADDRESS = 15,
391 T_CONFLICT = 16, // for stack value type with conflicting contents 397 T_NARROWOOP= 16,
398 T_CONFLICT = 17, // for stack value type with conflicting contents
392 T_ILLEGAL = 99 399 T_ILLEGAL = 99
393 }; 400 };
394 401
395 inline bool is_java_primitive(BasicType t) { 402 inline bool is_java_primitive(BasicType t) {
396 return T_BOOLEAN <= t && t <= T_LONG; 403 return T_BOOLEAN <= t && t <= T_LONG;
436 T_SHORT_size = 1, 443 T_SHORT_size = 1,
437 T_INT_size = 1, 444 T_INT_size = 1,
438 T_LONG_size = 2, 445 T_LONG_size = 2,
439 T_OBJECT_size = 1, 446 T_OBJECT_size = 1,
440 T_ARRAY_size = 1, 447 T_ARRAY_size = 1,
448 T_NARROWOOP_size = 1,
441 T_VOID_size = 0 449 T_VOID_size = 0
442 }; 450 };
443 451
444 452
445 // maps a BasicType to its instance field storage type: 453 // maps a BasicType to its instance field storage type:
463 T_ARRAY_aelem_bytes = 8, 471 T_ARRAY_aelem_bytes = 8,
464 #else 472 #else
465 T_OBJECT_aelem_bytes = 4, 473 T_OBJECT_aelem_bytes = 4,
466 T_ARRAY_aelem_bytes = 4, 474 T_ARRAY_aelem_bytes = 4,
467 #endif 475 #endif
476 T_NARROWOOP_aelem_bytes = 4,
468 T_VOID_aelem_bytes = 0 477 T_VOID_aelem_bytes = 0
469 }; 478 };
470 479
471 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element 480 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
472 #ifdef ASSERT 481 #ifdef ASSERT