Skip to content

Commit

Permalink
8278966: two microbenchmarks tests fail "assert(!jvms->method()->has_…
Browse files Browse the repository at this point in the history
…exception_handlers()) failed: no exception handler expected" after JDK-8275638

Backport-of: e7244c19f4e24698ab074da530bf6c403f0e22cd
  • Loading branch information
TheRealMDoerr committed Mar 8, 2022
1 parent a8775f1 commit f820a3c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/hotspot/share/opto/callGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -55,18 +55,37 @@ public static void main(String[] args) throws Throwable {
}
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");
Expand Down Expand Up @@ -102,4 +121,12 @@ private static void test4(TestLateMHInlineExceptions test) throws Throwable {
} 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);
}
}

1 comment on commit f820a3c

@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.