diff --git a/src/share/vm/classfile/stackMapFrame.cpp b/src/share/vm/classfile/stackMapFrame.cpp index 38fe483fb9606ca9f556145457c80bf557fc4e76..864c2257fc8a266e5ede4b1ed66a14175f02cbc4 100644 --- a/src/share/vm/classfile/stackMapFrame.cpp +++ b/src/share/vm/classfile/stackMapFrame.cpp @@ -208,8 +208,10 @@ bool StackMapFrame::has_flag_match_exception( return true; } -bool StackMapFrame::is_assignable_to(const StackMapFrame* target, TRAPS) const { - if (_max_locals != target->max_locals() || _stack_size != target->stack_size()) { +bool StackMapFrame::is_assignable_to( + const StackMapFrame* target, bool is_exception_handler, TRAPS) const { + if (_max_locals != target->max_locals() || + _stack_size != target->stack_size()) { return false; } // Only need to compare type elements up to target->locals() or target->stack(). @@ -222,7 +224,7 @@ bool StackMapFrame::is_assignable_to(const StackMapFrame* target, TRAPS) const { bool match_flags = (_flags | target->flags()) == target->flags(); return match_locals && match_stack && - (match_flags || has_flag_match_exception(target)); + (match_flags || (is_exception_handler && has_flag_match_exception(target))); } VerificationType StackMapFrame::pop_stack_ex(VerificationType type, TRAPS) { diff --git a/src/share/vm/classfile/stackMapFrame.hpp b/src/share/vm/classfile/stackMapFrame.hpp index a07df0ce56f8a83676194e97072cfe9da5966c84..a6d6a2938b9230f7b76b07e9217d67b74758df7b 100644 --- a/src/share/vm/classfile/stackMapFrame.hpp +++ b/src/share/vm/classfile/stackMapFrame.hpp @@ -134,7 +134,8 @@ class StackMapFrame : public ResourceObj { void copy_stack(const StackMapFrame* src); // Return true if this stack map frame is assignable to target. - bool is_assignable_to(const StackMapFrame* target, TRAPS) const; + bool is_assignable_to(const StackMapFrame* target, + bool is_exception_handler, TRAPS) const; // Push type into stack type array. inline void push_stack(VerificationType type, TRAPS) { diff --git a/src/share/vm/classfile/stackMapTable.cpp b/src/share/vm/classfile/stackMapTable.cpp index f6a0b427386b024d6f8186b0a65f978a73d736eb..97bf564f19275edb2d2f75a5255f672f5ff48bc7 100644 --- a/src/share/vm/classfile/stackMapTable.cpp +++ b/src/share/vm/classfile/stackMapTable.cpp @@ -98,10 +98,13 @@ bool StackMapTable::match_stackmap( bool result = true; StackMapFrame *stackmap_frame = _frame_array[frame_index]; if (match) { + // when checking handler target, match == true && update == false + bool is_exception_handler = !update; // Has direct control flow from last instruction, need to match the two // frames. result = frame->is_assignable_to( - stackmap_frame, CHECK_VERIFY_(frame->verifier(), false)); + stackmap_frame, is_exception_handler, + CHECK_VERIFY_(frame->verifier(), false)); } if (update) { // Use the frame in stackmap table as current frame