< prev index next >

src/hotspot/share/classfile/verifier.hpp

Print this page

        

@@ -37,11 +37,11 @@
  public:
   enum {
     STACKMAP_ATTRIBUTE_MAJOR_VERSION    = 50,
     INVOKEDYNAMIC_MAJOR_VERSION         = 51,
     NO_RELAX_ACCESS_CTRL_CHECK_VERSION  = 52,
-    DYNAMICCONSTANT_MAJOR_VERSION       = 55
+    DYNAMICCONSTANT_MAJOR_VERSION       = 55,
   };
 
   // Verify the bytecodes for a class.
   static bool verify(InstanceKlass* klass, bool should_verify_class, TRAPS);
 

@@ -151,10 +151,11 @@
     STACK_SIZE_MISMATCH,  // Frames have different stack sizes
     STACK_OVERFLOW,       // Attempt to push onto a full expression stack
     STACK_UNDERFLOW,      // Attempt to pop and empty expression stack
     MISSING_STACKMAP,     // No stackmap for this location and there should be
     BAD_STACKMAP,         // Format error in stackmap
+    WRONG_VALUE_TYPE,     // Mismatched value type
     NO_FAULT,             // No error
     UNKNOWN
   } FaultType;
 
   int _bci;

@@ -214,10 +215,13 @@
     return ErrorContext(bci, MISSING_STACKMAP);
   }
   static ErrorContext bad_stackmap(int index, StackMapFrame* frame) {
     return ErrorContext(0, BAD_STACKMAP, TypeOrigin::frame(frame));
   }
+  static ErrorContext bad_value_type(u2 bci, TypeOrigin type, TypeOrigin exp) {
+    return ErrorContext(bci, WRONG_VALUE_TYPE, type, exp);
+  }
 
   bool is_valid() const { return _fault != NO_FAULT; }
   int bci() const { return _bci; }
 
   void reset_frames() {

@@ -400,11 +404,18 @@
 
   int change_sig_to_verificationType(
     SignatureStream* sig_type, VerificationType* inference_type, TRAPS);
 
   VerificationType cp_index_to_type(int index, const constantPoolHandle& cp, TRAPS) {
-    return VerificationType::reference_type(cp->klass_name_at(index));
+    Symbol* name = cp->klass_name_at(index);
+    if (name->is_Q_signature()) {
+      // Remove the Q and ;
+      // TBD need error msg if fundamental_name() returns NULL?
+      Symbol* fund_name = name->fundamental_name(CHECK_(VerificationType::bogus_type()));
+      return VerificationType::valuetype_type(fund_name);
+    }
+    return VerificationType::reference_type(name);
   }
 
   // Keep a list of temporary symbols created during verification because
   // their reference counts need to be decremented when the verifier object
   // goes out of scope.  Since these symbols escape the scope in which they're

@@ -433,12 +444,20 @@
       {
         Symbol* name = sig_type->as_symbol(CHECK_0);
         // Create another symbol to save as signature stream unreferences this symbol.
         Symbol* name_copy = create_temporary_symbol(name);
         assert(name_copy == name, "symbols don't match");
-        *inference_type =
-          VerificationType::reference_type(name_copy);
+        *inference_type = VerificationType::reference_type(name_copy);
+        return 1;
+      }
+    case T_VALUETYPE:
+      {
+        Symbol* vname = sig_type->as_symbol(CHECK_0);
+        // Create another symbol to save as signature stream unreferences this symbol.
+        Symbol* vname_copy = create_temporary_symbol(vname);
+        assert(vname_copy == vname, "symbols don't match");
+        *inference_type = VerificationType::valuetype_type(vname_copy);
         return 1;
       }
     case T_LONG:
       *inference_type = VerificationType::long_type();
       *++inference_type = VerificationType::long2_type();
< prev index next >