# HG changeset patch # User hseigel # Date 1408741906 25200 # Node ID c77d5db189422e2eef0443ee212644e497113b18 # Parent 077483254bf635cd124a80c054488a0dbb856355 8046233: VerifyError on backward branch Summary: Remove check that causes the VerifyError Reviewed-by: dholmes, coleenp, acorn diff -r 077483254bf6 -r c77d5db18942 src/share/vm/classfile/stackMapFrame.cpp --- 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; diff -r 077483254bf6 -r c77d5db18942 src/share/vm/classfile/stackMapFrame.hpp --- 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); diff -r 077483254bf6 -r c77d5db18942 src/share/vm/classfile/stackMapTable.cpp --- 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; } } diff -r 077483254bf6 -r c77d5db18942 src/share/vm/classfile/stackMapTable.hpp --- 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; }; diff -r 077483254bf6 -r c77d5db18942 test/runtime/7116786/Test7116786.java --- 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 "),