changeset 4143:e7b1160f4eec

8161218: Better bytecode loading Reviewed-by: acorn, mschoene, ctornqvi Contributed-by: harold.seigel@oracle.com
author shshahma
date Tue, 26 Jul 2016 08:23:25 -0400
parents 5cec449cc409
children 4666bdb69d17
files src/share/vm/classfile/verifier.cpp
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/verifier.cpp	Tue Jan 10 05:18:39 2017 +0000
+++ b/src/share/vm/classfile/verifier.cpp	Tue Jul 26 08:23:25 2016 -0400
@@ -503,19 +503,13 @@
     stack_map_frame* sm_frame = sm_table->entries();
     streamIndentor si2(ss);
     int current_offset = -1;
-    // Subtract two from StackMapAttribute length because the length includes
-    // two bytes for number of table entries.
-    size_t sm_table_space = method->stackmap_data()->length() - 2;
+    address end_of_sm_table = (address)sm_table + method->stackmap_data()->length();
     for (u2 i = 0; i < sm_table->number_of_entries(); ++i) {
       ss->indent();
-      size_t sm_frame_size = sm_frame->size();
-      // If the size of the next stackmap exceeds the length of the entire
-      // stackmap table then print a truncated message and return.
-      if (sm_frame_size > sm_table_space) {
+      if (!sm_frame->verify((address)sm_frame, end_of_sm_table)) {
         sm_frame->print_truncated(ss, current_offset);
         return;
       }
-      sm_table_space -= sm_frame_size;
       sm_frame->print_on(ss, current_offset);
       ss->print_cr("");
       current_offset += sm_frame->offset_delta();