< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

 632 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 633 #else
 634 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 635 // Final decision is subject to JEP 188: Java Memory Model Update.
 636 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 637 #endif
 638 
 639 // The expected size in bytes of a cache line, used to pad data structures.
 640 #ifndef DEFAULT_CACHE_LINE_SIZE
 641   #define DEFAULT_CACHE_LINE_SIZE 64
 642 #endif
 643 
 644 
 645 //----------------------------------------------------------------------------------------------------
 646 // Utility macros for compilers
 647 // used to silence compiler warnings
 648 
 649 #define Unused_Variable(var) var
 650 
 651 









 652 //----------------------------------------------------------------------------------------------------
 653 // Miscellaneous
 654 
 655 // 6302670 Eliminate Hotspot __fabsf dependency
 656 // All fabs() callers should call this function instead, which will implicitly
 657 // convert the operand to double, avoiding a dependency on __fabsf which
 658 // doesn't exist in early versions of Solaris 8.
 659 inline double fabsd(double value) {
 660   return fabs(value);
 661 }
 662 
 663 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 664 // is zero, return 0.0.
 665 template<typename T>
 666 inline double percent_of(T numerator, T denominator) {
 667   return denominator != 0 ? (double)numerator / denominator * 100.0 : 0.0;
 668 }
 669 
 670 //----------------------------------------------------------------------------------------------------
 671 // Special casts

 717 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 718 enum BasicType {
 719 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 720   T_BOOLEAN     = JVM_T_BOOLEAN,
 721   T_CHAR        = JVM_T_CHAR,
 722   T_FLOAT       = JVM_T_FLOAT,
 723   T_DOUBLE      = JVM_T_DOUBLE,
 724   T_BYTE        = JVM_T_BYTE,
 725   T_SHORT       = JVM_T_SHORT,
 726   T_INT         = JVM_T_INT,
 727   T_LONG        = JVM_T_LONG,
 728   // The remaining values are not part of any standard.
 729   // T_OBJECT and T_VOID denote two more semantic choices
 730   // for method return values.
 731   // T_OBJECT and T_ARRAY describe signature syntax.
 732   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 733   // internal references within the JVM as if they were Java
 734   // types in their own right.
 735   T_OBJECT      = 12,
 736   T_ARRAY       = 13,
 737   T_VOID        = 14,
 738   T_ADDRESS     = 15,
 739   T_NARROWOOP   = 16,
 740   T_METADATA    = 17,
 741   T_NARROWKLASS = 18,
 742   T_CONFLICT    = 19, // for stack value type with conflicting contents

 743   T_ILLEGAL     = 99
 744 };
 745 
 746 #define SIGNATURE_TYPES_DO(F, N)                \
 747     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 748     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 749     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 750     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 751     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 752     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 753     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 754     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 755     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 756     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \

 757     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 758     /*end*/
 759 
 760 inline bool is_java_type(BasicType t) {
 761   return T_BOOLEAN <= t && t <= T_VOID;
 762 }
 763 
 764 inline bool is_java_primitive(BasicType t) {
 765   return T_BOOLEAN <= t && t <= T_LONG;
 766 }
 767 
 768 inline bool is_subword_type(BasicType t) {
 769   // these guys are processed exactly like T_INT in calling sequences:
 770   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 771 }
 772 
 773 inline bool is_signed_subword_type(BasicType t) {
 774   return (t == T_BYTE || t == T_SHORT);
 775 }
 776 
 777 inline bool is_unsigned_subword_type(BasicType t) {
 778   return (t == T_BOOLEAN || t == T_CHAR);
 779 }
 780 
 781 inline bool is_double_word_type(BasicType t) {
 782   return (t == T_DOUBLE || t == T_LONG);
 783 }
 784 
 785 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {
 786   return (t == T_OBJECT || t == T_ARRAY || (include_narrow_oop && t == T_NARROWOOP));
 787 }
 788 
 789 inline bool is_integral_type(BasicType t) {
 790   return is_subword_type(t) || t == T_INT || t == T_LONG;
 791 }
 792 
 793 inline bool is_non_subword_integral_type(BasicType t) {
 794   return t == T_INT || t == T_LONG;
 795 }
 796 
 797 inline bool is_floating_point_type(BasicType t) {
 798   return (t == T_FLOAT || t == T_DOUBLE);
 799 }
 800 
 801 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 802 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 803 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 804 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 805 extern BasicType name2type(const char* name);
 806 

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

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

 874 #else
 875   T_OBJECT_aelem_bytes      = 4,
 876   T_ARRAY_aelem_bytes       = 4,

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

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

 987     case T_OBJECT : return atos;
 988     default       : return ilgl;
 989   }
 990 }
 991 
 992 inline BasicType as_BasicType(TosState state) {
 993   switch (state) {
 994     case btos : return T_BYTE;
 995     case ztos : return T_BOOLEAN;
 996     case ctos : return T_CHAR;
 997     case stos : return T_SHORT;
 998     case itos : return T_INT;
 999     case ltos : return T_LONG;
1000     case ftos : return T_FLOAT;
1001     case dtos : return T_DOUBLE;
1002     case atos : return T_OBJECT;
1003     case vtos : return T_VOID;
1004     default   : return T_ILLEGAL;
1005   }
1006 }

