< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page




 566 union jlong_accessor {
 567   jint  words[2];
 568   jlong long_value;
 569 };
 570 
 571 void basic_types_init(); // cannot define here; uses assert
 572 
 573 
 574 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 575 enum BasicType {
 576   T_BOOLEAN     =  4,
 577   T_CHAR        =  5,
 578   T_FLOAT       =  6,
 579   T_DOUBLE      =  7,
 580   T_BYTE        =  8,
 581   T_SHORT       =  9,
 582   T_INT         = 10,
 583   T_LONG        = 11,
 584   T_OBJECT      = 12,
 585   T_ARRAY       = 13,
 586   T_VALUETYPE   = 14,
 587   T_VOID        = 15,
 588   T_ADDRESS     = 16,
 589   T_NARROWOOP   = 17,
 590   T_METADATA    = 18,
 591   T_NARROWKLASS = 19,
 592   T_VALUETYPEPTR= 20, // the compiler needs a way to identify buffered values
 593   T_CONFLICT    = 21, // for stack value type with conflicting contents
 594   T_ILLEGAL     = 99
 595 };
 596 
 597 inline bool is_java_primitive(BasicType t) {
 598   return T_BOOLEAN <= t && t <= T_LONG;
 599 }
 600 
 601 inline bool is_subword_type(BasicType t) {
 602   // these guys are processed exactly like T_INT in calling sequences:
 603   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 604 }
 605 
 606 inline bool is_signed_subword_type(BasicType t) {
 607   return (t == T_BYTE || t == T_SHORT);
 608 }
 609 
 610 inline bool is_reference_type(BasicType t) {
 611   return (t == T_OBJECT || t == T_ARRAY);
 612 }
 613 
 614 // Convert a char from a classfile signature to a BasicType
 615 inline BasicType char2type(char c) {
 616   switch( c ) {
 617   case 'B': return T_BYTE;
 618   case 'C': return T_CHAR;
 619   case 'D': return T_DOUBLE;
 620   case 'F': return T_FLOAT;
 621   case 'I': return T_INT;
 622   case 'J': return T_LONG;
 623   case 'S': return T_SHORT;
 624   case 'Z': return T_BOOLEAN;
 625   case 'V': return T_VOID;
 626   case 'L': return T_OBJECT;
 627   case '[': return T_ARRAY;
 628   case 'Q': return T_VALUETYPE;
 629   }
 630   return T_ILLEGAL;
 631 }
 632 
 633 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 634 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 635 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 636 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 637 inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }
 638 extern BasicType name2type(const char* name);
 639 
 640 // Auxiliary math routines
 641 // least common multiple
 642 extern size_t lcm(size_t a, size_t b);
 643 
 644 
 645 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 646 enum BasicTypeSize {
 647   T_BOOLEAN_size     = 1,
 648   T_CHAR_size        = 1,


 663 
 664 // maps a BasicType to its instance field storage type:
 665 // all sub-word integral types are widened to T_INT
 666 extern BasicType type2field[T_CONFLICT+1];
 667 extern BasicType type2wfield[T_CONFLICT+1];
 668 
 669 
 670 // size in bytes
 671 enum ArrayElementSize {
 672   T_BOOLEAN_aelem_bytes     = 1,
 673   T_CHAR_aelem_bytes        = 2,
 674   T_FLOAT_aelem_bytes       = 4,
 675   T_DOUBLE_aelem_bytes      = 8,
 676   T_BYTE_aelem_bytes        = 1,
 677   T_SHORT_aelem_bytes       = 2,
 678   T_INT_aelem_bytes         = 4,
 679   T_LONG_aelem_bytes        = 8,
 680 #ifdef _LP64
 681   T_OBJECT_aelem_bytes      = 8,
 682   T_ARRAY_aelem_bytes       = 8,
 683   T_VALUETYPE_aelem_bytes   = 8,
 684 #else
 685   T_OBJECT_aelem_bytes      = 4,
 686   T_ARRAY_aelem_bytes       = 4,
 687   T_VALUETYPE_aelem_bytes   = 4,
 688 #endif
 689   T_NARROWOOP_aelem_bytes   = 4,
 690   T_NARROWKLASS_aelem_bytes = 4,
 691   T_VOID_aelem_bytes        = 0,
 692 #ifdef _LP64
 693   T_VALUETYPEPTR_aelem_bytes= 8
 694 #else
 695   T_VALUETYPEPTR_aelem_bytes= 4
 696 #endif
 697 };
 698 
 699 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 700 #ifdef ASSERT
 701 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 702 #else
 703 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 704 #endif
 705 
 706 
 707 // JavaValue serves as a container for arbitrary Java values.


 769 
 770 // TosState describes the top-of-stack state before and after the execution of
 771 // a bytecode or method. The top-of-stack value may be cached in one or more CPU
 772 // registers. The TosState corresponds to the 'machine representation' of this cached
 773 // value. There's 4 states corresponding to the JAVA types int, long, float & double
 774 // as well as a 5th state in case the top-of-stack value is actually on the top
 775 // of stack (in memory) and thus not cached. The atos state corresponds to the itos
 776 // state when it comes to machine representation but is used separately for (oop)
 777 // type specific operations (e.g. verification code).
 778 
 779 enum TosState {         // describes the tos cache contents
 780   btos = 0,             // byte, bool tos cached
 781   ztos = 1,             // byte, bool tos cached
 782   ctos = 2,             // char tos cached
 783   stos = 3,             // short tos cached
 784   itos = 4,             // int tos cached
 785   ltos = 5,             // long tos cached
 786   ftos = 6,             // float tos cached
 787   dtos = 7,             // double tos cached
 788   atos = 8,             // object cached
 789   qtos = 9,             // value type cached
 790   vtos = 10,            // tos not cached,
 791   number_of_states,
 792   ptos = 12,            // polymorphic tos cache (atos or qtos)
 793   ilgl                  // illegal state: should not occur
 794 };
 795 
 796 
 797 inline TosState as_TosState(BasicType type) {
 798   switch (type) {
 799     case T_BYTE   : return btos;
 800     case T_BOOLEAN: return ztos;
 801     case T_CHAR   : return ctos;
 802     case T_SHORT  : return stos;
 803     case T_INT    : return itos;
 804     case T_LONG   : return ltos;
 805     case T_FLOAT  : return ftos;
 806     case T_DOUBLE : return dtos;
 807     case T_VALUETYPE : return qtos;
 808     case T_VOID   : return vtos;

 809     case T_ARRAY  : // fall through
 810     case T_OBJECT : return atos;
 811     default       : return ilgl;
 812   }
 813 }
 814 
 815 inline BasicType as_BasicType(TosState state) {
 816   switch (state) {
 817     case btos : return T_BYTE;
 818     case ztos : return T_BOOLEAN;
 819     case ctos : return T_CHAR;
 820     case stos : return T_SHORT;
 821     case itos : return T_INT;
 822     case ltos : return T_LONG;
 823     case ftos : return T_FLOAT;
 824     case dtos : return T_DOUBLE;
 825     case atos : return T_OBJECT;
 826     case qtos : return T_VALUETYPE;
 827     case vtos : return T_VOID;
 828     default   : return T_ILLEGAL;
 829   }
 830 }
 831 
 832 
 833 // Helper function to convert BasicType info into TosState
 834 // Note: Cannot define here as it uses global constant at the time being.
 835 TosState as_TosState(BasicType type);
 836 
 837 
 838 // JavaThreadState keeps track of which part of the code a thread is executing in. This
 839 // information is needed by the safepoint code.
 840 //
 841 // There are 4 essential states:
 842 //
 843 //  _thread_new         : Just started, but not executed init. code yet (most likely still in OS init code)
 844 //  _thread_in_native   : In native code. This is a safepoint region, since all oops will be in jobject handles
 845 //  _thread_in_vm       : Executing in the vm
 846 //  _thread_in_Java     : Executing either interpreted or compiled Java code (or could be in a stub)




 566 union jlong_accessor {
 567   jint  words[2];
 568   jlong long_value;
 569 };
 570 
 571 void basic_types_init(); // cannot define here; uses assert
 572 
 573 
 574 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 575 enum BasicType {
 576   T_BOOLEAN     =  4,
 577   T_CHAR        =  5,
 578   T_FLOAT       =  6,
 579   T_DOUBLE      =  7,
 580   T_BYTE        =  8,
 581   T_SHORT       =  9,
 582   T_INT         = 10,
 583   T_LONG        = 11,
 584   T_OBJECT      = 12,
 585   T_ARRAY       = 13,
 586   T_VOID        = 14,
 587   T_ADDRESS     = 15,
 588   T_NARROWOOP   = 16,
 589   T_METADATA    = 17,
 590   T_NARROWKLASS = 18,
 591   T_VALUETYPEPTR= 19, // the compiler needs a way to identify buffered values
 592   T_CONFLICT    = 20, // for stack value type with conflicting contents
 593   T_ILLEGAL     = 99,
 594   T_VALUETYPE   = 100  // temporary hack for the transition for VVT to LWVT
 595 };
 596 
 597 inline bool is_java_primitive(BasicType t) {
 598   return T_BOOLEAN <= t && t <= T_LONG;
 599 }
 600 
 601 inline bool is_subword_type(BasicType t) {
 602   // these guys are processed exactly like T_INT in calling sequences:
 603   return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT);
 604 }
 605 
 606 inline bool is_signed_subword_type(BasicType t) {
 607   return (t == T_BYTE || t == T_SHORT);
 608 }
 609 
 610 inline bool is_reference_type(BasicType t) {
 611   return (t == T_OBJECT || t == T_ARRAY);
 612 }
 613 
 614 // Convert a char from a classfile signature to a BasicType
 615 inline BasicType char2type(char c) {
 616   switch( c ) {
 617   case 'B': return T_BYTE;
 618   case 'C': return T_CHAR;
 619   case 'D': return T_DOUBLE;
 620   case 'F': return T_FLOAT;
 621   case 'I': return T_INT;
 622   case 'J': return T_LONG;
 623   case 'S': return T_SHORT;
 624   case 'Z': return T_BOOLEAN;
 625   case 'V': return T_VOID;
 626   case 'L': return T_OBJECT;
 627   case '[': return T_ARRAY;

 628   }
 629   return T_ILLEGAL;
 630 }
 631 
 632 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 633 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 634 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 635 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 636 inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }
 637 extern BasicType name2type(const char* name);
 638 
 639 // Auxiliary math routines
 640 // least common multiple
 641 extern size_t lcm(size_t a, size_t b);
 642 
 643 
 644 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
 645 enum BasicTypeSize {
 646   T_BOOLEAN_size     = 1,
 647   T_CHAR_size        = 1,


 662 
 663 // maps a BasicType to its instance field storage type:
 664 // all sub-word integral types are widened to T_INT
 665 extern BasicType type2field[T_CONFLICT+1];
 666 extern BasicType type2wfield[T_CONFLICT+1];
 667 
 668 
 669 // size in bytes
 670 enum ArrayElementSize {
 671   T_BOOLEAN_aelem_bytes     = 1,
 672   T_CHAR_aelem_bytes        = 2,
 673   T_FLOAT_aelem_bytes       = 4,
 674   T_DOUBLE_aelem_bytes      = 8,
 675   T_BYTE_aelem_bytes        = 1,
 676   T_SHORT_aelem_bytes       = 2,
 677   T_INT_aelem_bytes         = 4,
 678   T_LONG_aelem_bytes        = 8,
 679 #ifdef _LP64
 680   T_OBJECT_aelem_bytes      = 8,
 681   T_ARRAY_aelem_bytes       = 8,

 682 #else
 683   T_OBJECT_aelem_bytes      = 4,
 684   T_ARRAY_aelem_bytes       = 4,

 685 #endif
 686   T_NARROWOOP_aelem_bytes   = 4,
 687   T_NARROWKLASS_aelem_bytes = 4,
 688   T_VOID_aelem_bytes        = 0,
 689 #ifdef _LP64
 690   T_VALUETYPEPTR_aelem_bytes= 8
 691 #else
 692   T_VALUETYPEPTR_aelem_bytes= 4
 693 #endif
 694 };
 695 
 696 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
 697 #ifdef ASSERT
 698 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
 699 #else
 700 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
 701 #endif
 702 
 703 
 704 // JavaValue serves as a container for arbitrary Java values.


 766 
 767 // TosState describes the top-of-stack state before and after the execution of
 768 // a bytecode or method. The top-of-stack value may be cached in one or more CPU
 769 // registers. The TosState corresponds to the 'machine representation' of this cached
 770 // value. There's 4 states corresponding to the JAVA types int, long, float & double
 771 // as well as a 5th state in case the top-of-stack value is actually on the top
 772 // of stack (in memory) and thus not cached. The atos state corresponds to the itos
 773 // state when it comes to machine representation but is used separately for (oop)
 774 // type specific operations (e.g. verification code).
 775 
 776 enum TosState {         // describes the tos cache contents
 777   btos = 0,             // byte, bool tos cached
 778   ztos = 1,             // byte, bool tos cached
 779   ctos = 2,             // char tos cached
 780   stos = 3,             // short tos cached
 781   itos = 4,             // int tos cached
 782   ltos = 5,             // long tos cached
 783   ftos = 6,             // float tos cached
 784   dtos = 7,             // double tos cached
 785   atos = 8,             // object cached
 786   vtos = 9,             // tos not cached,

 787   number_of_states,

 788   ilgl                  // illegal state: should not occur
 789 };
 790 
 791 
 792 inline TosState as_TosState(BasicType type) {
 793   switch (type) {
 794     case T_BYTE   : return btos;
 795     case T_BOOLEAN: return ztos;
 796     case T_CHAR   : return ctos;
 797     case T_SHORT  : return stos;
 798     case T_INT    : return itos;
 799     case T_LONG   : return ltos;
 800     case T_FLOAT  : return ftos;
 801     case T_DOUBLE : return dtos;

 802     case T_VOID   : return vtos;
 803     case T_VALUETYPE: // fall through
 804     case T_ARRAY  :   // fall through
 805     case T_OBJECT : return atos;
 806     default       : return ilgl;
 807   }
 808 }
 809 
 810 inline BasicType as_BasicType(TosState state) {
 811   switch (state) {
 812     case btos : return T_BYTE;
 813     case ztos : return T_BOOLEAN;
 814     case ctos : return T_CHAR;
 815     case stos : return T_SHORT;
 816     case itos : return T_INT;
 817     case ltos : return T_LONG;
 818     case ftos : return T_FLOAT;
 819     case dtos : return T_DOUBLE;
 820     case atos : return T_OBJECT;

 821     case vtos : return T_VOID;
 822     default   : return T_ILLEGAL;
 823   }
 824 }
 825 
 826 
 827 // Helper function to convert BasicType info into TosState
 828 // Note: Cannot define here as it uses global constant at the time being.
 829 TosState as_TosState(BasicType type);
 830 
 831 
 832 // JavaThreadState keeps track of which part of the code a thread is executing in. This
 833 // information is needed by the safepoint code.
 834 //
 835 // There are 4 essential states:
 836 //
 837 //  _thread_new         : Just started, but not executed init. code yet (most likely still in OS init code)
 838 //  _thread_in_native   : In native code. This is a safepoint region, since all oops will be in jobject handles
 839 //  _thread_in_vm       : Executing in the vm
 840 //  _thread_in_Java     : Executing either interpreted or compiled Java code (or could be in a stub)


< prev index next >