< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

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









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

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

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

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

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

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

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

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

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

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






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

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

 696 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 697 enum BasicType : u1 {
 698 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
 699   T_BOOLEAN     = JVM_T_BOOLEAN,
 700   T_CHAR        = JVM_T_CHAR,
 701   T_FLOAT       = JVM_T_FLOAT,
 702   T_DOUBLE      = JVM_T_DOUBLE,
 703   T_BYTE        = JVM_T_BYTE,
 704   T_SHORT       = JVM_T_SHORT,
 705   T_INT         = JVM_T_INT,
 706   T_LONG        = JVM_T_LONG,
 707   // The remaining values are not part of any standard.
 708   // T_OBJECT and T_VOID denote two more semantic choices
 709   // for method return values.
 710   // T_OBJECT and T_ARRAY describe signature syntax.
 711   // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
 712   // internal references within the JVM as if they were Java
 713   // types in their own right.
 714   T_OBJECT      = 12,
 715   T_ARRAY       = 13,
 716   T_PRIMITIVE_OBJECT = 14, // Not a true BasicType, only use in headers of flat arrays
 717   T_VOID        = 15,
 718   T_ADDRESS     = 16,
 719   T_NARROWOOP   = 17,
 720   T_METADATA    = 18,
 721   T_NARROWKLASS = 19,
 722   T_CONFLICT    = 20, // for stack value type with conflicting contents
 723   T_ILLEGAL     = 99
 724 };
 725 
 726 #define SIGNATURE_TYPES_DO(F, N)                \
 727     F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
 728     F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
 729     F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
 730     F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
 731     F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
 732     F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
 733     F(JVM_SIGNATURE_INT,     T_INT,     N)      \
 734     F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
 735     F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
 736     F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
 737     F(JVM_SIGNATURE_PRIMITIVE_OBJECT, T_PRIMITIVE_OBJECT, 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 || t == T_PRIMITIVE_OBJECT || (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   T_PRIMITIVE_OBJECT_size = 1
 827 };
 828 
 829 // this works on valid parameter types but not T_VOID, T_CONFLICT, etc.
 830 inline int parameter_type_word_count(BasicType t) {
 831   if (is_double_word_type(t))  return 2;
 832   assert(is_java_primitive(t) || is_reference_type(t), "no goofy types here please");
 833   assert(type2size[t] == 1, "must be");
 834   return 1;
 835 }
 836 
 837 // maps a BasicType to its instance field storage type:
 838 // all sub-word integral types are widened to T_INT
 839 extern BasicType type2field[T_CONFLICT+1];
 840 extern BasicType type2wfield[T_CONFLICT+1];
 841 
 842 
 843 // size in bytes
 844 enum ArrayElementSize {
 845   T_BOOLEAN_aelem_bytes     = 1,
 846   T_CHAR_aelem_bytes        = 2,
 847   T_FLOAT_aelem_bytes       = 4,
 848   T_DOUBLE_aelem_bytes      = 8,
 849   T_BYTE_aelem_bytes        = 1,
 850   T_SHORT_aelem_bytes       = 2,
 851   T_INT_aelem_bytes         = 4,
 852   T_LONG_aelem_bytes        = 8,
 853 #ifdef _LP64
 854   T_OBJECT_aelem_bytes      = 8,
 855   T_ARRAY_aelem_bytes       = 8,
 856   T_PRIMITIVE_OBJECT_aelem_bytes = 8,
 857 #else
 858   T_OBJECT_aelem_bytes      = 4,
 859   T_ARRAY_aelem_bytes       = 4,
 860   T_PRIMITIVE_OBJECT_aelem_bytes = 4,
 861 #endif
 862   T_NARROWOOP_aelem_bytes   = 4,
 863   T_NARROWKLASS_aelem_bytes = 4,
 864   T_VOID_aelem_bytes        = 0
 865 };
 866 
 867 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 868 #ifdef ASSERT
 869 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 870 #else
 871 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 872 #endif
 873 
 874 inline bool same_type_or_subword_size(BasicType t1, BasicType t2) {
 875   return (t1 == t2) || (is_subword_type(t1) && type2aelembytes(t1) == type2aelembytes(t2));
 876 }
 877 
 878 // JavaValue serves as a container for arbitrary Java values.
 879 
 880 class JavaValue {

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

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