7030388: JCK test failed to reject invalid class check01304m10n.
authorkamg
Thu, 31 Mar 2011 08:08:50 -0400
changeset 9128 c8ed9bf1b236
parent 9127 c3fc6f9ed68d
child 9129 a305c5b42df9
7030388: JCK test failed to reject invalid class check01304m10n. Summary: Restrict fix for 7020118 to only when checking exception handlers Reviewed-by: dcubed, dholmes
hotspot/src/share/vm/classfile/stackMapFrame.cpp
hotspot/src/share/vm/classfile/stackMapFrame.hpp
hotspot/src/share/vm/classfile/stackMapTable.cpp
--- a/hotspot/src/share/vm/classfile/stackMapFrame.cpp	Fri Apr 01 15:15:37 2011 -0700
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.cpp	Thu Mar 31 08:08:50 2011 -0400
@@ -208,8 +208,10 @@
   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 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) {
--- a/hotspot/src/share/vm/classfile/stackMapFrame.hpp	Fri Apr 01 15:15:37 2011 -0700
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.hpp	Thu Mar 31 08:08:50 2011 -0400
@@ -134,7 +134,8 @@
   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) {
--- a/hotspot/src/share/vm/classfile/stackMapTable.cpp	Fri Apr 01 15:15:37 2011 -0700
+++ b/hotspot/src/share/vm/classfile/stackMapTable.cpp	Thu Mar 31 08:08:50 2011 -0400
@@ -98,10 +98,13 @@
   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