< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

 600 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 601 #else
 602 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 603 // Final decision is subject to JEP 188: Java Memory Model Update.
 604 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 605 #endif
 606 
 607 // The expected size in bytes of a cache line, used to pad data structures.
 608 #ifndef DEFAULT_CACHE_LINE_SIZE
 609   #define DEFAULT_CACHE_LINE_SIZE 64
 610 #endif
 611 
 612 
 613 //----------------------------------------------------------------------------------------------------
 614 // Utility macros for compilers
 615 // used to silence compiler warnings
 616 
 617 #define Unused_Variable(var) var
 618 
 619 









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

 685 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 686 enum BasicType : u1 {
 687 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 688   T_BOOLEAN     = JVM_T_BOOLEAN,
 689   T_CHAR        = JVM_T_CHAR,
 690   T_FLOAT       = JVM_T_FLOAT,
 691   T_DOUBLE      = JVM_T_DOUBLE,
 692   T_BYTE        = JVM_T_BYTE,
 693   T_SHORT       = JVM_T_SHORT,
 694   T_INT         = JVM_T_INT,
 695   T_LONG        = JVM_T_LONG,
 696   // The remaining values are not part of any standard.
 697   // T_OBJECT and T_VOID denote two more semantic choices
 698   // for method return values.
 699   // T_OBJECT and T_ARRAY describe signature syntax.
 700   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 701   // internal references within the JVM as if they were Java
 702   // types in their own right.
 703   T_OBJECT      = 12,
 704   T_ARRAY       = 13,
 705   T_VOID        = 14,
 706   T_ADDRESS     = 15,
 707   T_NARROWOOP   = 16,
 708   T_METADATA    = 17,
 709   T_NARROWKLASS = 18,
 710   T_CONFLICT    = 19, // for stack value type with conflicting contents

 711   T_ILLEGAL     = 99
 712 };
 713 
 714 #define SIGNATURE_TYPES_DO(F, N)                \
 715     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 716     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 717     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 718     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 719     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 720     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 721     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 722     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 723     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 724     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \

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

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

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

 842 #else
 843   T_OBJECT_aelem_bytes      = 4,
 844   T_ARRAY_aelem_bytes       = 4,

 845 #endif
 846   T_NARROWOOP_aelem_bytes   = 4,
 847   T_NARROWKLASS_aelem_bytes = 4,
 848   T_VOID_aelem_bytes        = 0
 849 };
 850 
 851 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 852 #ifdef ASSERT
 853 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 854 #else
 855 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 856 #endif
 857 
 858 inline bool same_type_or_subword_size(BasicType t1, BasicType t2) {
 859   return (t1 == t2) || (is_subword_type(t1) && type2aelembytes(t1) == type2aelembytes(t2));
 860 }
 861 
 862 // JavaValue serves as a container for arbitrary Java values.
 863 
 864 class JavaValue {

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

 955     case T_OBJECT : return atos;
 956     default       : return ilgl;
 957   }
 958 }
 959 
 960 inline BasicType as_BasicType(TosState state) {
 961   switch (state) {
 962     case btos : return T_BYTE;
 963     case ztos : return T_BOOLEAN;
 964     case ctos : return T_CHAR;
 965     case stos : return T_SHORT;
 966     case itos : return T_INT;
 967     case ltos : return T_LONG;
 968     case ftos : return T_FLOAT;
 969     case dtos : return T_DOUBLE;
 970     case atos : return T_OBJECT;
 971     case vtos : return T_VOID;
 972     default   : return T_ILLEGAL;
 973   }
 974 }

1304 
1305 //----------------------------------------------------------------------------------------------------
1306 // String type aliases used by command line flag declarations and
1307 // processing utilities.
1308 
1309 typedef const char* ccstr;
1310 typedef const char* ccstrlist;   // represents string arguments which accumulate
1311 
1312 //----------------------------------------------------------------------------------------------------
1313 // Default hash/equals functions used by ResourceHashtable
1314 
1315 template<typename K> unsigned primitive_hash(const K& k) {
1316   unsigned hash = (unsigned)((uintptr_t)k);
1317   return hash ^ (hash >> 3); // just in case we're dealing with aligned ptrs
1318 }
1319 
1320 template<typename K> bool primitive_equals(const K& k0, const K& k1) {
1321   return k0 == k1;
1322 }
1323 






