947 // a transition from one state to another. These extra states makes it possible for the safepoint code to
948 // handle certain thread_states without having to suspend the thread - making the safepoint code faster.
949 //
950 // Given a state, the xxxx_trans state can always be found by adding 1.
951 //
952 enum JavaThreadState {
953 _thread_uninitialized = 0, // should never happen (missing initialization)
954 _thread_new = 2, // just starting up, i.e., in process of being initialized
955 _thread_new_trans = 3, // corresponding transition state (not used, included for completness)
956 _thread_in_native = 4, // running in native code
957 _thread_in_native_trans = 5, // corresponding transition state
958 _thread_in_vm = 6, // running in VM
959 _thread_in_vm_trans = 7, // corresponding transition state
960 _thread_in_Java = 8, // running in Java or in stub code
961 _thread_in_Java_trans = 9, // corresponding transition state (not used, included for completness)
962 _thread_blocked = 10, // blocked in vm
963 _thread_blocked_trans = 11, // corresponding transition state
964 _thread_max_state = 12 // maximum thread state+1 - used for statistics allocation
965 };
966
967 //----------------------------------------------------------------------------------------------------
968 // Special constants for debugging
969
970 const jint badInt = -3; // generic "bad int" value
971 const intptr_t badAddressVal = -2; // generic "bad address" value
972 const intptr_t badOopVal = -1; // generic "bad oop" value
973 const intptr_t badHeapOopVal = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
974 const int badStackSegVal = 0xCA; // value used to zap stack segments
975 const int badHandleValue = 0xBC; // value used to zap vm handle area
976 const int badResourceValue = 0xAB; // value used to zap resource area
977 const int freeBlockPad = 0xBA; // value used to pad freed blocks.
978 const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks.
979 const juint uninitMetaWordVal= 0xf7f7f7f7; // value used to zap newly allocated metachunk
980 const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC
981 const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC
982 const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation
983 const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation
984
985
986 // (These must be implemented as #defines because C++ compilers are
987 // not obligated to inline non-integral constants!)
988 #define badAddress ((address)::badAddressVal)
989 #define badOop (cast_to_oop(::badOopVal))
990 #define badHeapWord (::badHeapWordVal)
991
992 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
993 #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))
994
995 //----------------------------------------------------------------------------------------------------
996 // Utility functions for bitfield manipulations
997
998 const intptr_t AllBits = ~0; // all bits set in a word
999 const intptr_t NoBits = 0; // no bits set in a word
1000 const jlong NoLongBits = 0; // no bits set in a long
1001 const intptr_t OneBit = 1; // only right_most bit set in a word
1002
1003 // get a word with the n.th or the right-most or left-most n bits set
1004 // (note: #define used only so that they can be used in enum constant definitions)
|
947 // a transition from one state to another. These extra states makes it possible for the safepoint code to
948 // handle certain thread_states without having to suspend the thread - making the safepoint code faster.
949 //
950 // Given a state, the xxxx_trans state can always be found by adding 1.
951 //
952 enum JavaThreadState {
953 _thread_uninitialized = 0, // should never happen (missing initialization)
954 _thread_new = 2, // just starting up, i.e., in process of being initialized
955 _thread_new_trans = 3, // corresponding transition state (not used, included for completness)
956 _thread_in_native = 4, // running in native code
957 _thread_in_native_trans = 5, // corresponding transition state
958 _thread_in_vm = 6, // running in VM
959 _thread_in_vm_trans = 7, // corresponding transition state
960 _thread_in_Java = 8, // running in Java or in stub code
961 _thread_in_Java_trans = 9, // corresponding transition state (not used, included for completness)
962 _thread_blocked = 10, // blocked in vm
963 _thread_blocked_trans = 11, // corresponding transition state
964 _thread_max_state = 12 // maximum thread state+1 - used for statistics allocation
965 };
966
967 enum LockingMode {
968 // Use only heavy monitors for locking
969 LM_MONITOR = 0,
970 // Legacy stack-locking, with monitors as 2nd tier
971 LM_LEGACY = 1,
972 // New lightweight locking, with monitors as 2nd tier
973 LM_LIGHTWEIGHT = 2
974 };
975
976 //----------------------------------------------------------------------------------------------------
977 // Special constants for debugging
978
979 const jint badInt = -3; // generic "bad int" value
980 const intptr_t badAddressVal = -2; // generic "bad address" value
981 const intptr_t badOopVal = -1; // generic "bad oop" value
982 const intptr_t badHeapOopVal = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
983 const int badStackSegVal = 0xCA; // value used to zap stack segments
984 const int badHandleValue = 0xBC; // value used to zap vm handle area
985 const int badResourceValue = 0xAB; // value used to zap resource area
986 const int freeBlockPad = 0xBA; // value used to pad freed blocks.
987 const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks.
988 const juint uninitMetaWordVal= 0xf7f7f7f7; // value used to zap newly allocated metachunk
989 const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC
990 const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC
991 const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation
992 const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation
993 const intptr_t badDispHeaderDeopt = 0xDE0BD000; // value to fill unused displaced header during deoptimization
994 const intptr_t badDispHeaderOSR = 0xDEAD05A0; // value to fill unused displaced header during OSR
995
996 // (These must be implemented as #defines because C++ compilers are
997 // not obligated to inline non-integral constants!)
998 #define badAddress ((address)::badAddressVal)
999 #define badOop (cast_to_oop(::badOopVal))
1000 #define badHeapWord (::badHeapWordVal)
1001
1002 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
1003 #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))
1004
1005 //----------------------------------------------------------------------------------------------------
1006 // Utility functions for bitfield manipulations
1007
1008 const intptr_t AllBits = ~0; // all bits set in a word
1009 const intptr_t NoBits = 0; // no bits set in a word
1010 const jlong NoLongBits = 0; // no bits set in a long
1011 const intptr_t OneBit = 1; // only right_most bit set in a word
1012
1013 // get a word with the n.th or the right-most or left-most n bits set
1014 // (note: #define used only so that they can be used in enum constant definitions)
|