< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

 603 #endif
 604 
 605 // The expected size in bytes of a cache line.
 606 #ifndef DEFAULT_CACHE_LINE_SIZE
 607 #error "Platform should define DEFAULT_CACHE_LINE_SIZE"
 608 #endif
 609 
 610 // The default padding size for data structures to avoid false sharing.
 611 #ifndef DEFAULT_PADDING_SIZE
 612 #error "Platform should define DEFAULT_PADDING_SIZE"
 613 #endif
 614 
 615 
 616 //----------------------------------------------------------------------------------------------------
 617 // Utility macros for compilers
 618 // used to silence compiler warnings
 619 
 620 #define Unused_Variable(var) var
 621 
 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

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

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

 728     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 729     /*end*/
 730 
 731 inline bool is_java_type(BasicType t) {
 732   return T_BOOLEAN <= t && t <= T_VOID;
 733 }
 734 
 735 inline bool is_java_primitive(BasicType t) {
 736   return T_BOOLEAN <= t && t <= T_LONG;
 737 }
 738 
 739 inline bool is_subword_type(BasicType t) {
 740   // these guys are processed exactly like T_INT in calling sequences:
 741   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 742 }
 743 
 744 inline bool is_signed_subword_type(BasicType t) {
 745   return (t == T_BYTE || t == T_SHORT);
 746 }
 747 
 748 inline bool is_unsigned_subword_type(BasicType t) {
 749   return (t == T_BOOLEAN || t == T_CHAR);
 750 }
 751 
 752 inline bool is_double_word_type(BasicType t) {
 753   return (t == T_DOUBLE || t == T_LONG);
 754 }
 755 
 756 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {
 757   return (t == T_OBJECT || t == T_ARRAY || (include_narrow_oop && t == T_NARROWOOP));

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

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

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

 845 #else
 846   T_OBJECT_aelem_bytes      = 4,
 847   T_ARRAY_aelem_bytes       = 4,

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

 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 }

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






