8286865: vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java fails with Out of space in CodeCache

Reviewed-by: dlong, chagedorn
This commit is contained in:
Ramkumar Sunderbabu 2025-10-09 06:19:00 +00:00 committed by Christian Hagedorn
parent 914b44e277
commit 1b11bea76b

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2025, 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
@ -33,6 +33,7 @@
* another method handle and so on.
* The test verifies that arguments are correctly passed between native methods and MHs.
*
* @requires vm.compMode != "Xcomp"
* @library /vmTestbase
* /test/lib
*
@ -62,26 +63,32 @@ public class Test extends MultiThreadedTest {
private static final String RETURN_VALUE = "test";
static {
System.loadLibrary("nativeAndMH");
}
private static native Object native01(Object a1, String a2, Object a3, Object a4, Object a5, Object a6, MethodHandle mh);
private static final MethodType MT_calledFromNative = MethodType.methodType(
Object.class,
Object.class, Object.class, int.class, long.class, double.class, float.class);
private static MethodHandle mh;
static {
System.loadLibrary("nativeAndMH");
try {
mh = MethodHandles.lookup().findStatic(
Test.class,
"calledFromNative",
MT_calledFromNative);
} catch (Exception ex) {
throw new RuntimeException("TEST FAILED - Unable to lookup \"calledFromNative\"");
}
}
private static native Object native01(Object a1, String a2, Object a3, Object a4, Object a5, Object a6, MethodHandle mh);
private static Object calledFromNative(Object s1, Object s2, int i, long l, double d, float f) {
return RETURN_VALUE;
}
@Override
protected boolean runThread(int threadNum) throws Throwable {
MethodHandle mh = MethodHandles.lookup().findStatic(
Test.class,
"calledFromNative",
MT_calledFromNative);
Stresser stresser = createStresser();
stresser.start(1);