8278966: two microbenchmarks tests fail "assert(!jvms->method()->has_exception_handlers()) failed: no exception handler expected" after JDK-8275638

Reviewed-by: rbackman, vlivanov
This commit is contained in:
Roland Westrelin 2022-01-04 10:56:37 +00:00
parent b4b0328d62
commit e7244c19f4
2 changed files with 31 additions and 2 deletions
src/hotspot/share/opto
test/hotspot/jtreg/compiler/exceptions

@ -420,7 +420,9 @@ bool LateInlineMHCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms)
// expression stacks which causes late inlining to break. The MH invoker is not expected to be called from a method wih
// exception handlers. When there is no exception handler, GraphKit::builtin_throw() pops the stack which solves the issue
// of late inlining with exceptions.
assert(!jvms->method()->has_exception_handlers(), "no exception handler expected");
assert(!jvms->method()->has_exception_handlers() ||
(method()->intrinsic_id() != vmIntrinsics::_linkToVirtual &&
method()->intrinsic_id() != vmIntrinsics::_linkToInterface), "no exception handler expected");
// Even if inlining is not allowed, a virtual call can be strength-reduced to a direct call.
bool allow_inline = C->inlining_incrementally();
bool input_not_const = true;

@ -23,7 +23,7 @@
/**
* @test
* @bug 8275638
* @bug 8275638 8278966
* @summary GraphKit::combine_exception_states fails with "matching stack sizes" assert
*
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLateMHInlineExceptions::m
@ -55,18 +55,37 @@ public class TestLateMHInlineExceptions {
}
test4(test);
test4(null);
test5(test);
try {
test5(null);
} catch (NullPointerException npe) {
}
test6(test);
try {
test6(null);
} catch (NullPointerException npe) {
}
}
}
void m() {
}
static void nothing(Throwable t) {
}
static final MethodHandle mh;
static final MethodHandle mh_nothing;
static final MethodHandle mh2;
static final MethodHandle mh3;
static {
MethodHandles.Lookup lookup = MethodHandles.lookup();
try {
mh = lookup.findVirtual(TestLateMHInlineExceptions.class, "m", MethodType.methodType(void.class));
mh_nothing = lookup.findStatic(TestLateMHInlineExceptions.class, "nothing", MethodType.methodType(void.class, Throwable.class));
mh2 = MethodHandles.tryFinally(mh, mh_nothing);
mh3 = MethodHandles.catchException(mh, Throwable.class, mh_nothing);
} catch (NoSuchMethodException e) {
e.printStackTrace();
throw new RuntimeException("Method handle lookup failed");
@ -102,4 +121,12 @@ public class TestLateMHInlineExceptions {
} catch (NullPointerException npe) {
}
}
private static void test5(TestLateMHInlineExceptions test) throws Throwable {
mh2.invokeExact(test);
}
private static void test6(TestLateMHInlineExceptions test) throws Throwable {
mh3.invokeExact(test);
}
}