changeset 24160:04c0ef7ca6bf

JDK-8185736: Add missing unwind exception handler in C2
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 03 Aug 2017 11:30:19 -0700
parents 830c3424c0e5
children cc8d6f9d5db3
files src/share/vm/opto/doCall.cpp src/share/vm/opto/output.cpp
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/doCall.cpp	Thu Aug 03 12:01:05 2017 +0200
+++ b/src/share/vm/opto/doCall.cpp	Thu Aug 03 11:30:19 2017 -0700
@@ -672,6 +672,7 @@
   GrowableArray<const Type*>* extypes = new (C->node_arena()) GrowableArray<const Type*>(C->node_arena(), 8, 0, NULL);
   GrowableArray<int>* saw_unloaded = new (C->node_arena()) GrowableArray<int>(C->node_arena(), 8, 0, 0);
 
+  bool default_handler = false;
   for (; !handlers.is_done(); handlers.next()) {
     ciExceptionHandler* h        = handlers.handler();
     int                 h_bci    = h->handler_bci();
@@ -694,6 +695,14 @@
     // Note:  It's OK if the BCIs repeat themselves.
     bcis->append(h_bci);
     extypes->append(h_extype);
+    if (h_bci == -1) {
+      default_handler = true;
+    }
+  }
+
+  if (!default_handler) {
+    bcis->append(-1);
+    extypes->append(TypeOopPtr::make_from_klass(env()->Throwable_klass())->is_instptr());
   }
 
   int len = bcis->length();
--- a/src/share/vm/opto/output.cpp	Thu Aug 03 12:01:05 2017 +0200
+++ b/src/share/vm/opto/output.cpp	Thu Aug 03 11:30:19 2017 -0700
@@ -1752,6 +1752,7 @@
       }
 
       // Set the offset of the return from the call
+      assert(handler_bcis.find(-1) != -1, "must have default handler");
       _handler_table.add_subtable(call_return, &handler_bcis, NULL, &handler_pcos);
       continue;
     }