Question about C1 exception handling code
Andrew Dinn
adinn at redhat.com
Tue Feb 27 15:23:10 UTC 2018
I was looking into a problem that turned up compiling a Graal class
using jdk9, identified a patch and then found that it had already been
fixed by Roland in jdk10
https://bugs.openjdk.java.net/browse/JDK-8188151
However, my patch included a change which is not present in Roland's fix
and still not corrected in jdk/hs. I /think/ an extra tweak is needed
but am not sure. A second opinion would be welcome.
The relevant code is in file c1_Compilation.cpp inside method
Compilation::generate_exception_handler_table whihc can be found at line
479. The code looks like this
void Compilation::generate_exception_handler_table() {
// Generate an ExceptionHandlerTable from the exception handler
// information accumulated during the compilation.
. . .
for (int i = 0; i < info_list->length(); i++) {
ExceptionInfo* info = info_list->at(i);
XHandlers* handlers = info->exception_handlers();
. . .
for (int i = 0; i < handlers->length(); i++) {
XHandler* handler = handlers->handler_at(i);
assert(handler->entry_pco() != -1, "must have been generated");
assert(handler->scope_count() >= prev_scope, "handlers should be
sorted by scope");
. . .
The missing bits don't really matter. The important point is that it
looks as if that inner loop really ought to use a new loop variable
for (j = 0; i < handlers->length(); i++) {
XHandler* handler = handlers->handler_at(i);
. . .
I'll happily acknowledge that I only have a vague overview of how the C1
code works. Am I missing some clever trick here which requires the inner
loop to reset the counter for the outer loop to handlers->length() by
the time it completes? Or is this really just an obvious mistake?
regards,
Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander
More information about the hotspot-compiler-dev
mailing list