1336 
1337 //----------------------------------------------------------------------------------------------------
1338 // String type aliases used by command line flag declarations and
1339 // processing utilities.
1340 
1341 typedef const char* ccstr;
1342 typedef const char* ccstrlist;   // represents string arguments which accumulate
1343 
1344 //----------------------------------------------------------------------------------------------------
1345 // Default hash/equals functions used by ResourceHashtable
1346 
1347 template<typename K> unsigned primitive_hash(const K& k) {
1348   unsigned hash = (unsigned)((uintptr_t)k);
1349   return hash ^ (hash >> 3); // just in case we're dealing with aligned ptrs
1350 }
1351 
1352 template<typename K> bool primitive_equals(const K& k0, const K& k1) {
1353   return k0 == k1;
1354 }
1355 






1356 //----------------------------------------------------------------------------------------------------
1357 
1358 // Allow use of C++ thread_local when approved - see JDK-8282469.
1359 #define APPROVED_CPP_THREAD_LOCAL thread_local
1360 
1361 // Converts any type T to a reference type.
1362 template<typename T>
1363 std::add_rvalue_reference_t<T> declval() noexcept;
1364 
1365 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_HPP

 632 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 633 #else
 634 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 635 // Final decision is subject to JEP 188: Java Memory Model Update.
 636 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 637 #endif
 638 
 639 // The expected size in bytes of a cache line, used to pad data structures.
 640 #ifndef DEFAULT_CACHE_LINE_SIZE
 641   #define DEFAULT_CACHE_LINE_SIZE 64
 642 #endif
 643 
 644 
 645 //----------------------------------------------------------------------------------------------------
 646 // Utility macros for compilers
 647 // used to silence compiler warnings
 648 
 649 #define Unused_Variable(var) var
 650 
 651 
 652 //----------------------------------------------------------------------------------------------------
 653 // Prototyping
 654 // "Code Missing Here" macro, un-define when integrating back from prototyping stage and break
 655 // compilation on purpose (i.e. "forget me not")
 656 #define PROTOTYPE
 657 #ifdef PROTOTYPE
 658 #define CMH(m)
 659 #endif
 660 
 661 //----------------------------------------------------------------------------------------------------
 662 // Miscellaneous
 663 
 664 // 6302670 Eliminate Hotspot __fabsf dependency
 665 // All fabs() callers should call this function instead, which will implicitly
 666 // convert the operand to double, avoiding a dependency on __fabsf which
 667 // doesn't exist in early versions of Solaris 8.
 668 inline double fabsd(double value) {
 669   return fabs(value);
 670 }
 671 
 672 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 673 // is zero, return 0.0.
 674 template<typename T>
 675 inline double percent_of(T numerator, T denominator) {
 676   return denominator != 0 ? (double)numerator / denominator * 100.0 : 0.0;
 677 }
 678 
 679 //----------------------------------------------------------------------------------------------------
 680 // Special casts

 726 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 727 enum BasicType {
 728 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 729   T_BOOLEAN     = JVM_T_BOOLEAN,
 730   T_CHAR        = JVM_T_CHAR,
 731   T_FLOAT       = JVM_T_FLOAT,
 732   T_DOUBLE      = JVM_T_DOUBLE,
 733   T_BYTE        = JVM_T_BYTE,
 734   T_SHORT       = JVM_T_SHORT,
 735   T_INT         = JVM_T_INT,
 736   T_LONG        = JVM_T_LONG,
 737   // The remaining values are not part of any standard.
 738   // T_OBJECT and T_VOID denote two more semantic choices
 739   // for method return values.
 740   // T_OBJECT and T_ARRAY describe signature syntax.
 741   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 742   // internal references within the JVM as if they were Java
 743   // types in their own right.
 744   T_OBJECT      = 12,
 745   T_ARRAY       = 13,
 746   T_PRIMITIVE_OBJECT = 14,
 747   T_VOID        = 15,
 748   T_ADDRESS     = 16,
 749   T_NARROWOOP   = 17,
 750   T_METADATA    = 18,
 751   T_NARROWKLASS = 19,
 752   T_CONFLICT    = 20, // for stack value type with conflicting contents
 753   T_ILLEGAL     = 99
 754 };
 755 
 756 #define SIGNATURE_TYPES_DO(F, N)                \
 757     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 758     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 759     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 760     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 761     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 762     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 763     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 764     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 765     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 766     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
 767     F(JVM_SIGNATURE_PRIMITIVE_OBJECT, T_PRIMITIVE_OBJECT, N) \
 768     F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
 769     /*end*/
 770 
 771 inline bool is_java_type(BasicType t) {
 772   return T_BOOLEAN <= t && t <= T_VOID;
 773 }
 774 
 775 inline bool is_java_primitive(BasicType t) {
 776   return T_BOOLEAN <= t && t <= T_LONG;
 777 }
 778 
 779 inline bool is_subword_type(BasicType t) {
 780   // these guys are processed exactly like T_INT in calling sequences:
 781   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 782 }
 783 
 784 inline bool is_signed_subword_type(BasicType t) {
 785   return (t == T_BYTE || t == T_SHORT);
 786 }
 787 
 788 inline bool is_unsigned_subword_type(BasicType t) {
 789   return (t == T_BOOLEAN || t == T_CHAR);
 790 }
 791 
 792 inline bool is_double_word_type(BasicType t) {
 793   return (t == T_DOUBLE || t == T_LONG);
 794 }
 795 
 796 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {
 797   return (t == T_OBJECT || t == T_ARRAY || t == T_PRIMITIVE_OBJECT || (include_narrow_oop && t == T_NARROWOOP));
 798 }
 799 
 800 inline bool is_integral_type(BasicType t) {
 801   return is_subword_type(t) || t == T_INT || t == T_LONG;
 802 }
 803 
 804 inline bool is_non_subword_integral_type(BasicType t) {
 805   return t == T_INT || t == T_LONG;
 806 }
 807 
 808 inline bool is_floating_point_type(BasicType t) {
 809   return (t == T_FLOAT || t == T_DOUBLE);
 810 }
 811 
 812 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 813 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 814 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 815 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 816 extern BasicType name2type(const char* name);
 817 

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

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

