< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

 594 #ifdef CPU_MULTI_COPY_ATOMIC
 595 // Not needed.
 596 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 597 #else
 598 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 599 // Final decision is subject to JEP 188: Java Memory Model Update.
 600 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 601 #endif
 602 
 603 // The expected size in bytes of a cache line.
 604 #ifndef DEFAULT_CACHE_LINE_SIZE
 605 #error "Platform should define DEFAULT_CACHE_LINE_SIZE"
 606 #endif
 607 
 608 // The default padding size for data structures to avoid false sharing.
 609 #ifndef DEFAULT_PADDING_SIZE
 610 #error "Platform should define DEFAULT_PADDING_SIZE"
 611 #endif
 612 
 613 









 614 //----------------------------------------------------------------------------------------------------
 615 // Miscellaneous
 616 
 617 // 6302670 Eliminate Hotspot __fabsf dependency
 618 // All fabs() callers should call this function instead, which will implicitly
 619 // convert the operand to double, avoiding a dependency on __fabsf which
 620 // doesn't exist in early versions of Solaris 8.
 621 inline double fabsd(double value) {
 622   return fabs(value);
 623 }
 624 
 625 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 626 // is zero, return 0.0.
 627 template<typename T>
 628 inline double percent_of(T numerator, T denominator) {
 629   return denominator != 0 ? (double)numerator / (double)denominator * 100.0 : 0.0;
 630 }
 631 
 632 //----------------------------------------------------------------------------------------------------
 633 // Special casts

 672 enum BasicType : u1 {
 673 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 674   T_BOOLEAN     = JVM_T_BOOLEAN,
 675   T_CHAR        = JVM_T_CHAR,
 676   T_FLOAT       = JVM_T_FLOAT,
 677   T_DOUBLE      = JVM_T_DOUBLE,
 678   T_BYTE        = JVM_T_BYTE,
 679   T_SHORT       = JVM_T_SHORT,
 680   T_INT         = JVM_T_INT,
 681   T_LONG        = JVM_T_LONG,
 682   // The remaining values are not part of any standard.
 683   // T_OBJECT and T_VOID denote two more semantic choices
 684   // for method return values.
 685   // T_OBJECT and T_ARRAY describe signature syntax.
 686   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 687   // internal references within the JVM as if they were Java
 688   // types in their own right.
 689   T_OBJECT      = 12,
 690   T_ARRAY       = 13,
 691   T_VOID        = 14,
 692   T_ADDRESS     = 15,
 693   T_NARROWOOP   = 16,
 694   T_METADATA    = 17,
 695   T_NARROWKLASS = 18,
 696   T_CONFLICT    = 19, // for stack value type with conflicting contents

 697   T_ILLEGAL     = 99
 698 };
 699 
 700 #define SIGNATURE_TYPES_DO(F, N)                \
 701     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 702     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 703     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 704     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 705     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 706     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 707     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 708     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 709     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 710     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
 711     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 712     /*end*/
 713 
 714 inline bool is_java_type(BasicType t) {
 715   return T_BOOLEAN <= t && t <= T_VOID;
 716 }

 720 }
 721 
 722 inline bool is_subword_type(BasicType t) {
 723   // these guys are processed exactly like T_INT in calling sequences:
 724   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 725 }
 726 
 727 inline bool is_signed_subword_type(BasicType t) {
 728   return (t == T_BYTE || t == T_SHORT);
 729 }
 730 
 731 inline bool is_unsigned_subword_type(BasicType t) {
 732   return (t == T_BOOLEAN || t == T_CHAR);
 733 }
 734 
 735 inline bool is_double_word_type(BasicType t) {
 736   return (t == T_DOUBLE || t == T_LONG);
 737 }
 738 
 739 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {

 740   return (t == T_OBJECT || t == T_ARRAY || (include_narrow_oop && t == T_NARROWOOP));
 741 }
 742 
 743 inline bool is_integral_type(BasicType t) {
 744   return is_subword_type(t) || t == T_INT || t == T_LONG;
 745 }
 746 
 747 inline bool is_non_subword_integral_type(BasicType t) {
 748   return t == T_INT || t == T_LONG;
 749 }
 750 
 751 inline bool is_floating_point_type(BasicType t) {
 752   return (t == T_FLOAT || t == T_DOUBLE);
 753 }
 754 
 755 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 756 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 757 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 758 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 759 extern BasicType name2type(const char* name);

 794 
 795 // Auxiliary math routines
 796 // least common multiple
 797 extern size_t lcm(size_t a, size_t b);
 798 
 799 
 800 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 801 enum BasicTypeSize {
 802   T_BOOLEAN_size     = 1,
 803   T_CHAR_size        = 1,
 804   T_FLOAT_size       = 1,
 805   T_DOUBLE_size      = 2,
 806   T_BYTE_size        = 1,
 807   T_SHORT_size       = 1,
 808   T_INT_size         = 1,
 809   T_LONG_size        = 2,
 810   T_OBJECT_size      = 1,
 811   T_ARRAY_size       = 1,
 812   T_NARROWOOP_size   = 1,
 813   T_NARROWKLASS_size = 1,
 814   T_VOID_size        = 0

 815 };
 816 
 817 // this works on valid parameter types but not T_VOID, T_CONFLICT, etc.
 818 inline int parameter_type_word_count(BasicType t) {
 819   if (is_double_word_type(t))  return 2;
 820   assert(is_java_primitive(t) || is_reference_type(t), "no goofy types here please");
 821   assert(type2size[t] == 1, "must be");
 822   return 1;
 823 }
 824 
 825 // maps a BasicType to its instance field storage type:
 826 // all sub-word integral types are widened to T_INT
 827 extern BasicType type2field[T_CONFLICT+1];
 828 extern BasicType type2wfield[T_CONFLICT+1];
 829 
 830 
 831 // size in bytes
 832 enum ArrayElementSize {
 833   T_BOOLEAN_aelem_bytes     = 1,
 834   T_CHAR_aelem_bytes        = 2,
 835   T_FLOAT_aelem_bytes       = 4,
 836   T_DOUBLE_aelem_bytes      = 8,
 837   T_BYTE_aelem_bytes        = 1,
 838   T_SHORT_aelem_bytes       = 2,
 839   T_INT_aelem_bytes         = 4,
 840   T_LONG_aelem_bytes        = 8,
 841 #ifdef _LP64
 842   T_OBJECT_aelem_bytes      = 8,
 843   T_ARRAY_aelem_bytes       = 8,
 844 #else
 845   T_OBJECT_aelem_bytes      = 4,
 846   T_ARRAY_aelem_bytes       = 4,
 847 #endif
 848   T_NARROWOOP_aelem_bytes   = 4,
 849   T_NARROWKLASS_aelem_bytes = 4,
 850   T_VOID_aelem_bytes        = 0

 851 };
 852 
 853 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 854 #ifdef ASSERT
 855 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 856 #else
 857 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 858 #endif
 859 
 860 inline bool same_type_or_subword_size(BasicType t1, BasicType t2) {
 861   return (t1 == t2) || (is_subword_type(t1) && type2aelembytes(t1) == type2aelembytes(t2));
 862 }
 863 
 864 // JavaValue serves as a container for arbitrary Java values.
 865 
 866 class JavaValue {
 867 
 868  public:
 869   typedef union JavaCallValue {
 870     jfloat   f;

 920 
 921 // TosState describes the top-of-stack state before and after the execution of
 922 // a bytecode or method. The top-of-stack value may be cached in one or more CPU
 923 // registers. The TosState corresponds to the 'machine representation' of this cached
 924 // value. There's 4 states corresponding to the JAVA types int, long, float & double
 925 // as well as a 5th state in case the top-of-stack value is actually on the top
 926 // of stack (in memory) and thus not cached. The atos state corresponds to the itos
 927 // state when it comes to machine representation but is used separately for (oop)
 928 // type specific operations (e.g. verification code).
 929 
 930 enum TosState {         // describes the tos cache contents
 931   btos = 0,             // byte, bool tos cached
 932   ztos = 1,             // byte, bool tos cached
 933   ctos = 2,             // char tos cached
 934   stos = 3,             // short tos cached
 935   itos = 4,             // int tos cached
 936   ltos = 5,             // long tos cached
 937   ftos = 6,             // float tos cached
 938   dtos = 7,             // double tos cached
 939   atos = 8,             // object cached
 940   vtos = 9,             // tos not cached
 941   number_of_states,
 942   ilgl                  // illegal state: should not occur
 943 };
 944 
 945 
 946 inline TosState as_TosState(BasicType type) {
 947   switch (type) {
 948     case T_BYTE   : return btos;
 949     case T_BOOLEAN: return ztos;
 950     case T_CHAR   : return ctos;
 951     case T_SHORT  : return stos;
 952     case T_INT    : return itos;
 953     case T_LONG   : return ltos;
 954     case T_FLOAT  : return ftos;
 955     case T_DOUBLE : return dtos;
 956     case T_VOID   : return vtos;
 957     case T_ARRAY  : // fall through
 958     case T_OBJECT : return atos;
 959     default       : return ilgl;
 960   }
 961 }
 962 
 963 inline BasicType as_BasicType(TosState state) {
 964   switch (state) {
 965     case btos : return T_BYTE;
 966     case ztos : return T_BOOLEAN;
 967     case ctos : return T_CHAR;
 968     case stos : return T_SHORT;
 969     case itos : return T_INT;
 970     case ltos : return T_LONG;
 971     case ftos : return T_FLOAT;
 972     case dtos : return T_DOUBLE;
 973     case atos : return T_OBJECT;
 974     case vtos : return T_VOID;
 975     default   : return T_ILLEGAL;
 976   }
 977 }

1015 
1016 //----------------------------------------------------------------------------------------------------
1017 // Special constants for debugging
1018 
1019 const jint     badInt             = -3;                     // generic "bad int" value
1020 const intptr_t badAddressVal      = -2;                     // generic "bad address" value
1021 const intptr_t badOopVal          = -1;                     // generic "bad oop" value
1022 const intptr_t badHeapOopVal      = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
1023 const int      badStackSegVal     = 0xCA;                   // value used to zap stack segments
1024 const int      badHandleValue     = 0xBC;                   // value used to zap vm handle area
1025 const int      badResourceValue   = 0xAB;                   // value used to zap resource area
1026 const int      freeBlockPad       = 0xBA;                   // value used to pad freed blocks.
1027 const int      uninitBlockPad     = 0xF1;                   // value used to zap newly malloc'd blocks.
1028 const juint    uninitMetaWordVal  = 0xf7f7f7f7;             // value used to zap newly allocated metachunk
1029 const jubyte   heapPaddingByteVal = 0xBD;                   // value used to zap object padding in the heap
1030 const juint    badHeapWordVal     = 0xBAADBABE;             // value used to zap heap after GC
1031 const int      badCodeHeapNewVal  = 0xCC;                   // value used to zap Code heap at allocation
1032 const int      badCodeHeapFreeVal = 0xDD;                   // value used to zap Code heap at deallocation
1033 const intptr_t badDispHeaderDeopt = 0xDE0BD000;             // value to fill unused displaced header during deoptimization
1034 const intptr_t badDispHeaderOSR   = 0xDEAD05A0;             // value to fill unused displaced header during OSR

1035 
1036 // (These must be implemented as #defines because C++ compilers are
1037 // not obligated to inline non-integral constants!)
1038 #define       badAddress        ((address)::badAddressVal)
1039 #define       badHeapWord       (::badHeapWordVal)
1040 
1041 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
1042 const uint TASKQUEUE_SIZE = (NOT_LP64(1<<14) LP64_ONLY(1<<17));
1043 
1044 //----------------------------------------------------------------------------------------------------
1045 // Utility functions for bitfield manipulations
1046 
1047 const intptr_t AllBits    = ~0; // all bits set in a word
1048 const intptr_t NoBits     =  0; // no bits set in a word
1049 const jlong    NoLongBits =  0; // no bits set in a long
1050 const intptr_t OneBit     =  1; // only right_most bit set in a word
1051 
1052 // get a word with the n.th or the right-most or left-most n bits set
1053 // (note: #define used only so that they can be used in enum constant definitions)
1054 #define nth_bit(n)        (((n) >= BitsPerWord) ? 0 : (OneBit << (n)))

 594 #ifdef CPU_MULTI_COPY_ATOMIC
 595 // Not needed.
 596 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 597 #else
 598 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 599 // Final decision is subject to JEP 188: Java Memory Model Update.
 600 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 601 #endif
 602 
 603 // The expected size in bytes of a cache line.
 604 #ifndef DEFAULT_CACHE_LINE_SIZE
 605 #error "Platform should define DEFAULT_CACHE_LINE_SIZE"
 606 #endif
 607 
 608 // The default padding size for data structures to avoid false sharing.
 609 #ifndef DEFAULT_PADDING_SIZE
 610 #error "Platform should define DEFAULT_PADDING_SIZE"
 611 #endif
 612 
 613 
 614 //----------------------------------------------------------------------------------------------------
 615 // Prototyping
 616 // "Code Missing Here" macro, un-define when integrating back from prototyping stage and break
 617 // compilation on purpose (i.e. "forget me not")
 618 #define PROTOTYPE
 619 #ifdef PROTOTYPE
 620 #define CMH(m)
 621 #endif
 622 
 623 //----------------------------------------------------------------------------------------------------
 624 // Miscellaneous
 625 
 626 // 6302670 Eliminate Hotspot __fabsf dependency
 627 // All fabs() callers should call this function instead, which will implicitly
 628 // convert the operand to double, avoiding a dependency on __fabsf which
 629 // doesn't exist in early versions of Solaris 8.
 630 inline double fabsd(double value) {
 631   return fabs(value);
 632 }
 633 
 634 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 635 // is zero, return 0.0.
 636 template<typename T>
 637 inline double percent_of(T numerator, T denominator) {
 638   return denominator != 0 ? (double)numerator / (double)denominator * 100.0 : 0.0;
 639 }
 640 
 641 //----------------------------------------------------------------------------------------------------
 642 // Special casts

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

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

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

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

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