1042 //----------------------------------------------------------------------------------------------------
1043 // Special constants for debugging
1044
1045 const jint badInt = -3; // generic "bad int" value
1046 const long badAddressVal = -2; // generic "bad address" value
1047 const long badOopVal = -1; // generic "bad oop" value
1048 const intptr_t badHeapOopVal = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
1049 const int badHandleValue = 0xBC; // value used to zap vm handle area
1050 const int badResourceValue = 0xAB; // value used to zap resource area
1051 const int freeBlockPad = 0xBA; // value used to pad freed blocks.
1052 const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks.
1053 const intptr_t badJNIHandleVal = (intptr_t) UCONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area
1054 const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC
1055 const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC
1056 const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation
1057 const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation
1058
1059
1060 // (These must be implemented as #defines because C++ compilers are
1061 // not obligated to inline non-integral constants!)
1062 #define badAddress ((address)::badAddressVal)
1063 #define badOop (cast_to_oop(::badOopVal))
1064 #define badHeapWord (::badHeapWordVal)
1065 #define badJNIHandle (cast_to_oop(::badJNIHandleVal))
1066
1067 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
1068 #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))
1069
1070 //----------------------------------------------------------------------------------------------------
1071 // Utility functions for bitfield manipulations
1072
1073 const intptr_t AllBits = ~0; // all bits set in a word
1074 const intptr_t NoBits = 0; // no bits set in a word
1075 const jlong NoLongBits = 0; // no bits set in a long
1076 const intptr_t OneBit = 1; // only right_most bit set in a word
1077
1078 // get a word with the n.th or the right-most or left-most n bits set
1079 // (note: #define used only so that they can be used in enum constant definitions)
1080 #define nth_bit(n) (n >= BitsPerWord ? 0 : OneBit << (n))
1081 #define right_n_bits(n) (nth_bit(n) - 1)
1082 #define left_n_bits(n) (right_n_bits(n) << (n >= BitsPerWord ? 0 : (BitsPerWord - n)))
|
1042 //----------------------------------------------------------------------------------------------------
1043 // Special constants for debugging
1044
1045 const jint badInt = -3; // generic "bad int" value
1046 const long badAddressVal = -2; // generic "bad address" value
1047 const long badOopVal = -1; // generic "bad oop" value
1048 const intptr_t badHeapOopVal = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
1049 const int badHandleValue = 0xBC; // value used to zap vm handle area
1050 const int badResourceValue = 0xAB; // value used to zap resource area
1051 const int freeBlockPad = 0xBA; // value used to pad freed blocks.
1052 const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks.
1053 const intptr_t badJNIHandleVal = (intptr_t) UCONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area
1054 const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC
1055 const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC
1056 const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation
1057 const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation
1058
1059
1060 // (These must be implemented as #defines because C++ compilers are
1061 // not obligated to inline non-integral constants!)
1062 #define badAddress ((address)(intptr_t)::badAddressVal)
1063 #define badOop (cast_to_oop(::badOopVal))
1064 #define badHeapWord (::badHeapWordVal)
1065 #define badJNIHandle (cast_to_oop(::badJNIHandleVal))
1066
1067 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
1068 #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))
1069
1070 //----------------------------------------------------------------------------------------------------
1071 // Utility functions for bitfield manipulations
1072
1073 const intptr_t AllBits = ~0; // all bits set in a word
1074 const intptr_t NoBits = 0; // no bits set in a word
1075 const jlong NoLongBits = 0; // no bits set in a long
1076 const intptr_t OneBit = 1; // only right_most bit set in a word
1077
1078 // get a word with the n.th or the right-most or left-most n bits set
1079 // (note: #define used only so that they can be used in enum constant definitions)
1080 #define nth_bit(n) (n >= BitsPerWord ? 0 : OneBit << (n))
1081 #define right_n_bits(n) (nth_bit(n) - 1)
1082 #define left_n_bits(n) (right_n_bits(n) << (n >= BitsPerWord ? 0 : (BitsPerWord - n)))
|