1351 
1352 //----------------------------------------------------------------------------------------------------
1353 // String type aliases used by command line flag declarations and
1354 // processing utilities.
1355 
1356 typedef const char* ccstr;
1357 typedef const char* ccstrlist;   // represents string arguments which accumulate
1358 
1359 //----------------------------------------------------------------------------------------------------
1360 // Default hash/equals functions used by ResourceHashtable
1361 
1362 template<typename K> unsigned primitive_hash(const K& k) {
1363   unsigned hash = (unsigned)((uintptr_t)k);
1364   return hash ^ (hash >> 3); // just in case we're dealing with aligned ptrs
1365 }
1366 
1367 template<typename K> bool primitive_equals(const K& k0, const K& k1) {
1368   return k0 == k1;
1369 }
1370 
1371 // TEMP!!!!
1372 // This should be removed after LW2 arrays are implemented (JDK-8220790).
1373 // It's an alias to (EnableValhalla && (FlatArrayElementMaxSize != 0)),
1374 // which is actually not 100% correct, but works for the current set of C1/C2
1375 // implementation and test cases.
1376 #define UseFlatArray (EnablePrimitiveClasses && (FlatArrayElementMaxSize != 0))
1377 //----------------------------------------------------------------------------------------------------
1378 
1379 // Allow use of C++ thread_local when approved - see JDK-8282469.
1380 #define APPROVED_CPP_THREAD_LOCAL thread_local
1381 
1382 // Converts any type T to a reference type.
1383 template<typename T>
1384 std::add_rvalue_reference_t<T> declval() noexcept;
1385 
1386 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_HPP
< prev index next >