changeset 18100:c77d5db18942 jdk8u25-b14

8046233: VerifyError on backward branch Summary: Remove check that causes the VerifyError Reviewed-by: dholmes, coleenp, acorn
author hseigel
date Fri, 22 Aug 2014 14:11:46 -0700
parents 077483254bf6
children e62c06b88731
files src/share/vm/classfile/stackMapFrame.cpp src/share/vm/classfile/stackMapFrame.hpp src/share/vm/classfile/stackMapTable.cpp src/share/vm/classfile/stackMapTable.hpp test/runtime/7116786/Test7116786.java
diffstat 5 files changed, 3 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/stackMapFrame.cpp	Tue Aug 12 20:29:25 2014 -0400
+++ b/src/share/vm/classfile/stackMapFrame.cpp	Fri Aug 22 14:11:46 2014 -0700
@@ -54,21 +54,6 @@
   return frame;
 }
 
-bool StackMapFrame::has_new_object() const {
-  int32_t i;
-  for (i = 0; i < _max_locals; i++) {
-    if (_locals[i].is_uninitialized()) {
-      return true;
-    }
-  }
-  for (i = 0; i < _stack_size; i++) {
-    if (_stack[i].is_uninitialized()) {
-      return true;
-    }
-  }
-  return false;
-}
-
 void StackMapFrame::initialize_object(
     VerificationType old_object, VerificationType new_object) {
   int32_t i;
--- a/src/share/vm/classfile/stackMapFrame.hpp	Tue Aug 12 20:29:25 2014 -0400
+++ b/src/share/vm/classfile/stackMapFrame.hpp	Fri Aug 22 14:11:46 2014 -0700
@@ -155,10 +155,6 @@
     const methodHandle m, VerificationType thisKlass, TRAPS);
 
   // Search local variable type array and stack type array.
-  // Return true if an uninitialized object is found.
-  bool has_new_object() const;
-
-  // Search local variable type array and stack type array.
   // Set every element with type of old_object to new_object.
   void initialize_object(
     VerificationType old_object, VerificationType new_object);
--- a/src/share/vm/classfile/stackMapTable.cpp	Tue Aug 12 20:29:25 2014 -0400
+++ b/src/share/vm/classfile/stackMapTable.cpp	Fri Aug 22 14:11:46 2014 -0700
@@ -130,19 +130,6 @@
   if (!match || (target < 0 || target >= _code_length)) {
     frame->verifier()->verify_error(ctx,
         "Inconsistent stackmap frames at branch target %d", target);
-    return;
-  }
-  // check if uninitialized objects exist on backward branches
-  check_new_object(frame, target, CHECK_VERIFY(frame->verifier()));
-}
-
-void StackMapTable::check_new_object(
-    const StackMapFrame* frame, int32_t target, TRAPS) const {
-  if (frame->offset() > target && frame->has_new_object()) {
-    frame->verifier()->verify_error(
-        ErrorContext::bad_code(frame->offset()),
-        "Uninitialized object exists on backward branch %d", target);
-    return;
   }
 }
 
--- a/src/share/vm/classfile/stackMapTable.hpp	Tue Aug 12 20:29:25 2014 -0400
+++ b/src/share/vm/classfile/stackMapTable.hpp	Fri Aug 22 14:11:46 2014 -0700
@@ -90,10 +90,6 @@
   // Returns the frame array index where the frame with offset is stored.
   int get_index_from_offset(int32_t offset) const;
 
-  // Make sure that there's no uninitialized object exist on backward branch.
-  void check_new_object(
-    const StackMapFrame* frame, int32_t target, TRAPS) const;
-
   void print_on(outputStream* str) const;
 };
 
--- a/test/runtime/7116786/Test7116786.java	Tue Aug 12 20:29:25 2014 -0400
+++ b/test/runtime/7116786/Test7116786.java	Fri Aug 22 14:11:46 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -147,7 +147,8 @@
                  "no stackmap frame at jump location or bad jump",
                  "Inconsistent stackmap frames at branch target "),
 
-        new Case("case15", "stackMapTable.cpp", true, "check_new_object",
+        /* Backward jump with uninit is allowed starting with JDK 8 */
+        new Case("case15", "stackMapTable.cpp", false, "check_new_object",
                  "backward jump with uninit",
                  "Uninitialized object exists on backward branch "),