1324 template<typename K> int primitive_compare(const K& k0, const K& k1) {
1325   return ((k0 < k1) ? -1 : (k0 == k1) ? 0 : 1);
1326 }
1327 
1328 //----------------------------------------------------------------------------------------------------
1329 
1330 // Allow use of C++ thread_local when approved - see JDK-8282469.
1331 #define APPROVED_CPP_THREAD_LOCAL thread_local
1332 
1333 // Converts any type T to a reference type.
1334 template<typename T>
1335 std::add_rvalue_reference_t<T> declval() noexcept;
1336 
1337 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_HPP

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

 694 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 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_PRIMITIVE_OBJECT = 14,
 715   T_VOID        = 15,
 716   T_ADDRESS     = 16,
 717   T_NARROWOOP   = 17,
 718   T_METADATA    = 18,
 719   T_NARROWKLASS = 19,
 720   T_CONFLICT    = 20, // for stack value type with conflicting contents
 721   T_ILLEGAL     = 99
 722 };
 723 
 724 #define SIGNATURE_TYPES_DO(F, N)                \
 725     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 726     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 727     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 728     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 729     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 730     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 731     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 732     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 733     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 734     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
 735     F(JVM_SIGNATURE_PRIMITIVE_OBJECT, T_PRIMITIVE_OBJECT, N) \
 736     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 737     /*end*/
 738 
 739 inline bool is_java_type(BasicType t) {
 740   return T_BOOLEAN <= t && t <= T_VOID;
 741 }
 742 
 743 inline bool is_java_primitive(BasicType t) {
 744   return T_BOOLEAN <= t && t <= T_LONG;
 745 }
 746 
 747 inline bool is_subword_type(BasicType t) {
 748   // these guys are processed exactly like T_INT in calling sequences:
 749   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 750 }
 751 
 752 inline bool is_signed_subword_type(BasicType t) {
 753   return (t == T_BYTE || t == T_SHORT);
 754 }
 755 
 756 inline bool is_unsigned_subword_type(BasicType t) {
 757   return (t == T_BOOLEAN || t == T_CHAR);
 758 }
 759 
 760 inline bool is_double_word_type(BasicType t) {
 761   return (t == T_DOUBLE || t == T_LONG);
 762 }
 763 
 764 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {
 765   return (t == T_OBJECT || t == T_ARRAY || t == T_PRIMITIVE_OBJECT || (include_narrow_oop && t == T_NARROWOOP));
 766 }
 767 
 768 inline bool is_integral_type(BasicType t) {
 769   return is_subword_type(t) || t == T_INT || t == T_LONG;
 770 }
 771 
 772 inline bool is_non_subword_integral_type(BasicType t) {
 773   return t == T_INT || t == T_LONG;
 774 }
 775 
 776 inline bool is_floating_point_type(BasicType t) {
 777   return (t == T_FLOAT || t == T_DOUBLE);
 778 }
 779 
 780 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 781 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 782 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 783 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 784 extern BasicType name2type(const char* name);
 785 

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

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

1319 
1320 //----------------------------------------------------------------------------------------------------
1321 // String type aliases used by command line flag declarations and
1322 // processing utilities.
1323 
1324 typedef const char* ccstr;
1325 typedef const char* ccstrlist;   // represents string arguments which accumulate
1326 
1327 //----------------------------------------------------------------------------------------------------
1328 // Default hash/equals functions used by ResourceHashtable
1329 
1330 template<typename K> unsigned primitive_hash(const K& k) {
1331   unsigned hash = (unsigned)((uintptr_t)k);
1332   return hash ^ (hash >> 3); // just in case we're dealing with aligned ptrs
1333 }
1334 
1335 template<typename K> bool primitive_equals(const K& k0, const K& k1) {
1336   return k0 == k1;
1337 }
1338 
1339 // TEMP!!!!
1340 // This should be removed after LW2 arrays are implemented (JDK-8220790).
1341 // It's an alias to (EnablePrimitiveClasses && (FlatArrayElementMaxSize != 0)),
1342 // which is actually not 100% correct, but works for the current set of C1/C2
1343 // implementation and test cases.
1344 #define UseFlatArray (EnablePrimitiveClasses && (FlatArrayElementMaxSize != 0))
1345 template<typename K> int primitive_compare(const K& k0, const K& k1) {
1346   return ((k0 < k1) ? -1 : (k0 == k1) ? 0 : 1);
1347 }
1348 
1349 //----------------------------------------------------------------------------------------------------
1350 
1351 // Allow use of C++ thread_local when approved - see JDK-8282469.
1352 #define APPROVED_CPP_THREAD_LOCAL thread_local
1353 
1354 // Converts any type T to a reference type.
1355 template<typename T>
1356 std::add_rvalue_reference_t<T> declval() noexcept;
1357 
1358 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_HPP
< prev index next >