604 }
605
606 inline bool is_signed_subword_type(BasicType t) {
607 return (t == T_BYTE || t == T_SHORT);
608 }
609
610 // Convert a char from a classfile signature to a BasicType
611 inline BasicType char2type(char c) {
612 switch( c ) {
613 case 'B': return T_BYTE;
614 case 'C': return T_CHAR;
615 case 'D': return T_DOUBLE;
616 case 'F': return T_FLOAT;
617 case 'I': return T_INT;
618 case 'J': return T_LONG;
619 case 'S': return T_SHORT;
620 case 'Z': return T_BOOLEAN;
621 case 'V': return T_VOID;
622 case 'L': return T_OBJECT;
623 case '[': return T_ARRAY;
624 case 'Q':return T_VALUETYPE;
625 }
626 return T_ILLEGAL;
627 }
628
629 extern char type2char_tab[T_CONFLICT+1]; // Map a BasicType to a jchar
630 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
631 extern int type2size[T_CONFLICT+1]; // Map BasicType to result stack elements
632 extern const char* type2name_tab[T_CONFLICT+1]; // Map a BasicType to a jchar
633 inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }
634 extern BasicType name2type(const char* name);
635
636 // Auxiliary math routines
637 // least common multiple
638 extern size_t lcm(size_t a, size_t b);
639
640
641 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
642 enum BasicTypeSize {
643 T_BOOLEAN_size = 1,
644 T_CHAR_size = 1,
669 T_CHAR_aelem_bytes = 2,
670 T_FLOAT_aelem_bytes = 4,
671 T_DOUBLE_aelem_bytes = 8,
672 T_BYTE_aelem_bytes = 1,
673 T_SHORT_aelem_bytes = 2,
674 T_INT_aelem_bytes = 4,
675 T_LONG_aelem_bytes = 8,
676 #ifdef _LP64
677 T_OBJECT_aelem_bytes = 8,
678 T_ARRAY_aelem_bytes = 8,
679 T_VALUETYPE_aelem_bytes = 8,
680 #else
681 T_OBJECT_aelem_bytes = 4,
682 T_ARRAY_aelem_bytes = 4,
683 T_VALUETYPE_aelem_bytes = 4,
684 #endif
685 T_NARROWOOP_aelem_bytes = 4,
686 T_NARROWKLASS_aelem_bytes = 4,
687 T_VOID_aelem_bytes = 0,
688 #ifdef _LP64
689 T_VALUETYPEPTR_aelem_bytes= 4
690 #else
691 T_VALUETYPEPTR_aelem_bytes= 8
692 #endif
693 };
694
695 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
696 #ifdef ASSERT
697 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
698 #else
699 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
700 #endif
701
702
703 // JavaValue serves as a container for arbitrary Java values.
704
705 class JavaValue {
706
707 public:
708 typedef union JavaCallValue {
709 jfloat f;
710 jdouble d;
711 jint i;
|
604 }
605
606 inline bool is_signed_subword_type(BasicType t) {
607 return (t == T_BYTE || t == T_SHORT);
608 }
609
610 // Convert a char from a classfile signature to a BasicType
611 inline BasicType char2type(char c) {
612 switch( c ) {
613 case 'B': return T_BYTE;
614 case 'C': return T_CHAR;
615 case 'D': return T_DOUBLE;
616 case 'F': return T_FLOAT;
617 case 'I': return T_INT;
618 case 'J': return T_LONG;
619 case 'S': return T_SHORT;
620 case 'Z': return T_BOOLEAN;
621 case 'V': return T_VOID;
622 case 'L': return T_OBJECT;
623 case '[': return T_ARRAY;
624 case 'Q': return T_VALUETYPE;
625 }
626 return T_ILLEGAL;
627 }
628
629 extern char type2char_tab[T_CONFLICT+1]; // Map a BasicType to a jchar
630 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
631 extern int type2size[T_CONFLICT+1]; // Map BasicType to result stack elements
632 extern const char* type2name_tab[T_CONFLICT+1]; // Map a BasicType to a jchar
633 inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }
634 extern BasicType name2type(const char* name);
635
636 // Auxiliary math routines
637 // least common multiple
638 extern size_t lcm(size_t a, size_t b);
639
640
641 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
642 enum BasicTypeSize {
643 T_BOOLEAN_size = 1,
644 T_CHAR_size = 1,
669 T_CHAR_aelem_bytes = 2,
670 T_FLOAT_aelem_bytes = 4,
671 T_DOUBLE_aelem_bytes = 8,
672 T_BYTE_aelem_bytes = 1,
673 T_SHORT_aelem_bytes = 2,
674 T_INT_aelem_bytes = 4,
675 T_LONG_aelem_bytes = 8,
676 #ifdef _LP64
677 T_OBJECT_aelem_bytes = 8,
678 T_ARRAY_aelem_bytes = 8,
679 T_VALUETYPE_aelem_bytes = 8,
680 #else
681 T_OBJECT_aelem_bytes = 4,
682 T_ARRAY_aelem_bytes = 4,
683 T_VALUETYPE_aelem_bytes = 4,
684 #endif
685 T_NARROWOOP_aelem_bytes = 4,
686 T_NARROWKLASS_aelem_bytes = 4,
687 T_VOID_aelem_bytes = 0,
688 #ifdef _LP64
689 T_VALUETYPEPTR_aelem_bytes= 8
690 #else
691 T_VALUETYPEPTR_aelem_bytes= 4
692 #endif
693 };
694
695 extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
696 #ifdef ASSERT
697 extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts
698 #else
699 inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; }
700 #endif
701
702
703 // JavaValue serves as a container for arbitrary Java values.
704
705 class JavaValue {
706
707 public:
708 typedef union JavaCallValue {
709 jfloat f;
710 jdouble d;
711 jint i;
|