1328 template<typename K> int primitive_compare(const K& k0, const K& k1) {
1329   return ((k0 < k1) ? -1 : (k0 == k1) ? 0 : 1);
1330 }
1331 
1332 //----------------------------------------------------------------------------------------------------
1333 
1334 // Allow use of C++ thread_local when approved - see JDK-8282469.
1335 #define APPROVED_CPP_THREAD_LOCAL thread_local
1336 
1337 // Converts any type T to a reference type.
1338 template<typename T>
1339 std::add_rvalue_reference_t<T> declval() noexcept;
1340 
1341 // Quickly test to make sure IEEE-754 subnormal numbers are correctly
1342 // handled.
1343 bool IEEE_subnormal_handling_OK();
1344 
1345 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_HPP

 603 #endif
 604 
 605 // The expected size in bytes of a cache line.
 606 #ifndef DEFAULT_CACHE_LINE_SIZE
 607 #error "Platform should define DEFAULT_CACHE_LINE_SIZE"
 608 #endif
 609 
 610 // The default padding size for data structures to avoid false sharing.
 611 #ifndef DEFAULT_PADDING_SIZE
 612 #error "Platform should define DEFAULT_PADDING_SIZE"
 613 #endif
 614 
 615 
 616 //----------------------------------------------------------------------------------------------------
 617 // Utility macros for compilers
 618 // used to silence compiler warnings
 619 
 620 #define Unused_Variable(var) var
 621 
 622 
 623 //----------------------------------------------------------------------------------------------------
 624 // Prototyping
 625 // "Code Missing Here" macro, un-define when integrating back from prototyping stage and break
 626 // compilation on purpose (i.e. "forget me not")
 627 #define PROTOTYPE
 628 #ifdef PROTOTYPE
 629 #define CMH(m)
 630 #endif
 631 
 632 //----------------------------------------------------------------------------------------------------
 633 // Miscellaneous
 634 
 635 // 6302670 Eliminate Hotspot __fabsf dependency
 636 // All fabs() callers should call this function instead, which will implicitly
 637 // convert the operand to double, avoiding a dependency on __fabsf which
 638 // doesn't exist in early versions of Solaris 8.
 639 inline double fabsd(double value) {
 640   return fabs(value);
 641 }
 642 
 643 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 644 // is zero, return 0.0.
 645 template<typename T>
 646 inline double percent_of(T numerator, T denominator) {
 647   return denominator != 0 ? (double)numerator / (double)denominator * 100.0 : 0.0;
 648 }
 649 
 650 //----------------------------------------------------------------------------------------------------
 651 // Special casts

 697 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 698 enum BasicType : u1 {
 699 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 700   T_BOOLEAN     = JVM_T_BOOLEAN,
 701   T_CHAR        = JVM_T_CHAR,
 702   T_FLOAT       = JVM_T_FLOAT,
 703   T_DOUBLE      = JVM_T_DOUBLE,
 704   T_BYTE        = JVM_T_BYTE,
 705   T_SHORT       = JVM_T_SHORT,
 706   T_INT         = JVM_T_INT,
 707   T_LONG        = JVM_T_LONG,
 708   // The remaining values are not part of any standard.
 709   // T_OBJECT and T_VOID denote two more semantic choices
 710   // for method return values.
 711   // T_OBJECT and T_ARRAY describe signature syntax.
 712   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 713   // internal references within the JVM as if they were Java
 714   // types in their own right.
 715   T_OBJECT      = 12,
 716   T_ARRAY       = 13,
 717   T_PRIMITIVE_OBJECT = 14, // Not a true BasicType, only use in headers of flat arrays
 718   T_VOID        = 15,
 719   T_ADDRESS     = 16,
 720   T_NARROWOOP   = 17,
 721   T_METADATA    = 18,
 722   T_NARROWKLASS = 19,
 723   T_CONFLICT    = 20, // for stack value type with conflicting contents
 724   T_ILLEGAL     = 99
 725 };
 726 
 727 #define SIGNATURE_TYPES_DO(F, N)                \
 728     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 729     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 730     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 731     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 732     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 733     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 734     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 735     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 736     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 737     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
 738     F(JVM_SIGNATURE_PRIMITIVE_OBJECT, T_PRIMITIVE_OBJECT, N) \
 739     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 740     /*end*/
 741 
 742 inline bool is_java_type(BasicType t) {
 743   return T_BOOLEAN <= t && t <= T_VOID;
 744 }
 745 
 746 inline bool is_java_primitive(BasicType t) {
 747   return T_BOOLEAN <= t && t <= T_LONG;
 748 }
 749 
 750 inline bool is_subword_type(BasicType t) {
 751   // these guys are processed exactly like T_INT in calling sequences:
 752   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 753 }
 754 
 755 inline bool is_signed_subword_type(BasicType t) {
 756   return (t == T_BYTE || t == T_SHORT);
 757 }
 758 
 759 inline bool is_unsigned_subword_type(BasicType t) {
 760   return (t == T_BOOLEAN || t == T_CHAR);
 761 }
 762 
 763 inline bool is_double_word_type(BasicType t) {
 764   return (t == T_DOUBLE || t == T_LONG);
 765 }
 766 
 767 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {
 768   // TODO 8325106 Remove the last occurences of T_PRIMITIVE_OBJECT
 769   return (t == T_OBJECT || t == T_ARRAY || t == T_PRIMITIVE_OBJECT || (include_narrow_oop && t == T_NARROWOOP));
 770 }
 771 
 772 inline bool is_integral_type(BasicType t) {
 773   return is_subword_type(t) || t == T_INT || t == T_LONG;
 774 }
 775 
 776 inline bool is_non_subword_integral_type(BasicType t) {
 777   return t == T_INT || t == T_LONG;
 778 }
 779 
 780 inline bool is_floating_point_type(BasicType t) {
 781   return (t == T_FLOAT || t == T_DOUBLE);
 782 }
 783 
 784 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 785 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 786 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 787 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 788 extern BasicType name2type(const char* name);
 789 

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

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

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