71 // Format jlong, if necessary 72 #ifndef JLONG_FORMAT 73 #define JLONG_FORMAT INT64_FORMAT 74 #endif 75 #ifndef JULONG_FORMAT 76 #define JULONG_FORMAT UINT64_FORMAT 77 #endif 78 #ifndef JULONG_FORMAT_X 79 #define JULONG_FORMAT_X UINT64_FORMAT_X 80 #endif 81 82 // Format pointers which change size between 32- and 64-bit. 83 #ifdef _LP64 84 #define INTPTR_FORMAT "0x%016" PRIxPTR 85 #define PTR_FORMAT "0x%016" PRIxPTR 86 #else // !_LP64 87 #define INTPTR_FORMAT "0x%08" PRIxPTR 88 #define PTR_FORMAT "0x%08" PRIxPTR 89 #endif // _LP64 90 91 #define INTPTR_FORMAT_W(width) "%" #width PRIxPTR 92 93 #define SSIZE_FORMAT "%" PRIdPTR 94 #define SIZE_FORMAT "%" PRIuPTR 95 #define SIZE_FORMAT_HEX "0x%" PRIxPTR 96 #define SSIZE_FORMAT_W(width) "%" #width PRIdPTR 97 #define SIZE_FORMAT_W(width) "%" #width PRIuPTR 98 #define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR 99 100 #define INTX_FORMAT "%" PRIdPTR 101 #define UINTX_FORMAT "%" PRIuPTR 102 #define INTX_FORMAT_W(width) "%" #width PRIdPTR 103 #define UINTX_FORMAT_W(width) "%" #width PRIuPTR 104 105 //---------------------------------------------------------------------------------------------------- 106 // Constants 107 108 const int LogBytesPerShort = 1; 109 const int LogBytesPerInt = 2; 110 #ifdef _LP64 870 atos = 8, // object cached 871 vtos = 9, // tos not cached 872 number_of_states, 873 ilgl // illegal state: should not occur 874 }; 875 876 877 inline TosState as_TosState(BasicType type) { 878 switch (type) { 879 case T_BYTE : return btos; 880 case T_BOOLEAN: return ztos; 881 case T_CHAR : return ctos; 882 case T_SHORT : return stos; 883 case T_INT : return itos; 884 case T_LONG : return ltos; 885 case T_FLOAT : return ftos; 886 case T_DOUBLE : return dtos; 887 case T_VOID : return vtos; 888 case T_ARRAY : // fall through 889 case T_OBJECT : return atos; 890 } 891 return ilgl; 892 } 893 894 inline BasicType as_BasicType(TosState state) { 895 switch (state) { 896 case btos : return T_BYTE; 897 case ztos : return T_BOOLEAN; 898 case ctos : return T_CHAR; 899 case stos : return T_SHORT; 900 case itos : return T_INT; 901 case ltos : return T_LONG; 902 case ftos : return T_FLOAT; 903 case dtos : return T_DOUBLE; 904 case atos : return T_OBJECT; 905 case vtos : return T_VOID; 906 } 907 return T_ILLEGAL; 908 } 909 910 911 // Helper function to convert BasicType info into TosState 912 // Note: Cannot define here as it uses global constant at the time being. 913 TosState as_TosState(BasicType type); 914 915 916 // JavaThreadState keeps track of which part of the code a thread is executing in. This 917 // information is needed by the safepoint code. 918 // 919 // There are 4 essential states: 920 // 921 // _thread_new : Just started, but not executed init. code yet (most likely still in OS init code) 922 // _thread_in_native : In native code. This is a safepoint region, since all oops will be in jobject handles 923 // _thread_in_vm : Executing in the vm 924 // _thread_in_Java : Executing either interpreted or compiled Java code (or could be in a stub) 925 // 926 // Each state has an associated xxxx_trans state, which is an intermediate state used when a thread is in 927 // a transition from one state to another. These extra states makes it possible for the safepoint code to | 71 // Format jlong, if necessary 72 #ifndef JLONG_FORMAT 73 #define JLONG_FORMAT INT64_FORMAT 74 #endif 75 #ifndef JULONG_FORMAT 76 #define JULONG_FORMAT UINT64_FORMAT 77 #endif 78 #ifndef JULONG_FORMAT_X 79 #define JULONG_FORMAT_X UINT64_FORMAT_X 80 #endif 81 82 // Format pointers which change size between 32- and 64-bit. 83 #ifdef _LP64 84 #define INTPTR_FORMAT "0x%016" PRIxPTR 85 #define PTR_FORMAT "0x%016" PRIxPTR 86 #else // !_LP64 87 #define INTPTR_FORMAT "0x%08" PRIxPTR 88 #define PTR_FORMAT "0x%08" PRIxPTR 89 #endif // _LP64 90 91 // Format pointers without leading zeros 92 #define INTPTRNZ_FORMAT "0x%" PRIxPTR 93 94 #define INTPTR_FORMAT_W(width) "%" #width PRIxPTR 95 96 #define SSIZE_FORMAT "%" PRIdPTR 97 #define SIZE_FORMAT "%" PRIuPTR 98 #define SIZE_FORMAT_HEX "0x%" PRIxPTR 99 #define SSIZE_FORMAT_W(width) "%" #width PRIdPTR 100 #define SIZE_FORMAT_W(width) "%" #width PRIuPTR 101 #define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR 102 103 #define INTX_FORMAT "%" PRIdPTR 104 #define UINTX_FORMAT "%" PRIuPTR 105 #define INTX_FORMAT_W(width) "%" #width PRIdPTR 106 #define UINTX_FORMAT_W(width) "%" #width PRIuPTR 107 108 //---------------------------------------------------------------------------------------------------- 109 // Constants 110 111 const int LogBytesPerShort = 1; 112 const int LogBytesPerInt = 2; 113 #ifdef _LP64 873 atos = 8, // object cached 874 vtos = 9, // tos not cached 875 number_of_states, 876 ilgl // illegal state: should not occur 877 }; 878 879 880 inline TosState as_TosState(BasicType type) { 881 switch (type) { 882 case T_BYTE : return btos; 883 case T_BOOLEAN: return ztos; 884 case T_CHAR : return ctos; 885 case T_SHORT : return stos; 886 case T_INT : return itos; 887 case T_LONG : return ltos; 888 case T_FLOAT : return ftos; 889 case T_DOUBLE : return dtos; 890 case T_VOID : return vtos; 891 case T_ARRAY : // fall through 892 case T_OBJECT : return atos; 893 default : return ilgl; 894 } 895 } 896 897 inline BasicType as_BasicType(TosState state) { 898 switch (state) { 899 case btos : return T_BYTE; 900 case ztos : return T_BOOLEAN; 901 case ctos : return T_CHAR; 902 case stos : return T_SHORT; 903 case itos : return T_INT; 904 case ltos : return T_LONG; 905 case ftos : return T_FLOAT; 906 case dtos : return T_DOUBLE; 907 case atos : return T_OBJECT; 908 case vtos : return T_VOID; 909 default : return T_ILLEGAL; 910 } 911 } 912 913 914 // Helper function to convert BasicType info into TosState 915 // Note: Cannot define here as it uses global constant at the time being. 916 TosState as_TosState(BasicType type); 917 918 919 // JavaThreadState keeps track of which part of the code a thread is executing in. This 920 // information is needed by the safepoint code. 921 // 922 // There are 4 essential states: 923 // 924 // _thread_new : Just started, but not executed init. code yet (most likely still in OS init code) 925 // _thread_in_native : In native code. This is a safepoint region, since all oops will be in jobject handles 926 // _thread_in_vm : Executing in the vm 927 // _thread_in_Java : Executing either interpreted or compiled Java code (or could be in a stub) 928 // 929 // Each state has an associated xxxx_trans state, which is an intermediate state used when a thread is in 930 // a transition from one state to another. These extra states makes it possible for the safepoint code to |