@@ -171,7 +171,7 @@ Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) {
171171#define C2V_BLOCK (result_type, name, signature ) \
172172 JVMCI_VM_ENTRY_MARK; \
173173 ResourceMark rm; \
174- JNI_JVMCIENV (JVMCI::compilation_tick(thread), env);
174+ JVMCIENV_FROM_JNI (JVMCI::compilation_tick(thread), env);
175175
176176static JavaThread* get_current_thread (bool allow_null=true ) {
177177 Thread* thread = Thread::current_or_null_safe ();
@@ -2436,16 +2436,13 @@ C2V_VMENTRY_NULL(jlongArray, registerNativeMethods, (JNIEnv* env, jobject, jclas
24362436 JVMCIRuntime* runtime;
24372437 {
24382438 // Ensure the JVMCI shared library runtime is initialized.
2439- bool jni_enomem_is_fatal = false ;
2440- JVMCIEnv __peer_jvmci_env__ (thread, false , jni_enomem_is_fatal, __FILE__, __LINE__);
2441- JVMCIEnv* peerEnv = &__peer_jvmci_env__;
2442- if (peerEnv->has_jni_enomem ()) {
2443- JVMCI_THROW_MSG_0 (OutOfMemoryError, " JNI_ENOMEM creating or attaching to libjvmci" );
2444- }
2439+ PEER_JVMCIENV_FROM_THREAD (THREAD, false );
2440+ PEER_JVMCIENV->check_init (JVMCI_CHECK_NULL);
2441+
24452442 HandleMark hm (THREAD);
24462443 runtime = JVMCI::compiler_runtime (thread);
2447- if (peerEnv ->has_pending_exception ()) {
2448- peerEnv ->describe_pending_exception (tty);
2444+ if (PEER_JVMCIENV ->has_pending_exception ()) {
2445+ PEER_JVMCIENV ->describe_pending_exception (tty);
24492446 }
24502447 sl_handle = JVMCI::get_shared_library (sl_path, false );
24512448 if (sl_handle == nullptr ) {
@@ -2604,17 +2601,13 @@ C2V_VMENTRY_PREFIX(jboolean, attachCurrentThread, (JNIEnv* env, jobject c2vm, jb
26042601
26052602 {
26062603 // Ensure the JVMCI shared library runtime is initialized.
2607- bool jni_enomem_is_fatal = false ;
2608- JVMCIEnv __peer_jvmci_env__ (thread, false , jni_enomem_is_fatal, __FILE__, __LINE__);
2609- JVMCIEnv* peerJVMCIEnv = &__peer_jvmci_env__;
2610- if (peerJVMCIEnv->has_jni_enomem ()) {
2611- JVMCI_THROW_MSG_0 (OutOfMemoryError, " JNI_ENOMEM creating or attaching to libjvmci" );
2612- }
2604+ PEER_JVMCIENV_FROM_THREAD (THREAD, false );
2605+ PEER_JVMCIENV->check_init (JVMCI_CHECK_0);
26132606
26142607 HandleMark hm (thread);
2615- JVMCIObject receiver = runtime->get_HotSpotJVMCIRuntime (peerJVMCIEnv );
2616- if (peerJVMCIEnv ->has_pending_exception ()) {
2617- peerJVMCIEnv ->describe_pending_exception (tty);
2608+ JVMCIObject receiver = runtime->get_HotSpotJVMCIRuntime (PEER_JVMCIENV );
2609+ if (PEER_JVMCIENV ->has_pending_exception ()) {
2610+ PEER_JVMCIENV ->describe_pending_exception (tty);
26182611 }
26192612 char * sl_path;
26202613 if (JVMCI::get_shared_library (sl_path, false ) == nullptr ) {
@@ -2704,33 +2697,29 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
27042697 if (obj_handle == nullptr ) {
27052698 return 0L ;
27062699 }
2707- bool jni_enomem_is_fatal = false ;
2708- JVMCIEnv __peer_jvmci_env__ (thread, !JVMCIENV->is_hotspot (), jni_enomem_is_fatal, __FILE__, __LINE__);
2709- JVMCIEnv* peerEnv = &__peer_jvmci_env__;
2710- JVMCIEnv* thisEnv = JVMCIENV;
2711- if (peerEnv->has_jni_enomem ()) {
2712- JVMCI_THROW_MSG_0 (OutOfMemoryError, " JNI_ENOMEM creating or attaching to libjvmci" );
2713- }
2700+ PEER_JVMCIENV_FROM_THREAD (THREAD, !JVMCIENV->is_hotspot ());
2701+ PEER_JVMCIENV->check_init (JVMCI_CHECK_0);
27142702
2703+ JVMCIEnv* thisEnv = JVMCIENV;
27152704 JVMCIObject obj = thisEnv->wrap (obj_handle);
27162705 JVMCIObject result;
27172706 if (thisEnv->isa_HotSpotResolvedJavaMethodImpl (obj)) {
27182707 methodHandle method (THREAD, thisEnv->asMethod (obj));
2719- result = peerEnv ->get_jvmci_method (method, JVMCI_CHECK_0);
2708+ result = PEER_JVMCIENV ->get_jvmci_method (method, JVMCI_CHECK_0);
27202709 } else if (thisEnv->isa_HotSpotResolvedObjectTypeImpl (obj)) {
27212710 Klass* klass = thisEnv->asKlass (obj);
27222711 JVMCIKlassHandle klass_handle (THREAD);
27232712 klass_handle = klass;
2724- result = peerEnv ->get_jvmci_type (klass_handle, JVMCI_CHECK_0);
2713+ result = PEER_JVMCIENV ->get_jvmci_type (klass_handle, JVMCI_CHECK_0);
27252714 } else if (thisEnv->isa_HotSpotResolvedPrimitiveType (obj)) {
27262715 BasicType type = JVMCIENV->kindToBasicType (JVMCIENV->get_HotSpotResolvedPrimitiveType_kind (obj), JVMCI_CHECK_0);
2727- result = peerEnv ->get_jvmci_primitive_type (type);
2716+ result = PEER_JVMCIENV ->get_jvmci_primitive_type (type);
27282717 } else if (thisEnv->isa_IndirectHotSpotObjectConstantImpl (obj) ||
27292718 thisEnv->isa_DirectHotSpotObjectConstantImpl(obj)) {
27302719 Handle constant = thisEnv->asConstant (obj, JVMCI_CHECK_0);
2731- result = peerEnv ->get_object_constant (constant ());
2720+ result = PEER_JVMCIENV ->get_object_constant (constant ());
27322721 } else if (thisEnv->isa_HotSpotNmethod (obj)) {
2733- if (peerEnv ->is_hotspot ()) {
2722+ if (PEER_JVMCIENV ->is_hotspot ()) {
27342723 nmethod* nm = JVMCIENV->get_nmethod (obj);
27352724 if (nm != nullptr ) {
27362725 JVMCINMethodData* data = nm->jvmci_nmethod_data ();
@@ -2753,17 +2742,17 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
27532742 JVMCIObject name_string = thisEnv->get_InstalledCode_name (obj);
27542743 const char * cstring = name_string.is_null () ? nullptr : thisEnv->as_utf8_string (name_string);
27552744 // Create a new HotSpotNmethod instance in the peer runtime
2756- result = peerEnv ->new_HotSpotNmethod (mh, cstring, isDefault, compileIdSnapshot, JVMCI_CHECK_0);
2745+ result = PEER_JVMCIENV ->new_HotSpotNmethod (mh, cstring, isDefault, compileIdSnapshot, JVMCI_CHECK_0);
27572746 nmethod* nm = JVMCIENV->get_nmethod (obj);
27582747 if (result.is_null ()) {
27592748 // exception occurred (e.g. OOME) creating a new HotSpotNmethod
27602749 } else if (nm == nullptr ) {
27612750 // nmethod must have been unloaded
27622751 } else {
27632752 // Link the new HotSpotNmethod to the nmethod
2764- peerEnv ->initialize_installed_code (result, nm, JVMCI_CHECK_0);
2753+ PEER_JVMCIENV ->initialize_installed_code (result, nm, JVMCI_CHECK_0);
27652754 // Only HotSpotNmethod instances in the HotSpot heap are tracked directly by the runtime.
2766- if (peerEnv ->is_hotspot ()) {
2755+ if (PEER_JVMCIENV ->is_hotspot ()) {
27672756 JVMCINMethodData* data = nm->jvmci_nmethod_data ();
27682757 if (data == nullptr ) {
27692758 JVMCI_THROW_MSG_0 (IllegalArgumentException, " Cannot set HotSpotNmethod mirror for default nmethod" );
@@ -2781,13 +2770,13 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
27812770 err_msg (" Cannot translate object of type: %s" , thisEnv->klass_name (obj)));
27822771 }
27832772 if (callPostTranslation) {
2784- peerEnv ->call_HotSpotJVMCIRuntime_postTranslation (result, JVMCI_CHECK_0);
2773+ PEER_JVMCIENV ->call_HotSpotJVMCIRuntime_postTranslation (result, JVMCI_CHECK_0);
27852774 }
27862775 // Propagate any exception that occurred while creating the translated object
2787- if (peerEnv ->transfer_pending_exception (thread, thisEnv)) {
2776+ if (PEER_JVMCIENV ->transfer_pending_exception (thread, thisEnv)) {
27882777 return 0L ;
27892778 }
2790- return (jlong) peerEnv ->make_global (result).as_jobject();
2779+ return (jlong) PEER_JVMCIENV ->make_global (result).as_jobject();
27912780}
27922781
27932782C2V_VMENTRY_NULL (jobject, unhand, (JNIEnv* env, jobject, jlong obj_handle))
0 commit comments