Merge
This commit is contained in:
commit
191f7307bb
4
.github/workflows/submit.yml
vendored
4
.github/workflows/submit.yml
vendored
@ -341,6 +341,7 @@ jobs:
|
||||
run: >
|
||||
if ! grep --include=test-summary.txt -lqr build/*/test-results -e "TEST SUCCESS" ; then
|
||||
cat build/*/test-results/*/text/newfailures.txt ;
|
||||
cat build/*/test-results/*/text/other_errors.txt ;
|
||||
exit 1 ;
|
||||
fi
|
||||
|
||||
@ -807,6 +808,7 @@ jobs:
|
||||
run: >
|
||||
if ! grep --include=test-summary.txt -lqr build/*/test-results -e "TEST SUCCESS" ; then
|
||||
cat build/*/test-results/*/text/newfailures.txt ;
|
||||
cat build/*/test-results/*/text/other_errors.txt ;
|
||||
exit 1 ;
|
||||
fi
|
||||
|
||||
@ -1218,6 +1220,7 @@ jobs:
|
||||
run: >
|
||||
if ((Get-ChildItem -Path build\*\test-results\test-summary.txt -Recurse | Select-String -Pattern "TEST SUCCESS" ).Count -eq 0) {
|
||||
Get-Content -Path build\*\test-results\*\*\newfailures.txt ;
|
||||
Get-Content -Path build\*\test-results\*\*\other_errors.txt ;
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -1611,6 +1614,7 @@ jobs:
|
||||
run: >
|
||||
if ! grep --include=test-summary.txt -lqr build/*/test-results -e "TEST SUCCESS" ; then
|
||||
cat build/*/test-results/*/text/newfailures.txt ;
|
||||
cat build/*/test-results/*/text/other_errors.txt ;
|
||||
exit 1 ;
|
||||
fi
|
||||
|
||||
|
@ -106,7 +106,7 @@ class G1RemSetScanState : public CHeapObj<mtGC> {
|
||||
// within a region to claim. Dependent on the region size as proxy for the heap
|
||||
// size, we limit the total number of chunks to limit memory usage and maintenance
|
||||
// effort of that table vs. granularity of distributing scanning work.
|
||||
// Testing showed that 8 for 1M/2M region, 16 for 4M/8M regions, 32 for 16/32M regions,
|
||||
// Testing showed that 64 for 1M/2M region, 128 for 4M/8M regions, 256 for 16/32M regions,
|
||||
// and so on seems to be such a good trade-off.
|
||||
static uint get_chunks_per_region(uint log_region_size) {
|
||||
// Limit the expected input values to current known possible values of the
|
||||
@ -114,7 +114,7 @@ class G1RemSetScanState : public CHeapObj<mtGC> {
|
||||
// values for region size.
|
||||
assert(log_region_size >= 20 && log_region_size <= 29,
|
||||
"expected value in [20,29], but got %u", log_region_size);
|
||||
return 1u << (log_region_size / 2 - 7);
|
||||
return 1u << (log_region_size / 2 - 4);
|
||||
}
|
||||
|
||||
uint _scan_chunks_per_region; // Number of chunks per region.
|
||||
|
@ -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;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,13 +67,17 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
|
||||
JVMState* jvms, bool allow_inline,
|
||||
float prof_factor, ciKlass* speculative_receiver_type,
|
||||
bool allow_intrinsics) {
|
||||
ciMethod* caller = jvms->method();
|
||||
int bci = jvms->bci();
|
||||
Bytecodes::Code bytecode = caller->java_code_at_bci(bci);
|
||||
guarantee(callee != NULL, "failed method resolution");
|
||||
assert(callee != NULL, "failed method resolution");
|
||||
|
||||
ciMethod* caller = jvms->method();
|
||||
int bci = jvms->bci();
|
||||
Bytecodes::Code bytecode = caller->java_code_at_bci(bci);
|
||||
ciMethod* orig_callee = caller->get_method_at_bci(bci);
|
||||
|
||||
const bool is_virtual_or_interface = (bytecode == Bytecodes::_invokevirtual) ||
|
||||
(bytecode == Bytecodes::_invokeinterface);
|
||||
(bytecode == Bytecodes::_invokeinterface) ||
|
||||
(orig_callee->intrinsic_id() == vmIntrinsics::_linkToVirtual) ||
|
||||
(orig_callee->intrinsic_id() == vmIntrinsics::_linkToInterface);
|
||||
|
||||
// Dtrace currently doesn't work unless all calls are vanilla
|
||||
if (env()->dtrace_method_probes()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -172,17 +172,17 @@ Handle VectorSupport::allocate_vector_payload(InstanceKlass* ik, frame* fr, Regi
|
||||
return allocate_vector_payload_helper(ik, fr, reg_map, location, THREAD); // safepoint
|
||||
}
|
||||
#ifdef ASSERT
|
||||
// Other payload values are: 'oop' type location and Scalar-replaced boxed vector representation.
|
||||
// Other payload values are: 'oop' type location and scalar-replaced boxed vector representation.
|
||||
// They will be processed in Deoptimization::reassign_fields() after all objects are reallocated.
|
||||
else {
|
||||
Location::Type loc_type = location.type();
|
||||
assert(loc_type == Location::oop || loc_type == Location::narrowoop,
|
||||
"expected 'oop'(%d) or 'narrowoop'(%d) types location but got: %d", Location::oop, Location::narrowoop, loc_type);
|
||||
}
|
||||
} else if (!payload->is_object()) {
|
||||
} else if (!payload->is_object() && !payload->is_constant_oop()) {
|
||||
stringStream ss;
|
||||
payload->print_on(&ss);
|
||||
assert(payload->is_object(), "expected 'object' value for scalar-replaced boxed vector but got: %s", ss.as_string());
|
||||
assert(false, "expected 'object' value for scalar-replaced boxed vector but got: %s", ss.as_string());
|
||||
#endif
|
||||
}
|
||||
return Handle(THREAD, nullptr);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,12 +50,23 @@
|
||||
*/
|
||||
package compiler.cha;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
import static compiler.cha.Utils.*;
|
||||
|
||||
public class AbstractRootMethod {
|
||||
public static void main(String[] args) {
|
||||
run(AbstractClass.class);
|
||||
run(AbstractInterface.class);
|
||||
|
||||
// Implementation limitation: CHA is not performed by C1 during inlining through MH linkers.
|
||||
if (!sun.hotspot.code.Compiler.isC1Enabled()) {
|
||||
run(AbstractClass.TestMH.class, AbstractClass.class);
|
||||
run(AbstractInterface.TestMH.class, AbstractInterface.class);
|
||||
}
|
||||
|
||||
System.out.println("TEST PASSED");
|
||||
}
|
||||
|
||||
public static class AbstractClass extends ATest<AbstractClass.C> {
|
||||
@ -124,7 +135,21 @@ public class AbstractRootMethod {
|
||||
call(new G() { public Object m() { return CORRECT; } }); // Gn <: G.m <: C.m ABSTRACT
|
||||
assertCompiled();
|
||||
}
|
||||
|
||||
public static class TestMH extends AbstractClass {
|
||||
static final MethodHandle TEST_MH = findVirtualHelper(C.class, "m", Object.class, MethodHandles.lookup());
|
||||
|
||||
@Override
|
||||
public Object test(C obj) {
|
||||
try {
|
||||
return TEST_MH.invokeExact(obj); // invokevirtual C.m()
|
||||
} catch (Throwable e) {
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class AbstractInterface extends ATest<AbstractInterface.C> {
|
||||
public AbstractInterface() {
|
||||
super(C.class, D.class);
|
||||
@ -193,5 +218,18 @@ public class AbstractRootMethod {
|
||||
call(new G() { public Object m() { return CORRECT; } }); // Gn <: G.m <: C <: I.m ABSTRACT
|
||||
assertCompiled();
|
||||
}
|
||||
|
||||
public static class TestMH extends AbstractInterface {
|
||||
static final MethodHandle TEST_MH = findVirtualHelper(C.class, "m", Object.class, MethodHandles.lookup());
|
||||
|
||||
@Override
|
||||
public Object test(C obj) {
|
||||
try {
|
||||
return TEST_MH.invokeExact(obj); // invokevirtual C.m()
|
||||
} catch (Throwable e) {
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,12 +50,22 @@
|
||||
*/
|
||||
package compiler.cha;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
import static compiler.cha.Utils.*;
|
||||
|
||||
public class DefaultRootMethod {
|
||||
public static void main(String[] args) {
|
||||
run(DefaultRoot.class);
|
||||
run(InheritedDefault.class);
|
||||
|
||||
// Implementation limitation: CHA is not performed by C1 during inlining through MH linkers.
|
||||
if (!sun.hotspot.code.Compiler.isC1Enabled()) {
|
||||
run(DefaultRoot.TestMH.class, DefaultRoot.class);
|
||||
run(InheritedDefault.TestMH.class, InheritedDefault.class);
|
||||
}
|
||||
|
||||
System.out.println("TEST PASSED");
|
||||
}
|
||||
|
||||
@ -83,7 +93,7 @@ public class DefaultRootMethod {
|
||||
static class G extends C { public Object m() { return CORRECT; } }
|
||||
|
||||
@Override
|
||||
public Object test(C obj) {
|
||||
public Object test(C obj) throws Throwable {
|
||||
return obj.m(); // invokevirtual C.m()
|
||||
}
|
||||
|
||||
@ -122,6 +132,15 @@ public class DefaultRootMethod {
|
||||
call(new G() { public Object m() { return CORRECT; } }); // Gn <: G.m <: C <: I.m DEFAULT
|
||||
assertCompiled();
|
||||
}
|
||||
|
||||
public static class TestMH extends DefaultRoot {
|
||||
static final MethodHandle TEST_MH = findVirtualHelper(C.class, "m", Object.class, MethodHandles.lookup());
|
||||
|
||||
@Override
|
||||
public Object test(C obj) throws Throwable {
|
||||
return TEST_MH.invokeExact(obj); // invokevirtual C.m()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class InheritedDefault extends ATest<InheritedDefault.C> {
|
||||
@ -151,7 +170,7 @@ public class DefaultRootMethod {
|
||||
static class G extends C implements K { /* inherits K.m DEFAULT */ }
|
||||
|
||||
@Override
|
||||
public Object test(C obj) {
|
||||
public Object test(C obj) throws Throwable {
|
||||
return obj.m(); // invokevirtual C.m()
|
||||
}
|
||||
|
||||
@ -190,5 +209,14 @@ public class DefaultRootMethod {
|
||||
call(new G() { public Object m() { return CORRECT; } }); // Gn <: G.m <: C <: I.m DEFAULT
|
||||
assertCompiled();
|
||||
}
|
||||
|
||||
public static class TestMH extends InheritedDefault {
|
||||
static final MethodHandle TEST_MH = findVirtualHelper(C.class, "m", Object.class, MethodHandles.lookup());
|
||||
|
||||
@Override
|
||||
public Object test(C obj) throws Throwable {
|
||||
return TEST_MH.invokeExact(obj); // invokevirtual C.m()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -45,6 +46,7 @@ import static jdk.test.lib.Asserts.assertTrue;
|
||||
|
||||
public class Utils {
|
||||
public static final Unsafe U = Unsafe.getUnsafe();
|
||||
public static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
|
||||
interface Test<T> {
|
||||
void call(T o);
|
||||
@ -99,8 +101,6 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static abstract class ATest<T> implements Test<T> {
|
||||
public static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
|
||||
public static final Object CORRECT = new Object();
|
||||
public static final Object WRONG = new Object();
|
||||
|
||||
@ -117,7 +117,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
@DontInline
|
||||
public abstract Object test(T i);
|
||||
public abstract Object test(T i) throws Throwable;
|
||||
|
||||
public abstract void checkInvalidReceiver();
|
||||
|
||||
@ -133,7 +133,6 @@ public class Utils {
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
public void compile(Runnable r) {
|
||||
while (!WB.isMethodCompiled(TEST)) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
@ -161,19 +160,35 @@ public class Utils {
|
||||
|
||||
@Override
|
||||
public void call(T i) {
|
||||
assertTrue(test(i) != WRONG);
|
||||
try {
|
||||
assertTrue(test(i) != WRONG);
|
||||
} catch (Throwable e) {
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T compute(Callable<T> c) {
|
||||
try {
|
||||
return c.call();
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static MethodHandle findVirtualHelper(Class<?> refc, String name, Class<?> returnType, MethodHandles.Lookup lookup) {
|
||||
return compute(() -> lookup.findVirtual(refc, name, MethodType.methodType(returnType)));
|
||||
}
|
||||
}
|
||||
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
public @interface TestCase {}
|
||||
|
||||
static void run(Class<?> test) {
|
||||
static void run(Class<?> test, Class<?> enclosed) {
|
||||
try {
|
||||
for (Method m : test.getDeclaredMethods()) {
|
||||
for (Method m : test.getMethods()) {
|
||||
if (m.isAnnotationPresent(TestCase.class)) {
|
||||
System.out.println(m.toString());
|
||||
ClassLoader cl = new MyClassLoader(test);
|
||||
ClassLoader cl = new MyClassLoader(enclosed);
|
||||
Class<?> c = cl.loadClass(test.getName());
|
||||
c.getMethod(m.getName()).invoke(c.getDeclaredConstructor().newInstance());
|
||||
}
|
||||
@ -183,6 +198,10 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
static void run(Class<?> test) {
|
||||
run(test, test);
|
||||
}
|
||||
|
||||
static class ObjectToStringHelper {
|
||||
static Object testHelper(Object o) {
|
||||
throw new Error("not used");
|
||||
@ -303,7 +322,7 @@ public class Utils {
|
||||
try {
|
||||
r.run();
|
||||
throw new AssertionError("Exception not thrown: " + expectedException.getName());
|
||||
} catch(Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
if (expectedException == e.getClass()) {
|
||||
// success: proper exception is thrown
|
||||
} else {
|
||||
@ -320,12 +339,4 @@ public class Utils {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
static <T> T compute(Callable<T> c) {
|
||||
try {
|
||||
return c.call();
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user