< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

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









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

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

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

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

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

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

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

 840 #else
 841   T_OBJECT_aelem_bytes      = 4,
 842   T_ARRAY_aelem_bytes       = 4,

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

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

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






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

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

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

 802 
 803 // Auxiliary math routines
 804 // least common multiple
 805 extern size_t lcm(size_t a, size_t b);
 806 
 807 
 808 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 809 enum BasicTypeSize {
 810   T_BOOLEAN_size     = 1,
 811   T_CHAR_size        = 1,
 812   T_FLOAT_size       = 1,
 813   T_DOUBLE_size      = 2,
 814   T_BYTE_size        = 1,
 815   T_SHORT_size       = 1,
 816   T_INT_size         = 1,
 817   T_LONG_size        = 2,
 818   T_OBJECT_size      = 1,
 819   T_ARRAY_size       = 1,
 820   T_NARROWOOP_size   = 1,
 821   T_NARROWKLASS_size = 1,
 822   T_VOID_size        = 0,
 823   T_PRIMITIVE_OBJECT_size = 1
 824 };
 825 
 826 // this works on valid parameter types but not T_VOID, T_CONFLICT, etc.
 827 inline int parameter_type_word_count(BasicType t) {
 828   if (is_double_word_type(t))  return 2;
 829   assert(is_java_primitive(t) || is_reference_type(t), "no goofy types here please");
 830   assert(type2size[t] == 1, "must be");
 831   return 1;
 832 }
 833 
 834 // maps a BasicType to its instance field storage type:
 835 // all sub-word integral types are widened to T_INT
 836 extern BasicType type2field[T_CONFLICT+1];
 837 extern BasicType type2wfield[T_CONFLICT+1];
 838 
 839 
 840 // size in bytes
 841 enum ArrayElementSize {
 842   T_BOOLEAN_aelem_bytes     = 1,
 843   T_CHAR_aelem_bytes        = 2,
 844   T_FLOAT_aelem_bytes       = 4,
 845   T_DOUBLE_aelem_bytes      = 8,
 846   T_BYTE_aelem_bytes        = 1,
 847   T_SHORT_aelem_bytes       = 2,
 848   T_INT_aelem_bytes         = 4,
 849   T_LONG_aelem_bytes        = 8,
 850 #ifdef _LP64
 851   T_OBJECT_aelem_bytes      = 8,
 852   T_ARRAY_aelem_bytes       = 8,
 853   T_PRIMITIVE_OBJECT_aelem_bytes = 8,
 854 #else
 855   T_OBJECT_aelem_bytes      = 4,
 856   T_ARRAY_aelem_bytes       = 4,
 857   T_PRIMITIVE_OBJECT_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 }

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