< prev index next >

src/hotspot/share/utilities/constantTag.hpp

Print this page
@@ -37,25 +37,26 @@
    // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java
    // Hotspot specific tags
    JVM_CONSTANT_Invalid                  = 0,    // For bad value initialization
    JVM_CONSTANT_InternalMin              = 100,  // First implementation tag (aside from bad value of course)
    JVM_CONSTANT_UnresolvedClass          = 100,  // Temporary tag until actual use
-   JVM_CONSTANT_ClassIndex               = 101,  // Temporary tag while constructing constant pool
-   JVM_CONSTANT_StringIndex              = 102,  // Temporary tag while constructing constant pool
+   JVM_CONSTANT_ClassIndex               = 101,  // Temporary tag while constructing constant pool, class redefinition
+   JVM_CONSTANT_StringIndex              = 102,  // Temporary tag while constructing constant pool, class redefinition
    JVM_CONSTANT_UnresolvedClassInError   = 103,  // Error tag due to resolution error
    JVM_CONSTANT_MethodHandleInError      = 104,  // Error tag due to resolution error
    JVM_CONSTANT_MethodTypeInError        = 105,  // Error tag due to resolution error
    JVM_CONSTANT_DynamicInError           = 106,  // Error tag due to resolution error
-   JVM_CONSTANT_InternalMax              = 106   // Last implementation tag
+   JVM_CONSTANT_InternalMax              = 106,  // Last implementation tag
+   // internal constant tag flags
+   JVM_CONSTANT_QDescBit                 = (1 << 7) // Separate bit, encode Q type descriptors
  };
  
- 
  class constantTag {
   private:
    jbyte _tag;
   public:
-   bool is_klass() const             { return _tag == JVM_CONSTANT_Class; }
+   bool is_klass() const             { return value() == JVM_CONSTANT_Class; }
    bool is_field () const            { return _tag == JVM_CONSTANT_Fieldref; }
    bool is_method() const            { return _tag == JVM_CONSTANT_Methodref; }
    bool is_interface_method() const  { return _tag == JVM_CONSTANT_InterfaceMethodref; }
    bool is_string() const            { return _tag == JVM_CONSTANT_String; }
    bool is_int() const               { return _tag == JVM_CONSTANT_Integer; }

@@ -66,15 +67,19 @@
    bool is_utf8() const              { return _tag == JVM_CONSTANT_Utf8; }
  
    bool is_invalid() const           { return _tag == JVM_CONSTANT_Invalid; }
  
    bool is_unresolved_klass() const {
-     return _tag == JVM_CONSTANT_UnresolvedClass || _tag == JVM_CONSTANT_UnresolvedClassInError;
+     return value() == JVM_CONSTANT_UnresolvedClass || value() == JVM_CONSTANT_UnresolvedClassInError;
    }
  
    bool is_unresolved_klass_in_error() const {
-     return _tag == JVM_CONSTANT_UnresolvedClassInError;
+     return value() == JVM_CONSTANT_UnresolvedClassInError;
+   }
+ 
+   bool is_Qdescriptor_klass() const {
+     return (_tag & JVM_CONSTANT_QDescBit) != 0;
    }
  
    bool is_method_handle_in_error() const {
      return _tag == JVM_CONSTANT_MethodHandleInError;
    }

@@ -113,13 +118,18 @@
  
    constantTag() {
      _tag = JVM_CONSTANT_Invalid;
    }
    constantTag(jbyte tag) {
-     assert((tag >= 0 && tag <= JVM_CONSTANT_NameAndType) ||
-            (tag >= JVM_CONSTANT_MethodHandle && tag <= JVM_CONSTANT_InvokeDynamic) ||
-            (tag >= JVM_CONSTANT_InternalMin && tag <= JVM_CONSTANT_InternalMax), "Invalid constant tag");
+     jbyte entry_tag = tag & ~JVM_CONSTANT_QDescBit;
+     assert((((tag & JVM_CONSTANT_QDescBit) == 0) && (entry_tag >= 0 && entry_tag <= JVM_CONSTANT_NameAndType) ||
+            (entry_tag >= JVM_CONSTANT_MethodHandle && entry_tag <= JVM_CONSTANT_InvokeDynamic) ||
+            (entry_tag >= JVM_CONSTANT_InternalMin && entry_tag <= JVM_CONSTANT_InternalMax))
+            || (((tag & JVM_CONSTANT_QDescBit) != 0) && (entry_tag == JVM_CONSTANT_Class ||
+                entry_tag == JVM_CONSTANT_UnresolvedClass || entry_tag == JVM_CONSTANT_UnresolvedClassInError
+                || entry_tag == JVM_CONSTANT_ClassIndex))
+                , "Invalid constant tag");
      _tag = tag;
    }
  
    static constantTag ofBasicType(BasicType bt) {
      if (is_subword_type(bt))  bt = T_INT;

@@ -133,11 +143,12 @@
      }
      assert(false, "bad basic type for tag");
      return constantTag();
    }
  
-   jbyte value() const                { return _tag; }
+   jbyte value() const                { return _tag & ~JVM_CONSTANT_QDescBit; }
+   jbyte tag() const                  { return _tag; }
    jbyte error_value() const;
    jbyte non_error_value() const;
  
    BasicType basic_type() const;        // if used with ldc, what kind of value gets pushed?
  
< prev index next >