comparison src/share/vm/utilities/globalDefinitions.hpp @ 6948:e522a00b91aa

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author Doug Simon <doug.simon@oracle.com>
date Mon, 12 Nov 2012 23:14:12 +0100
parents 957c266d8bc5 8e47bac5643a
children 606964349cf4
comparison
equal deleted inserted replaced
6711:ae13cc658b80 6948:e522a00b91aa
126 public: 126 public:
127 char* value() { return i; } 127 char* value() { return i; }
128 #endif 128 #endif
129 }; 129 };
130 130
131 // Analogous opaque struct for metadata allocated from
132 // metaspaces.
133 class MetaWord {
134 friend class VMStructs;
135 private:
136 char* i;
137 };
138
131 // HeapWordSize must be 2^LogHeapWordSize. 139 // HeapWordSize must be 2^LogHeapWordSize.
132 const int HeapWordSize = sizeof(HeapWord); 140 const int HeapWordSize = sizeof(HeapWord);
133 #ifdef _LP64 141 #ifdef _LP64
134 const int LogHeapWordSize = 3; 142 const int LogHeapWordSize = 3;
135 #else 143 #else
270 } 278 }
271 // A version specialized for HeapWord*'s. 279 // A version specialized for HeapWord*'s.
272 inline size_t pointer_delta(const HeapWord* left, const HeapWord* right) { 280 inline size_t pointer_delta(const HeapWord* left, const HeapWord* right) {
273 return pointer_delta(left, right, sizeof(HeapWord)); 281 return pointer_delta(left, right, sizeof(HeapWord));
274 } 282 }
283 // A version specialized for MetaWord*'s.
284 inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) {
285 return pointer_delta(left, right, sizeof(MetaWord));
286 }
275 287
276 // 288 //
277 // ANSI C++ does not allow casting from one pointer type to a function pointer 289 // ANSI C++ does not allow casting from one pointer type to a function pointer
278 // directly without at best a warning. This macro accomplishes it silently 290 // directly without at best a warning. This macro accomplishes it silently
279 // In every case that is present at this point the value be cast is a pointer 291 // In every case that is present at this point the value be cast is a pointer
333 extern int MinObjAlignmentInBytesMask; 345 extern int MinObjAlignmentInBytesMask;
334 346
335 extern int LogMinObjAlignment; 347 extern int LogMinObjAlignment;
336 extern int LogMinObjAlignmentInBytes; 348 extern int LogMinObjAlignmentInBytes;
337 349
350 const int LogKlassAlignmentInBytes = 3;
351 const int LogKlassAlignment = LogKlassAlignmentInBytes - LogHeapWordSize;
352 const int KlassAlignmentInBytes = 1 << LogKlassAlignmentInBytes;
353 const int KlassAlignment = KlassAlignmentInBytes / HeapWordSize;
354
355 // Klass encoding metaspace max size
356 const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
357
338 // Machine dependent stuff 358 // Machine dependent stuff
339 359
340 #ifdef TARGET_ARCH_x86 360 #ifdef TARGET_ARCH_x86
341 # include "globalDefinitions_x86.hpp" 361 # include "globalDefinitions_x86.hpp"
342 #endif 362 #endif
467 void basic_types_init(); // cannot define here; uses assert 487 void basic_types_init(); // cannot define here; uses assert
468 488
469 489
470 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java 490 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
471 enum BasicType { 491 enum BasicType {
472 T_BOOLEAN = 4, 492 T_BOOLEAN = 4,
473 T_CHAR = 5, 493 T_CHAR = 5,
474 T_FLOAT = 6, 494 T_FLOAT = 6,
475 T_DOUBLE = 7, 495 T_DOUBLE = 7,
476 T_BYTE = 8, 496 T_BYTE = 8,
477 T_SHORT = 9, 497 T_SHORT = 9,
478 T_INT = 10, 498 T_INT = 10,
479 T_LONG = 11, 499 T_LONG = 11,
480 T_OBJECT = 12, 500 T_OBJECT = 12,
481 T_ARRAY = 13, 501 T_ARRAY = 13,
482 T_VOID = 14, 502 T_VOID = 14,
483 T_ADDRESS = 15, 503 T_ADDRESS = 15,
484 T_NARROWOOP= 16, 504 T_NARROWOOP = 16,
485 T_CONFLICT = 17, // for stack value type with conflicting contents 505 T_METADATA = 17,
486 T_ILLEGAL = 99 506 T_NARROWKLASS = 18,
507 T_CONFLICT = 19, // for stack value type with conflicting contents
508 T_ILLEGAL = 99
487 }; 509 };
488 510
489 inline bool is_java_primitive(BasicType t) { 511 inline bool is_java_primitive(BasicType t) {
490 return T_BOOLEAN <= t && t <= T_LONG; 512 return T_BOOLEAN <= t && t <= T_LONG;
491 } 513 }
529 extern size_t lcm(size_t a, size_t b); 551 extern size_t lcm(size_t a, size_t b);
530 552
531 553
532 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java 554 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
533 enum BasicTypeSize { 555 enum BasicTypeSize {
534 T_BOOLEAN_size = 1, 556 T_BOOLEAN_size = 1,
535 T_CHAR_size = 1, 557 T_CHAR_size = 1,
536 T_FLOAT_size = 1, 558 T_FLOAT_size = 1,
537 T_DOUBLE_size = 2, 559 T_DOUBLE_size = 2,
538 T_BYTE_size = 1, 560 T_BYTE_size = 1,
539 T_SHORT_size = 1, 561 T_SHORT_size = 1,
540 T_INT_size = 1, 562 T_INT_size = 1,
541 T_LONG_size = 2, 563 T_LONG_size = 2,
542 T_OBJECT_size = 1, 564 T_OBJECT_size = 1,
543 T_ARRAY_size = 1, 565 T_ARRAY_size = 1,
544 T_NARROWOOP_size = 1, 566 T_NARROWOOP_size = 1,
545 T_VOID_size = 0 567 T_NARROWKLASS_size = 1,
568 T_VOID_size = 0
546 }; 569 };
547 570
548 571
549 // maps a BasicType to its instance field storage type: 572 // maps a BasicType to its instance field storage type:
550 // all sub-word integral types are widened to T_INT 573 // all sub-word integral types are widened to T_INT
552 extern BasicType type2wfield[T_CONFLICT+1]; 575 extern BasicType type2wfield[T_CONFLICT+1];
553 576
554 577
555 // size in bytes 578 // size in bytes
556 enum ArrayElementSize { 579 enum ArrayElementSize {
557 T_BOOLEAN_aelem_bytes = 1, 580 T_BOOLEAN_aelem_bytes = 1,
558 T_CHAR_aelem_bytes = 2, 581 T_CHAR_aelem_bytes = 2,
559 T_FLOAT_aelem_bytes = 4, 582 T_FLOAT_aelem_bytes = 4,
560 T_DOUBLE_aelem_bytes = 8, 583 T_DOUBLE_aelem_bytes = 8,
561 T_BYTE_aelem_bytes = 1, 584 T_BYTE_aelem_bytes = 1,
562 T_SHORT_aelem_bytes = 2, 585 T_SHORT_aelem_bytes = 2,
563 T_INT_aelem_bytes = 4, 586 T_INT_aelem_bytes = 4,
564 T_LONG_aelem_bytes = 8, 587 T_LONG_aelem_bytes = 8,
565 #ifdef _LP64 588 #ifdef _LP64
566 T_OBJECT_aelem_bytes = 8, 589 T_OBJECT_aelem_bytes = 8,
567 T_ARRAY_aelem_bytes = 8, 590 T_ARRAY_aelem_bytes = 8,
568 #else 591 #else
569 T_OBJECT_aelem_bytes = 4, 592 T_OBJECT_aelem_bytes = 4,
570 T_ARRAY_aelem_bytes = 4, 593 T_ARRAY_aelem_bytes = 4,
571 #endif 594 #endif
572 T_NARROWOOP_aelem_bytes = 4, 595 T_NARROWOOP_aelem_bytes = 4,
573 T_VOID_aelem_bytes = 0 596 T_NARROWKLASS_aelem_bytes = 4,
597 T_VOID_aelem_bytes = 0
574 }; 598 };
575 599
576 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element 600 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
577 #ifdef ASSERT 601 #ifdef ASSERT
578 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts 602 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
852 class PeriodicTask; 876 class PeriodicTask;
853 877
854 class JavaCallWrapper; 878 class JavaCallWrapper;
855 879
856 class oopDesc; 880 class oopDesc;
881 class metaDataOopDesc;
857 882
858 class NativeCall; 883 class NativeCall;
859 884
860 class zone; 885 class zone;
861 886
909 const int badResourceValue = 0xAB; // value used to zap resource area 934 const int badResourceValue = 0xAB; // value used to zap resource area
910 const int freeBlockPad = 0xBA; // value used to pad freed blocks. 935 const int freeBlockPad = 0xBA; // value used to pad freed blocks.
911 const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks. 936 const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks.
912 const intptr_t badJNIHandleVal = (intptr_t) CONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area 937 const intptr_t badJNIHandleVal = (intptr_t) CONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area
913 const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC 938 const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC
939 const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC
914 const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation 940 const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation
915 const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation 941 const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation
916 942
917 943
918 // (These must be implemented as #defines because C++ compilers are 944 // (These must be implemented as #defines because C++ compilers are