Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, ARGU
JVMCI_THROW_MSG_0(InternalError, err_msg("Primitive type %s should be handled in Java code", str));
}

#ifdef ASSERT
const char* val = Arguments::PropertyList_get_value(Arguments::system_properties(), "test.jvmci.lookupTypeException");
if (val != nullptr) {
if (strstr(val, "<trace>") != nullptr) {
Expand All @@ -595,6 +596,7 @@ C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, ARGU
err_msg("lookupTypeException: %s", str));
}
}
#endif

JVMCIKlassHandle resolved_klass(THREAD);
Klass* accessing_klass = UNPACK_PAIR(Klass, accessing_klass);
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,11 +1246,13 @@ JNIEnv* JVMCIRuntime::init_shared_library_javavm(int* create_JavaVM_err) {
MutexLocker locker(_lock);
JavaVM* javaVM = _shared_library_javavm;
if (javaVM == nullptr) {
#ifdef ASSERT
const char* val = Arguments::PropertyList_get_value(Arguments::system_properties(), "test.jvmci.forceEnomemOnLibjvmciInit");
if (val != nullptr && strcmp(val, "true") == 0) {
*create_JavaVM_err = JNI_ENOMEM;
return nullptr;
}
#endif

char* sl_path;
void* sl_handle = JVMCI::get_shared_library(sl_path, true);
Expand Down Expand Up @@ -2061,12 +2063,14 @@ void JVMCIRuntime::compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, c

JVMCIObject result_object = JVMCIENV->call_HotSpotJVMCIRuntime_compileMethod(receiver, jvmci_method, entry_bci,
(jlong) compile_state, compile_state->task()->compile_id());
#ifdef ASSERT
if (JVMCIENV->has_pending_exception()) {
const char* val = Arguments::PropertyList_get_value(Arguments::system_properties(), "test.jvmci.compileMethodExceptionIsFatal");
if (val != nullptr && strcmp(val, "true") == 0) {
fatal_exception(JVMCIENV, "testing JVMCI fatal exception handling");
}
}
#endif

if (after_compiler_upcall(JVMCIENV, compiler, method, "call_HotSpotJVMCIRuntime_compileMethod")) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
/*
* @test
* @summary Tests handling of an exception thrown by HotSpotJVMCIRuntime.compileMethod.
* Requires a debug VM as it uses test.jvmci.compileMethodExceptionIsFatal
* which is only read in a debug VM.
* @requires vm.jvmci
* @requires vm.debug
* @library /test/lib /
* @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
* jdk.internal.vm.ci/jdk.vm.ci.code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* jdk.internal.vm.ci/jdk.vm.ci.common
* @library /compiler/jvmci/jdk.vm.ci.hotspot.test/src
* /compiler/jvmci/jdk.vm.ci.code.test/src
* @library /test/lib
* @run testng/othervm
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler
* jdk.vm.ci.hotspot.test.TestHotSpotJVMCIRuntime
Expand All @@ -53,6 +54,8 @@
import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.ResolvedJavaType;

import jdk.test.lib.Platform;

public class TestHotSpotJVMCIRuntime {

@Test
Expand Down Expand Up @@ -157,6 +160,11 @@ public static void main(String[] args) {

@Test
public void jniEnomemTest() throws Exception {
if (!Platform.isDebugBuild()) {
// The test.jvmci.forceEnomemOnLibjvmciInit property is only
// read in a debug VM.
return;
}
String[] names = {"translate", "attachCurrentThread", "registerNativeMethods"};
for (String name : names) {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
Expand Down