< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

 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 // get a word with the n.th or the right-most or left-most n bits set
1076 // (note: #define used only so that they can be used in enum constant definitions)
1077 #define nth_bit(n)        (((n) >= BitsPerWord) ? 0 : (OneBit << (n)))

 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 // Prototyping
 639 // "Code Missing Here" macro, un-define when integrating back from prototyping stage and break
 640 // compilation on purpose (i.e. "forget me not")
 641 #define PROTOTYPE
 642 #ifdef PROTOTYPE
 643 #define CMH(m)
 644 #endif
 645 
 646 //----------------------------------------------------------------------------------------------------
 647 // Miscellaneous
 648 
 649 // 6302670 Eliminate Hotspot __fabsf dependency
 650 // All fabs() callers should call this function instead, which will implicitly
 651 // convert the operand to double, avoiding a dependency on __fabsf which
 652 // doesn't exist in early versions of Solaris 8.
 653 inline double fabsd(double value) {
 654   return fabs(value);
 655 }
 656 
 657 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 658 // is zero, return 0.0.
 659 template<typename T>
 660 inline double percent_of(T numerator, T denominator) {
 661   return denominator != 0 ? (double)numerator / (double)denominator * 100.0 : 0.0;
 662 }
 663 
 664 //----------------------------------------------------------------------------------------------------
 665 // Special casts

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

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

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

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

1051 
1052 //----------------------------------------------------------------------------------------------------
1053 // Special constants for debugging
1054 
1055 const jint     badInt             = -3;                     // generic "bad int" value
1056 const intptr_t badAddressVal      = -2;                     // generic "bad address" value
1057 const intptr_t badOopVal          = -1;                     // generic "bad oop" value
1058 const intptr_t badHeapOopVal      = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
1059 const int      badStackSegVal     = 0xCA;                   // value used to zap stack segments
1060 const int      badHandleValue     = 0xBC;                   // value used to zap vm handle area
1061 const int      badResourceValue   = 0xAB;                   // value used to zap resource area
1062 const int      freeBlockPad       = 0xBA;                   // value used to pad freed blocks.
1063 const int      uninitBlockPad     = 0xF1;                   // value used to zap newly malloc'd blocks.
1064 const juint    uninitMetaWordVal  = 0xf7f7f7f7;             // value used to zap newly allocated metachunk
1065 const jubyte   heapPaddingByteVal = 0xBD;                   // value used to zap object padding in the heap
1066 const juint    badHeapWordVal     = 0xBAADBABE;             // value used to zap heap after GC
1067 const int      badCodeHeapNewVal  = 0xCC;                   // value used to zap Code heap at allocation
1068 const int      badCodeHeapFreeVal = 0xDD;                   // value used to zap Code heap at deallocation
1069 const intptr_t badDispHeaderDeopt = 0xDE0BD000;             // value to fill unused displaced header during deoptimization
1070 const intptr_t badDispHeaderOSR   = 0xDEAD05A0;             // value to fill unused displaced header during OSR
1071 const juint    badRegWordVal      = 0xDEADDA7A;             // value used to zap registers
1072 
1073 // (These must be implemented as #defines because C++ compilers are
1074 // not obligated to inline non-integral constants!)
1075 #define       badAddress        ((address)::badAddressVal)
1076 #define       badHeapWord       (::badHeapWordVal)
1077 
1078 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
1079 const uint TASKQUEUE_SIZE = (NOT_LP64(1<<14) LP64_ONLY(1<<17));
1080 
1081 //----------------------------------------------------------------------------------------------------
1082 // Utility functions for bitfield manipulations
1083 
1084 const intptr_t AllBits    = ~0; // all bits set in a word
1085 const intptr_t NoBits     =  0; // no bits set in a word
1086 const jlong    NoLongBits =  0; // no bits set in a long
1087 const intptr_t OneBit     =  1; // only right_most bit set in a word
1088 
1089 // get a word with the n.th or the right-most or left-most n bits set
1090 // (note: #define used only so that they can be used in enum constant definitions)
1091 #define nth_bit(n)        (((n) >= BitsPerWord) ? 0 : (OneBit << (n)))
< prev index next >