< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

 616 // by Luc Maranget, Susmit Sarkar and Peter Sewell, INRIA/Cambridge)
 617 #ifdef CPU_MULTI_COPY_ATOMIC
 618 // Not needed.
 619 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 620 #else
 621 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 622 // Final decision is subject to JEP 188: Java Memory Model Update.
 623 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 624 #endif
 625 
 626 // The expected size in bytes of a cache line.
 627 #ifndef DEFAULT_CACHE_LINE_SIZE
 628 #error "Platform should define DEFAULT_CACHE_LINE_SIZE"
 629 #endif
 630 
 631 // The default padding size for data structures to avoid false sharing.
 632 #ifndef DEFAULT_PADDING_SIZE
 633 #error "Platform should define DEFAULT_PADDING_SIZE"
 634 #endif
 635 
 636 
 637 //----------------------------------------------------------------------------------------------------
 638 // Miscellaneous
 639 
 640 // 6302670 Eliminate Hotspot __fabsf dependency
 641 // All fabs() callers should call this function instead, which will implicitly
 642 // convert the operand to double, avoiding a dependency on __fabsf which
 643 // doesn't exist in early versions of Solaris 8.
 644 inline double fabsd(double value) {
 645   return fabs(value);
 646 }
 647 
 648 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 649 // is zero, return 0.0.
 650 template<typename T>
 651 inline double percent_of(T numerator, T denominator) {
 652   return denominator != 0 ? (double)numerator / (double)denominator * 100.0 : 0.0;
 653 }
 654 
 655 //----------------------------------------------------------------------------------------------------
 656 // Special casts

 695 enum BasicType : u1 {
 696 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 697   T_BOOLEAN     = JVM_T_BOOLEAN,
 698   T_CHAR        = JVM_T_CHAR,
 699   T_FLOAT       = JVM_T_FLOAT,
 700   T_DOUBLE      = JVM_T_DOUBLE,
 701   T_BYTE        = JVM_T_BYTE,
 702   T_SHORT       = JVM_T_SHORT,
 703   T_INT         = JVM_T_INT,
 704   T_LONG        = JVM_T_LONG,
 705   // The remaining values are not part of any standard.
 706   // T_OBJECT and T_VOID denote two more semantic choices
 707   // for method return values.
 708   // T_OBJECT and T_ARRAY describe signature syntax.
 709   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 710   // internal references within the JVM as if they were Java
 711   // types in their own right.
 712   T_OBJECT      = 12,
 713   T_ARRAY       = 13,
 714   T_VOID        = 14,
 715   T_ADDRESS     = 15,
 716   T_NARROWOOP   = 16,
 717   T_METADATA    = 17,
 718   T_NARROWKLASS = 18,
 719   T_CONFLICT    = 19, // for stack value type with conflicting contents

 720   T_ILLEGAL     = 99
 721 };
 722 
 723 #define SIGNATURE_TYPES_DO(F, N)                \
 724     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 725     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 726     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 727     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 728     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 729     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 730     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 731     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 732     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 733     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
 734     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 735     /*end*/
 736 
 737 inline bool is_java_type(BasicType t) {
 738   return T_BOOLEAN <= t && t <= T_VOID;
 739 }

 743 }
 744 
 745 inline bool is_subword_type(BasicType t) {
 746   // these guys are processed exactly like T_INT in calling sequences:
 747   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 748 }
 749 
 750 inline bool is_signed_subword_type(BasicType t) {
 751   return (t == T_BYTE || t == T_SHORT);
 752 }
 753 
 754 inline bool is_unsigned_subword_type(BasicType t) {
 755   return (t == T_BOOLEAN || t == T_CHAR);
 756 }
 757 
 758 inline bool is_double_word_type(BasicType t) {
 759   return (t == T_DOUBLE || t == T_LONG);
 760 }
 761 
 762 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {

 763   return (t == T_OBJECT || t == T_ARRAY || (include_narrow_oop && t == T_NARROWOOP));
 764 }
 765 
 766 inline bool is_integral_type(BasicType t) {
 767   return is_subword_type(t) || t == T_INT || t == T_LONG;
 768 }
 769 
 770 inline bool is_non_subword_integral_type(BasicType t) {
 771   return t == T_INT || t == T_LONG;
 772 }
 773 
 774 inline bool is_floating_point_type(BasicType t) {
 775   return (t == T_FLOAT || t == T_DOUBLE);
 776 }
 777 
 778 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 779 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 780 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 781 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 782 extern BasicType name2type(const char* name);

 817 
 818 // Auxiliary math routines
 819 // least common multiple
 820 extern size_t lcm(size_t a, size_t b);
 821 
 822 
 823 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 824 enum BasicTypeSize {
 825   T_BOOLEAN_size     = 1,
 826   T_CHAR_size        = 1,
 827   T_FLOAT_size       = 1,
 828   T_DOUBLE_size      = 2,
 829   T_BYTE_size        = 1,
 830   T_SHORT_size       = 1,
 831   T_INT_size         = 1,
 832   T_LONG_size        = 2,
 833   T_OBJECT_size      = 1,
 834   T_ARRAY_size       = 1,
 835   T_NARROWOOP_size   = 1,
 836   T_NARROWKLASS_size = 1,
 837   T_VOID_size        = 0

 838 };
 839 
 840 // this works on valid parameter types but not T_VOID, T_CONFLICT, etc.
 841 inline int parameter_type_word_count(BasicType t) {
 842   if (is_double_word_type(t))  return 2;
 843   assert(is_java_primitive(t) || is_reference_type(t), "no goofy types here please");
 844   assert(type2size[t] == 1, "must be");
 845   return 1;
 846 }
 847 
 848 // maps a BasicType to its instance field storage type:
 849 // all sub-word integral types are widened to T_INT
 850 extern BasicType type2field[T_CONFLICT+1];
 851 extern BasicType type2wfield[T_CONFLICT+1];
 852 
 853 
 854 // size in bytes
 855 enum ArrayElementSize {
 856   T_BOOLEAN_aelem_bytes     = 1,
 857   T_CHAR_aelem_bytes        = 2,
 858   T_FLOAT_aelem_bytes       = 4,
 859   T_DOUBLE_aelem_bytes      = 8,
 860   T_BYTE_aelem_bytes        = 1,
 861   T_SHORT_aelem_bytes       = 2,
 862   T_INT_aelem_bytes         = 4,
 863   T_LONG_aelem_bytes        = 8,
 864 #ifdef _LP64
 865   T_OBJECT_aelem_bytes      = 8,
 866   T_ARRAY_aelem_bytes       = 8,
 867 #else
 868   T_OBJECT_aelem_bytes      = 4,
 869   T_ARRAY_aelem_bytes       = 4,
 870 #endif
 871   T_NARROWOOP_aelem_bytes   = 4,
 872   T_NARROWKLASS_aelem_bytes = 4,
 873   T_VOID_aelem_bytes        = 0

 874 };
 875 
 876 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 877 #ifdef ASSERT
 878 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 879 #else
 880 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 881 #endif
 882 
 883 inline bool same_type_or_subword_size(BasicType t1, BasicType t2) {
 884   return (t1 == t2) || (is_subword_type(t1) && type2aelembytes(t1) == type2aelembytes(t2));
 885 }
 886 
 887 // JavaValue serves as a container for arbitrary Java values.
 888 
 889 class JavaValue {
 890 
 891  public:
 892   typedef union JavaCallValue {
 893     jfloat   f;

 943 
 944 // TosState describes the top-of-stack state before and after the execution of
 945 // a bytecode or method. The top-of-stack value may be cached in one or more CPU
 946 // registers. The TosState corresponds to the 'machine representation' of this cached
 947 // value. There's 4 states corresponding to the JAVA types int, long, float & double
 948 // as well as a 5th state in case the top-of-stack value is actually on the top
 949 // of stack (in memory) and thus not cached. The atos state corresponds to the itos
 950 // state when it comes to machine representation but is used separately for (oop)
 951 // type specific operations (e.g. verification code).
 952 
 953 enum TosState {         // describes the tos cache contents
 954   btos = 0,             // byte, bool tos cached
 955   ztos = 1,             // byte, bool tos cached
 956   ctos = 2,             // char tos cached
 957   stos = 3,             // short tos cached
 958   itos = 4,             // int tos cached
 959   ltos = 5,             // long tos cached
 960   ftos = 6,             // float tos cached
 961   dtos = 7,             // double tos cached
 962   atos = 8,             // object cached
 963   vtos = 9,             // tos not cached
 964   number_of_states,
 965   ilgl                  // illegal state: should not occur
 966 };
 967 
 968 
 969 inline TosState as_TosState(BasicType type) {
 970   switch (type) {
 971     case T_BYTE   : return btos;
 972     case T_BOOLEAN: return ztos;
 973     case T_CHAR   : return ctos;
 974     case T_SHORT  : return stos;
 975     case T_INT    : return itos;
 976     case T_LONG   : return ltos;
 977     case T_FLOAT  : return ftos;
 978     case T_DOUBLE : return dtos;
 979     case T_VOID   : return vtos;
 980     case T_ARRAY  : // fall through
 981     case T_OBJECT : return atos;
 982     default       : return ilgl;
 983   }
 984 }
 985 
 986 inline BasicType as_BasicType(TosState state) {
 987   switch (state) {
 988     case btos : return T_BYTE;
 989     case ztos : return T_BOOLEAN;
 990     case ctos : return T_CHAR;
 991     case stos : return T_SHORT;
 992     case itos : return T_INT;
 993     case ltos : return T_LONG;
 994     case ftos : return T_FLOAT;
 995     case dtos : return T_DOUBLE;
 996     case atos : return T_OBJECT;
 997     case vtos : return T_VOID;
 998     default   : return T_ILLEGAL;
 999   }
1000 }

1038 
1039 //----------------------------------------------------------------------------------------------------
1040 // Special constants for debugging
1041 
1042 const jint     badInt             = -3;                     // generic "bad int" value
1043 const intptr_t badAddressVal      = -2;                     // generic "bad address" value
1044 const intptr_t badOopVal          = -1;                     // generic "bad oop" value
1045 const intptr_t badHeapOopVal      = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
1046 const int      badStackSegVal     = 0xCA;                   // value used to zap stack segments
1047 const int      badHandleValue     = 0xBC;                   // value used to zap vm handle area
1048 const int      badResourceValue   = 0xAB;                   // value used to zap resource area
1049 const int      freeBlockPad       = 0xBA;                   // value used to pad freed blocks.
1050 const int      uninitBlockPad     = 0xF1;                   // value used to zap newly malloc'd blocks.
1051 const juint    uninitMetaWordVal  = 0xf7f7f7f7;             // value used to zap newly allocated metachunk
1052 const jubyte   heapPaddingByteVal = 0xBD;                   // value used to zap object padding in the heap
1053 const juint    badHeapWordVal     = 0xBAADBABE;             // value used to zap heap after GC
1054 const int      badCodeHeapNewVal  = 0xCC;                   // value used to zap Code heap at allocation
1055 const int      badCodeHeapFreeVal = 0xDD;                   // value used to zap Code heap at deallocation
1056 const intptr_t badDispHeaderDeopt = 0xDE0BD000;             // value to fill unused displaced header during deoptimization
1057 const intptr_t badDispHeaderOSR   = 0xDEAD05A0;             // value to fill unused displaced header during OSR

1058 
1059 // (These must be implemented as #defines because C++ compilers are
1060 // not obligated to inline non-integral constants!)
1061 #define       badAddress        ((address)::badAddressVal)
1062 #define       badHeapWord       (::badHeapWordVal)
1063 
1064 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
1065 const uint TASKQUEUE_SIZE = (NOT_LP64(1<<14) LP64_ONLY(1<<17));
1066 
1067 //----------------------------------------------------------------------------------------------------
1068 // Utility functions for bitfield manipulations
1069 
1070 const intptr_t AllBits    = ~0; // all bits set in a word
1071 const intptr_t NoBits     =  0; // no bits set in a word
1072 const jlong    NoLongBits =  0; // no bits set in a long
1073 const intptr_t OneBit     =  1; // only right_most bit set in a word
1074 
1075 // Return a value of type T with the n.th bit set and all other bits zero.
1076 // T must be an integral or enum type. n must be non-negative. If n is at
1077 // least the bitwise size of T then all bits in the result are zero.

 616 // by Luc Maranget, Susmit Sarkar and Peter Sewell, INRIA/Cambridge)
 617 #ifdef CPU_MULTI_COPY_ATOMIC
 618 // Not needed.
 619 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 620 #else
 621 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 622 // Final decision is subject to JEP 188: Java Memory Model Update.
 623 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 624 #endif
 625 
 626 // The expected size in bytes of a cache line.
 627 #ifndef DEFAULT_CACHE_LINE_SIZE
 628 #error "Platform should define DEFAULT_CACHE_LINE_SIZE"
 629 #endif
 630 
 631 // The default padding size for data structures to avoid false sharing.
 632 #ifndef DEFAULT_PADDING_SIZE
 633 #error "Platform should define DEFAULT_PADDING_SIZE"
 634 #endif
 635 

 636 //----------------------------------------------------------------------------------------------------
 637 // Miscellaneous
 638 
 639 // 6302670 Eliminate Hotspot __fabsf dependency
 640 // All fabs() callers should call this function instead, which will implicitly
 641 // convert the operand to double, avoiding a dependency on __fabsf which
 642 // doesn't exist in early versions of Solaris 8.
 643 inline double fabsd(double value) {
 644   return fabs(value);
 645 }
 646 
 647 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 648 // is zero, return 0.0.
 649 template<typename T>
 650 inline double percent_of(T numerator, T denominator) {
 651   return denominator != 0 ? (double)numerator / (double)denominator * 100.0 : 0.0;
 652 }
 653 
 654 //----------------------------------------------------------------------------------------------------
 655 // Special casts

 694 enum BasicType : u1 {
 695 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 696   T_BOOLEAN     = JVM_T_BOOLEAN,
 697   T_CHAR        = JVM_T_CHAR,
 698   T_FLOAT       = JVM_T_FLOAT,
 699   T_DOUBLE      = JVM_T_DOUBLE,
 700   T_BYTE        = JVM_T_BYTE,
 701   T_SHORT       = JVM_T_SHORT,
 702   T_INT         = JVM_T_INT,
 703   T_LONG        = JVM_T_LONG,
 704   // The remaining values are not part of any standard.
 705   // T_OBJECT and T_VOID denote two more semantic choices
 706   // for method return values.
 707   // T_OBJECT and T_ARRAY describe signature syntax.
 708   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 709   // internal references within the JVM as if they were Java
 710   // types in their own right.
 711   T_OBJECT      = 12,
 712   T_ARRAY       = 13,
 713   T_VOID        = 14,
 714   T_FLAT_ELEMENT = 15, // Not a true BasicType, only used in layout helpers of flat arrays
 715   T_ADDRESS     = 16,
 716   T_NARROWOOP   = 17,
 717   T_METADATA    = 18,
 718   T_NARROWKLASS = 19,
 719   T_CONFLICT    = 20, // for stack value type with conflicting contents
 720   T_ILLEGAL     = 99
 721 };
 722 
 723 #define SIGNATURE_TYPES_DO(F, N)                \
 724     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 725     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 726     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 727     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 728     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 729     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 730     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 731     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 732     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 733     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
 734     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 735     /*end*/
 736 
 737 inline bool is_java_type(BasicType t) {
 738   return T_BOOLEAN <= t && t <= T_VOID;
 739 }

 743 }
 744 
 745 inline bool is_subword_type(BasicType t) {
 746   // these guys are processed exactly like T_INT in calling sequences:
 747   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 748 }
 749 
 750 inline bool is_signed_subword_type(BasicType t) {
 751   return (t == T_BYTE || t == T_SHORT);
 752 }
 753 
 754 inline bool is_unsigned_subword_type(BasicType t) {
 755   return (t == T_BOOLEAN || t == T_CHAR);
 756 }
 757 
 758 inline bool is_double_word_type(BasicType t) {
 759   return (t == T_DOUBLE || t == T_LONG);
 760 }
 761 
 762 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {
 763   assert(t != T_FLAT_ELEMENT, "");  // Strong assert to detect misuses of T_FLAT_ELEMENT
 764   return (t == T_OBJECT || t == T_ARRAY || (include_narrow_oop && t == T_NARROWOOP));
 765 }
 766 
 767 inline bool is_integral_type(BasicType t) {
 768   return is_subword_type(t) || t == T_INT || t == T_LONG;
 769 }
 770 
 771 inline bool is_non_subword_integral_type(BasicType t) {
 772   return t == T_INT || t == T_LONG;
 773 }
 774 
 775 inline bool is_floating_point_type(BasicType t) {
 776   return (t == T_FLOAT || t == T_DOUBLE);
 777 }
 778 
 779 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 780 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 781 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 782 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 783 extern BasicType name2type(const char* name);

 818 
 819 // Auxiliary math routines
 820 // least common multiple
 821 extern size_t lcm(size_t a, size_t b);
 822 
 823 
 824 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 825 enum BasicTypeSize {
 826   T_BOOLEAN_size     = 1,
 827   T_CHAR_size        = 1,
 828   T_FLOAT_size       = 1,
 829   T_DOUBLE_size      = 2,
 830   T_BYTE_size        = 1,
 831   T_SHORT_size       = 1,
 832   T_INT_size         = 1,
 833   T_LONG_size        = 2,
 834   T_OBJECT_size      = 1,
 835   T_ARRAY_size       = 1,
 836   T_NARROWOOP_size   = 1,
 837   T_NARROWKLASS_size = 1,
 838   T_VOID_size        = 0,
 839   T_FLAT_ELEMENT_size = 0
 840 };
 841 
 842 // this works on valid parameter types but not T_VOID, T_CONFLICT, etc.
 843 inline int parameter_type_word_count(BasicType t) {
 844   if (is_double_word_type(t))  return 2;
 845   assert(is_java_primitive(t) || is_reference_type(t), "no goofy types here please");
 846   assert(type2size[t] == 1, "must be");
 847   return 1;
 848 }
 849 
 850 // maps a BasicType to its instance field storage type:
 851 // all sub-word integral types are widened to T_INT
 852 extern BasicType type2field[T_CONFLICT+1];
 853 extern BasicType type2wfield[T_CONFLICT+1];
 854 
 855 
 856 // size in bytes
 857 enum ArrayElementSize {
 858   T_BOOLEAN_aelem_bytes     = 1,
 859   T_CHAR_aelem_bytes        = 2,
 860   T_FLOAT_aelem_bytes       = 4,
 861   T_DOUBLE_aelem_bytes      = 8,
 862   T_BYTE_aelem_bytes        = 1,
 863   T_SHORT_aelem_bytes       = 2,
 864   T_INT_aelem_bytes         = 4,
 865   T_LONG_aelem_bytes        = 8,
 866 #ifdef _LP64
 867   T_OBJECT_aelem_bytes      = 8,
 868   T_ARRAY_aelem_bytes       = 8,
 869 #else
 870   T_OBJECT_aelem_bytes      = 4,
 871   T_ARRAY_aelem_bytes       = 4,
 872 #endif
 873   T_NARROWOOP_aelem_bytes   = 4,
 874   T_NARROWKLASS_aelem_bytes = 4,
 875   T_VOID_aelem_bytes        = 0,
 876   T_FLAT_ELEMENT_aelem_bytes = 0
 877 };
 878 
 879 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 880 #ifdef ASSERT
 881 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 882 #else
 883 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 884 #endif
 885 
 886 inline bool same_type_or_subword_size(BasicType t1, BasicType t2) {
 887   return (t1 == t2) || (is_subword_type(t1) && type2aelembytes(t1) == type2aelembytes(t2));
 888 }
 889 
 890 // JavaValue serves as a container for arbitrary Java values.
 891 
 892 class JavaValue {
 893 
 894  public:
 895   typedef union JavaCallValue {
 896     jfloat   f;

 946 
 947 // TosState describes the top-of-stack state before and after the execution of
 948 // a bytecode or method. The top-of-stack value may be cached in one or more CPU
 949 // registers. The TosState corresponds to the 'machine representation' of this cached
 950 // value. There's 4 states corresponding to the JAVA types int, long, float & double
 951 // as well as a 5th state in case the top-of-stack value is actually on the top
 952 // of stack (in memory) and thus not cached. The atos state corresponds to the itos
 953 // state when it comes to machine representation but is used separately for (oop)
 954 // type specific operations (e.g. verification code).
 955 
 956 enum TosState {         // describes the tos cache contents
 957   btos = 0,             // byte, bool tos cached
 958   ztos = 1,             // byte, bool tos cached
 959   ctos = 2,             // char tos cached
 960   stos = 3,             // short tos cached
 961   itos = 4,             // int tos cached
 962   ltos = 5,             // long tos cached
 963   ftos = 6,             // float tos cached
 964   dtos = 7,             // double tos cached
 965   atos = 8,             // object cached
 966   vtos = 9,             // tos not cached,
 967   number_of_states,
 968   ilgl                  // illegal state: should not occur
 969 };
 970 
 971 
 972 inline TosState as_TosState(BasicType type) {
 973   switch (type) {
 974     case T_BYTE   : return btos;
 975     case T_BOOLEAN: return ztos;
 976     case T_CHAR   : return ctos;
 977     case T_SHORT  : return stos;
 978     case T_INT    : return itos;
 979     case T_LONG   : return ltos;
 980     case T_FLOAT  : return ftos;
 981     case T_DOUBLE : return dtos;
 982     case T_VOID   : return vtos;
 983     case T_ARRAY  :   // fall through
 984     case T_OBJECT : return atos;
 985     default       : return ilgl;
 986   }
 987 }
 988 
 989 inline BasicType as_BasicType(TosState state) {
 990   switch (state) {
 991     case btos : return T_BYTE;
 992     case ztos : return T_BOOLEAN;
 993     case ctos : return T_CHAR;
 994     case stos : return T_SHORT;
 995     case itos : return T_INT;
 996     case ltos : return T_LONG;
 997     case ftos : return T_FLOAT;
 998     case dtos : return T_DOUBLE;
 999     case atos : return T_OBJECT;
1000     case vtos : return T_VOID;
1001     default   : return T_ILLEGAL;
1002   }
1003 }

1041 
1042 //----------------------------------------------------------------------------------------------------
1043 // Special constants for debugging
1044 
1045 const jint     badInt             = -3;                     // generic "bad int" value
1046 const intptr_t badAddressVal      = -2;                     // generic "bad address" value
1047 const intptr_t 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      badStackSegVal     = 0xCA;                   // value used to zap stack segments
1050 const int      badHandleValue     = 0xBC;                   // value used to zap vm handle area
1051 const int      badResourceValue   = 0xAB;                   // value used to zap resource area
1052 const int      freeBlockPad       = 0xBA;                   // value used to pad freed blocks.
1053 const int      uninitBlockPad     = 0xF1;                   // value used to zap newly malloc'd blocks.
1054 const juint    uninitMetaWordVal  = 0xf7f7f7f7;             // value used to zap newly allocated metachunk
1055 const jubyte   heapPaddingByteVal = 0xBD;                   // value used to zap object padding in the heap
1056 const juint    badHeapWordVal     = 0xBAADBABE;             // value used to zap heap after GC
1057 const int      badCodeHeapNewVal  = 0xCC;                   // value used to zap Code heap at allocation
1058 const int      badCodeHeapFreeVal = 0xDD;                   // value used to zap Code heap at deallocation
1059 const intptr_t badDispHeaderDeopt = 0xDE0BD000;             // value to fill unused displaced header during deoptimization
1060 const intptr_t badDispHeaderOSR   = 0xDEAD05A0;             // value to fill unused displaced header during OSR
1061 const juint    badRegWordVal      = 0xDEADDA7A;             // value used to zap registers
1062 
1063 // (These must be implemented as #defines because C++ compilers are
1064 // not obligated to inline non-integral constants!)
1065 #define       badAddress        ((address)::badAddressVal)
1066 #define       badHeapWord       (::badHeapWordVal)
1067 
1068 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
1069 const uint TASKQUEUE_SIZE = (NOT_LP64(1<<14) LP64_ONLY(1<<17));
1070 
1071 //----------------------------------------------------------------------------------------------------
1072 // Utility functions for bitfield manipulations
1073 
1074 const intptr_t AllBits    = ~0; // all bits set in a word
1075 const intptr_t NoBits     =  0; // no bits set in a word
1076 const jlong    NoLongBits =  0; // no bits set in a long
1077 const intptr_t OneBit     =  1; // only right_most bit set in a word
1078 
1079 // Return a value of type T with the n.th bit set and all other bits zero.
1080 // T must be an integral or enum type. n must be non-negative. If n is at
1081 // least the bitwise size of T then all bits in the result are zero.
< prev index next >