< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

 613 #ifdef CPU_MULTI_COPY_ATOMIC
 614 // Not needed.
 615 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
 616 #else
 617 // From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
 618 // Final decision is subject to JEP 188: Java Memory Model Update.
 619 const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
 620 #endif
 621 
 622 // The expected size in bytes of a cache line.
 623 #ifndef DEFAULT_CACHE_LINE_SIZE
 624 #error "Platform should define DEFAULT_CACHE_LINE_SIZE"
 625 #endif
 626 
 627 // The default padding size for data structures to avoid false sharing.
 628 #ifndef DEFAULT_PADDING_SIZE
 629 #error "Platform should define DEFAULT_PADDING_SIZE"
 630 #endif
 631 
 632 









 633 //----------------------------------------------------------------------------------------------------
 634 // Miscellaneous
 635 
 636 // 6302670 Eliminate Hotspot __fabsf dependency
 637 // All fabs() callers should call this function instead, which will implicitly
 638 // convert the operand to double, avoiding a dependency on __fabsf which
 639 // doesn't exist in early versions of Solaris 8.
 640 inline double fabsd(double value) {
 641   return fabs(value);
 642 }
 643 
 644 // Returns numerator/denominator as percentage value from 0 to 100. If denominator
 645 // is zero, return 0.0.
 646 template<typename T>
 647 inline double percent_of(T numerator, T denominator) {
 648   return denominator != 0 ? (double)numerator / (double)denominator * 100.0 : 0.0;
 649 }
 650 
 651 //----------------------------------------------------------------------------------------------------
 652 // Special casts

 698 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 699 enum BasicType : u1 {
 700 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 701   T_BOOLEAN     = JVM_T_BOOLEAN,
 702   T_CHAR        = JVM_T_CHAR,
 703   T_FLOAT       = JVM_T_FLOAT,
 704   T_DOUBLE      = JVM_T_DOUBLE,
 705   T_BYTE        = JVM_T_BYTE,
 706   T_SHORT       = JVM_T_SHORT,
 707   T_INT         = JVM_T_INT,
 708   T_LONG        = JVM_T_LONG,
 709   // The remaining values are not part of any standard.
 710   // T_OBJECT and T_VOID denote two more semantic choices
 711   // for method return values.
 712   // T_OBJECT and T_ARRAY describe signature syntax.
 713   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 714   // internal references within the JVM as if they were Java
 715   // types in their own right.
 716   T_OBJECT      = 12,
 717   T_ARRAY       = 13,
 718   T_VOID        = 14,
 719   T_ADDRESS     = 15,
 720   T_NARROWOOP   = 16,
 721   T_METADATA    = 17,
 722   T_NARROWKLASS = 18,
 723   T_CONFLICT    = 19, // 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_VOID,    T_VOID,    N)      \
 739     /*end*/
 740 
 741 inline bool is_java_type(BasicType t) {
 742   return T_BOOLEAN <= t && t <= T_VOID;
 743 }
 744 
 745 inline bool is_java_primitive(BasicType t) {
 746   return T_BOOLEAN <= t && t <= T_LONG;
 747 }
 748 
 749 inline bool is_subword_type(BasicType t) {
 750   // these guys are processed exactly like T_INT in calling sequences:
 751   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 752 }
 753 
 754 inline bool is_signed_subword_type(BasicType t) {
 755   return (t == T_BYTE || t == T_SHORT);
 756 }
 757 
 758 inline bool is_unsigned_subword_type(BasicType t) {
 759   return (t == T_BOOLEAN || t == T_CHAR);
 760 }
 761 
 762 inline bool is_double_word_type(BasicType t) {
 763   return (t == T_DOUBLE || t == T_LONG);
 764 }
 765 
 766 inline bool is_reference_type(BasicType t, bool include_narrow_oop = false) {
 767   return (t == T_OBJECT || t == T_ARRAY || (include_narrow_oop && t == T_NARROWOOP));
 768 }
 769 
 770 inline bool is_integral_type(BasicType t) {
 771   return is_subword_type(t) || t == T_INT || t == T_LONG;
 772 }
 773 
 774 inline bool is_non_subword_integral_type(BasicType t) {
 775   return t == T_INT || t == T_LONG;
 776 }
 777 
 778 inline bool is_floating_point_type(BasicType t) {
 779   return (t == T_FLOAT || t == T_DOUBLE);
 780 }
 781 
 782 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 783 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 784 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 785 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a char*
 786 extern BasicType name2type(const char* name);
 787 

 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 };
 827 
 828 // this works on valid parameter types but not T_VOID, T_CONFLICT, etc.
 829 inline int parameter_type_word_count(BasicType t) {
 830   if (is_double_word_type(t))  return 2;
 831   assert(is_java_primitive(t) || is_reference_type(t), "no goofy types here please");
 832   assert(type2size[t] == 1, "must be");
 833   return 1;
 834 }
 835 
 836 // maps a BasicType to its instance field storage type:
 837 // all sub-word integral types are widened to T_INT
 838 extern BasicType type2field[T_CONFLICT+1];
 839 extern BasicType type2wfield[T_CONFLICT+1];
 840 
 841 
 842 // size in bytes
 843 enum ArrayElementSize {
 844   T_BOOLEAN_aelem_bytes     = 1,
 845   T_CHAR_aelem_bytes        = 2,
 846   T_FLOAT_aelem_bytes       = 4,
 847   T_DOUBLE_aelem_bytes      = 8,
 848   T_BYTE_aelem_bytes        = 1,
 849   T_SHORT_aelem_bytes       = 2,
 850   T_INT_aelem_bytes         = 4,
 851   T_LONG_aelem_bytes        = 8,
 852 #ifdef _LP64
 853   T_OBJECT_aelem_bytes      = 8,
 854   T_ARRAY_aelem_bytes       = 8,

 855 #else
 856   T_OBJECT_aelem_bytes      = 4,
 857   T_ARRAY_aelem_bytes       = 4,

 858 #endif
 859   T_NARROWOOP_aelem_bytes   = 4,
 860   T_NARROWKLASS_aelem_bytes = 4,
 861   T_VOID_aelem_bytes        = 0
 862 };
 863 
 864 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 865 #ifdef ASSERT
 866 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 867 #else
 868 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 869 #endif
 870 
 871 inline bool same_type_or_subword_size(BasicType t1, BasicType t2) {
 872   return (t1 == t2) || (is_subword_type(t1) && type2aelembytes(t1) == type2aelembytes(t2));
 873 }
 874 
 875 // JavaValue serves as a container for arbitrary Java values.
 876 
 877 class JavaValue {

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

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






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

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

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

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

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

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