< prev index next >

src/hotspot/share/utilities/globalDefinitions.hpp

Print this page

        

@@ -623,10 +623,28 @@
   T_NARROWKLASS = 18,
   T_CONFLICT    = 19, // for stack value type with conflicting contents
   T_ILLEGAL     = 99
 };
 
+#define SIGNATURE_TYPES_DO(F, N)                \
+    F(JVM_SIGNATURE_BOOLEAN, T_BOOLEAN, N)      \
+    F(JVM_SIGNATURE_CHAR,    T_CHAR,    N)      \
+    F(JVM_SIGNATURE_FLOAT,   T_FLOAT,   N)      \
+    F(JVM_SIGNATURE_DOUBLE,  T_DOUBLE,  N)      \
+    F(JVM_SIGNATURE_BYTE,    T_BYTE,    N)      \
+    F(JVM_SIGNATURE_SHORT,   T_SHORT,   N)      \
+    F(JVM_SIGNATURE_INT,     T_INT,     N)      \
+    F(JVM_SIGNATURE_LONG,    T_LONG,    N)      \
+    F(JVM_SIGNATURE_CLASS,   T_OBJECT,  N)      \
+    F(JVM_SIGNATURE_ARRAY,   T_ARRAY,   N)      \
+    F(JVM_SIGNATURE_VOID,    T_VOID,    N)      \
+    /*end*/
+
+inline bool is_java_type(BasicType t) {
+  return T_BOOLEAN <= t && t <= T_VOID;
+}
+
 inline bool is_java_primitive(BasicType t) {
   return T_BOOLEAN <= t && t <= T_LONG;
 }
 
 inline bool is_subword_type(BasicType t) {

@@ -644,28 +662,10 @@
 
 inline bool is_reference_type(BasicType t) {
   return (t == T_OBJECT || t == T_ARRAY);
 }
 
-// Convert a char from a classfile signature to a BasicType
-inline BasicType char2type(char c) {
-  switch( c ) {
-  case JVM_SIGNATURE_BYTE:    return T_BYTE;
-  case JVM_SIGNATURE_CHAR:    return T_CHAR;
-  case JVM_SIGNATURE_DOUBLE:  return T_DOUBLE;
-  case JVM_SIGNATURE_FLOAT:   return T_FLOAT;
-  case JVM_SIGNATURE_INT:     return T_INT;
-  case JVM_SIGNATURE_LONG:    return T_LONG;
-  case JVM_SIGNATURE_SHORT:   return T_SHORT;
-  case JVM_SIGNATURE_BOOLEAN: return T_BOOLEAN;
-  case JVM_SIGNATURE_VOID:    return T_VOID;
-  case JVM_SIGNATURE_CLASS:   return T_OBJECT;
-  case JVM_SIGNATURE_ARRAY:   return T_ARRAY;
-  }
-  return T_ILLEGAL;
-}
-
 extern char type2char_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; }
 extern int type2size[T_CONFLICT+1];         // Map BasicType to result stack elements
 extern const char* type2name_tab[T_CONFLICT+1];     // Map a BasicType to a jchar
 inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }

@@ -691,10 +691,17 @@
   T_NARROWOOP_size   = 1,
   T_NARROWKLASS_size = 1,
   T_VOID_size        = 0
 };
 
+// this works on valid parameter types but not T_VOID, T_CONFLICT, etc.
+inline int parameter_type_word_count(BasicType t) {
+  if (is_double_word_type(t))  return 2;
+  assert(is_java_primitive(t) || is_reference_type(t), "no goofy types here please");
+  assert(type2size[t] == 1, "must be");
+  return 1;
+}
 
 // maps a BasicType to its instance field storage type:
 // all sub-word integral types are widened to T_INT
 extern BasicType type2field[T_CONFLICT+1];
 extern BasicType type2wfield[T_CONFLICT+1];
< prev index next >