@@ -20,26 +20,24 @@ class GCHeapSummary;
2020class HeapUsage ;
2121
2222#define TYPE_SIZE_NAME (name ) _##name##_size
23- #define DECL_TYPE_SIZE (name ) static uint64_t TYPE_SIZE_NAME (name);
24- #define SIZE_OF (name ) VM##name::type_size()
2523
2624template <typename T>
27- inline T* cast_to (const void * ptr, uint64_t size ) {
28- assert (size > 0 ); // Ensure type size has been initialized
25+ inline T* cast_to (const void * ptr) {
26+ assert (T::type_size () > 0 ); // Ensure type size has been initialized
2927 assert (ptr == nullptr || SafeAccess::isReadableRange (ptr, T::type_size ()));
3028 return reinterpret_cast <T*>(const_cast <void *>(ptr));
3129}
3230
33- #define DECL_TYPE (name ) \
31+ #define DECLARE (name ) \
3432 class name : VMStructs { \
3533 public: \
3634 static uint64_t type_size () { return TYPE_SIZE_NAME (name); } \
37- static name * cast (const void * ptr) { return cast_to<name>(ptr, type_size ()) ; } \
35+ static name * cast (const void * ptr) { return cast_to<name>(ptr) ; } \
3836 static name * load_then_cast (const void * ptr) { \
3937 assert (ptr != nullptr ); \
4038 return cast (*(const void **)ptr); }
4139
42- #define DECL_TYPE_END };
40+ #define DECLARE_END };
4341
4442#define MATCH_SYMBOLS (...) __VA_ARGS__, nullptr
4543
@@ -353,7 +351,7 @@ class MethodList {
353351class VMNMethod ;
354352class VMMethod ;
355353
356- DECL_TYPE (VMSymbol)
354+ DECLARE (VMSymbol)
357355 public:
358356 unsigned short length () {
359357 if (_symbol_length_offset >= 0 ) {
@@ -366,9 +364,9 @@ DECL_TYPE(VMSymbol)
366364 const char * body () {
367365 return at (_symbol_body_offset);
368366 }
369- DECL_TYPE_END
367+ DECLARE_END
370368
371- DECL_TYPE (VMClassLoaderData)
369+ DECLARE (VMClassLoaderData)
372370 private:
373371 void * mutex () {
374372 return *(void **) at (sizeof (uintptr_t ) * 3 );
@@ -386,9 +384,9 @@ DECL_TYPE(VMClassLoaderData)
386384 MethodList** methodList () {
387385 return (MethodList**) at (sizeof (uintptr_t ) * 6 + 8 );
388386 }
389- DECL_TYPE_END
387+ DECLARE_END
390388
391- DECL_TYPE (VMKlass)
389+ DECLARE (VMKlass)
392390 public:
393391 static VMKlass* fromJavaClass (JNIEnv* env, jclass cls) {
394392 if (sizeof (VMKlass*) == 8 ) {
@@ -440,9 +438,9 @@ DECL_TYPE(VMKlass)
440438 assert (_jmethod_ids_offset >= 0 );
441439 return __atomic_load_n ((jmethodID**) at (_jmethod_ids_offset), __ATOMIC_ACQUIRE);
442440 }
443- DECL_TYPE_END
441+ DECLARE_END
444442
445- DECL_TYPE (VMJavaFrameAnchor)
443+ DECLARE (VMJavaFrameAnchor)
446444 private:
447445 enum { MAX_CALL_WRAPPER_DISTANCE = 512 };
448446
@@ -486,7 +484,7 @@ DECL_TYPE(VMJavaFrameAnchor)
486484 }
487485 return false ;
488486 }
489- DECL_TYPE_END
487+ DECLARE_END
490488
491489// Copied from JDK's globalDefinitions.hpp 'JavaThreadState' enum
492490enum JVMJavaThreadState {
@@ -504,7 +502,7 @@ enum JVMJavaThreadState {
504502 _thread_max_state = 12 // maximum thread state+1 - used for statistics allocation
505503};
506504
507- DECL_TYPE (VMThread)
505+ DECLARE (VMThread)
508506 public:
509507 static VMThread* current ();
510508
@@ -550,7 +548,7 @@ DECL_TYPE(VMThread)
550548 }
551549
552550 bool inDeopt () {
553- assert (_thread_state_offset >= 0 );
551+ assert (_thread_vframe_offset >= 0 );
554552 return SafeAccess::loadPtr ((void **) at (_thread_vframe_offset), nullptr ) != NULL ;
555553 }
556554
@@ -565,13 +563,13 @@ DECL_TYPE(VMThread)
565563 }
566564
567565 inline VMMethod* compiledMethod ();
568- DECL_TYPE_END
566+ DECLARE_END
569567
570- DECL_TYPE (VMConstMethod)
571- DECL_TYPE_END
568+ DECLARE (VMConstMethod)
569+ DECLARE_END
572570
573571
574- DECL_TYPE (VMMethod)
572+ DECLARE (VMMethod)
575573 private:
576574 static bool check_jmethodID_J9 (jmethodID id);
577575 static bool check_jmethodID_hotspot (jmethodID id);
@@ -598,9 +596,9 @@ DECL_TYPE(VMMethod)
598596 inline VMNMethod* code ();
599597
600598 static bool check_jmethodID (jmethodID id);
601- DECL_TYPE_END
599+ DECLARE_END
602600
603- DECL_TYPE (VMNMethod)
601+ DECLARE (VMNMethod)
604602 public:
605603 int size () {
606604 assert (_blob_size_offset >= 0 );
@@ -727,7 +725,7 @@ DECL_TYPE(VMNMethod)
727725 }
728726
729727 int findScopeOffset (const void * pc);
730- DECL_TYPE_END
728+ DECLARE_END
731729
732730class CodeHeap : VMStructs {
733731 private:
@@ -765,7 +763,7 @@ class CodeHeap : VMStructs {
765763 }
766764};
767765
768- DECL_TYPE (VMFlag)
766+ DECLARE (VMFlag)
769767 private:
770768 enum {
771769 ORIGIN_DEFAULT = 0 ,
@@ -825,7 +823,7 @@ DECL_TYPE(VMFlag)
825823 void set (char value) {
826824 *((char *)addr ()) = value;
827825 }
828- DECL_TYPE_END
826+ DECLARE_END
829827
830828class PcDesc {
831829 public:
0 commit comments