Mercurial > hg > icedtea7-forest > hotspot
changeset 6083:7b5d132c3a70 jdk7u76-b01
8046233: VerifyError on backward branch
Summary: Check that both blocks have same uninitialized object
Reviewed-by: acorn, coleenp
author | hseigel |
---|---|
date | Fri, 29 Aug 2014 12:40:56 -0400 |
parents | b577ea5b8da4 |
children | 10c2cb5743ca |
files | src/share/vm/classfile/stackMapFrame.cpp src/share/vm/classfile/stackMapFrame.hpp src/share/vm/classfile/stackMapTable.cpp |
diffstat | 3 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/classfile/stackMapFrame.cpp Tue Aug 19 04:24:52 2014 -0700 +++ b/src/share/vm/classfile/stackMapFrame.cpp Fri Aug 29 12:40:56 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -54,15 +54,19 @@ return frame; } -bool StackMapFrame::has_new_object() const { +// Return true if frame has an uninitialized (new) object that differs +// from the target frame's object. +bool StackMapFrame::has_nonmatching_new_object(const StackMapFrame *target_frame) const { int32_t i; for (i = 0; i < _max_locals; i++) { - if (_locals[i].is_uninitialized()) { + if (_locals[i].is_uninitialized() && + !_locals[i].equals(target_frame->_locals[i])) { return true; } } for (i = 0; i < _stack_size; i++) { - if (_stack[i].is_uninitialized()) { + if (_stack[i].is_uninitialized() && + !_stack[i].equals(target_frame->_stack[i])) { return true; } }
--- a/src/share/vm/classfile/stackMapFrame.hpp Tue Aug 19 04:24:52 2014 -0700 +++ b/src/share/vm/classfile/stackMapFrame.hpp Fri Aug 29 12:40:56 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -155,8 +155,9 @@ 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; + // Return true if an uninitialized object is found that is + // not equal to the corresponding object on the target frame. + bool has_nonmatching_new_object(const StackMapFrame *target_frame) const; // Search local variable type array and stack type array. // Set every element with type of old_object to new_object.
--- a/src/share/vm/classfile/stackMapTable.cpp Tue Aug 19 04:24:52 2014 -0700 +++ b/src/share/vm/classfile/stackMapTable.cpp Fri Aug 29 12:40:56 2014 -0400 @@ -138,7 +138,10 @@ void StackMapTable::check_new_object( const StackMapFrame* frame, int32_t target, TRAPS) const { - if (frame->offset() > target && frame->has_new_object()) { + int frame_index = get_index_from_offset(target); + assert(frame_index >= 0 && frame_index < _frame_count, "bad frame index"); + if (frame->offset() > target && + frame->has_nonmatching_new_object(_frame_array[frame_index])) { frame->verifier()->verify_error( ErrorContext::bad_code(frame->offset()), "Uninitialized object exists on backward branch %d", target);