Skip to content

Commit

Permalink
8185736: missing default exception handler in calls to rethrow_Stub
Browse files Browse the repository at this point in the history
Reviewed-by: roland
Backport-of: b97f668af3f55c0d67cdd7a4a191bd81cdc4aa78
  • Loading branch information
Dongbo He authored and rwestrel committed Mar 6, 2023
1 parent 3d1fc4b commit eb2aee6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hotspot/src/share/vm/opto/doCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) {
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();
Expand All @@ -724,6 +725,14 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) {
// 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();
Expand Down
1 change: 1 addition & 0 deletions hotspot/src/share/vm/opto/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,7 @@ void Compile::FillExceptionTables(uint cnt, uint *call_returns, uint *inct_start
}

// 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;
}
Expand Down

1 comment on commit eb2aee6

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.