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 |
909 const int badResourceValue = 0xAB; // value used to zap resource area |
923 const int badResourceValue = 0xAB; // value used to zap resource area |
910 const int freeBlockPad = 0xBA; // value used to pad freed blocks. |
924 const int freeBlockPad = 0xBA; // value used to pad freed blocks. |
911 const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks. |
925 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 |
926 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 |
927 const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC |
|
928 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 |
929 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 |
930 const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation |
916 |
931 |
917 |
932 |
918 // (These must be implemented as #defines because C++ compilers are |
933 // (These must be implemented as #defines because C++ compilers are |