27 |
27 |
28 #include "utilities/compilerWarnings.hpp" |
28 #include "utilities/compilerWarnings.hpp" |
29 #include "utilities/debug.hpp" |
29 #include "utilities/debug.hpp" |
30 #include "utilities/macros.hpp" |
30 #include "utilities/macros.hpp" |
31 |
31 |
|
32 // Get constants like JVM_T_CHAR and JVM_SIGNATURE_INT, before pulling in <jvm.h>. |
|
33 #include "classfile_constants.h" |
|
34 |
32 #include COMPILER_HEADER(utilities/globalDefinitions) |
35 #include COMPILER_HEADER(utilities/globalDefinitions) |
33 |
36 |
34 // Defaults for macros that might be defined per compiler. |
37 // Defaults for macros that might be defined per compiler. |
35 #ifndef NOINLINE |
38 #ifndef NOINLINE |
36 #define NOINLINE |
39 #define NOINLINE |
568 void basic_types_init(); // cannot define here; uses assert |
571 void basic_types_init(); // cannot define here; uses assert |
569 |
572 |
570 |
573 |
571 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java |
574 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java |
572 enum BasicType { |
575 enum BasicType { |
573 T_BOOLEAN = 4, |
576 // The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS. |
574 T_CHAR = 5, |
577 T_BOOLEAN = JVM_T_BOOLEAN, |
575 T_FLOAT = 6, |
578 T_CHAR = JVM_T_CHAR, |
576 T_DOUBLE = 7, |
579 T_FLOAT = JVM_T_FLOAT, |
577 T_BYTE = 8, |
580 T_DOUBLE = JVM_T_DOUBLE, |
578 T_SHORT = 9, |
581 T_BYTE = JVM_T_BYTE, |
579 T_INT = 10, |
582 T_SHORT = JVM_T_SHORT, |
580 T_LONG = 11, |
583 T_INT = JVM_T_INT, |
|
584 T_LONG = JVM_T_LONG, |
|
585 // The remaining values are not part of any standard. |
|
586 // T_OBJECT and T_VOID denote two more semantic choices |
|
587 // for method return values. |
|
588 // T_OBJECT and T_ARRAY describe signature syntax. |
|
589 // T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe |
|
590 // internal references within the JVM as if they were Java |
|
591 // types in their own right. |
581 T_OBJECT = 12, |
592 T_OBJECT = 12, |
582 T_ARRAY = 13, |
593 T_ARRAY = 13, |
583 T_VOID = 14, |
594 T_VOID = 14, |
584 T_ADDRESS = 15, |
595 T_ADDRESS = 15, |
585 T_NARROWOOP = 16, |
596 T_NARROWOOP = 16, |
600 |
611 |
601 inline bool is_signed_subword_type(BasicType t) { |
612 inline bool is_signed_subword_type(BasicType t) { |
602 return (t == T_BYTE || t == T_SHORT); |
613 return (t == T_BYTE || t == T_SHORT); |
603 } |
614 } |
604 |
615 |
|
616 inline bool is_double_word_type(BasicType t) { |
|
617 return (t == T_DOUBLE || t == T_LONG); |
|
618 } |
|
619 |
605 inline bool is_reference_type(BasicType t) { |
620 inline bool is_reference_type(BasicType t) { |
606 return (t == T_OBJECT || t == T_ARRAY); |
621 return (t == T_OBJECT || t == T_ARRAY); |
607 } |
622 } |
608 |
623 |
609 // Convert a char from a classfile signature to a BasicType |
624 // Convert a char from a classfile signature to a BasicType |
610 inline BasicType char2type(char c) { |
625 inline BasicType char2type(char c) { |
611 switch( c ) { |
626 switch( c ) { |
612 case 'B': return T_BYTE; |
627 case JVM_SIGNATURE_BYTE: return T_BYTE; |
613 case 'C': return T_CHAR; |
628 case JVM_SIGNATURE_CHAR: return T_CHAR; |
614 case 'D': return T_DOUBLE; |
629 case JVM_SIGNATURE_DOUBLE: return T_DOUBLE; |
615 case 'F': return T_FLOAT; |
630 case JVM_SIGNATURE_FLOAT: return T_FLOAT; |
616 case 'I': return T_INT; |
631 case JVM_SIGNATURE_INT: return T_INT; |
617 case 'J': return T_LONG; |
632 case JVM_SIGNATURE_LONG: return T_LONG; |
618 case 'S': return T_SHORT; |
633 case JVM_SIGNATURE_SHORT: return T_SHORT; |
619 case 'Z': return T_BOOLEAN; |
634 case JVM_SIGNATURE_BOOLEAN: return T_BOOLEAN; |
620 case 'V': return T_VOID; |
635 case JVM_SIGNATURE_VOID: return T_VOID; |
621 case 'L': return T_OBJECT; |
636 case JVM_SIGNATURE_CLASS: return T_OBJECT; |
622 case '[': return T_ARRAY; |
637 case JVM_SIGNATURE_ARRAY: return T_ARRAY; |
623 } |
638 } |
624 return T_ILLEGAL; |
639 return T_ILLEGAL; |
625 } |
640 } |
626 |
641 |
627 extern char type2char_tab[T_CONFLICT+1]; // Map a BasicType to a jchar |
642 extern char type2char_tab[T_CONFLICT+1]; // Map a BasicType to a jchar |