< prev index next >
src/share/vm/jvmci/jvmciCompilerToVM.cpp
Print this page
@@ -53,10 +53,35 @@
#include "runtime/vframe.hpp"
#include "runtime/vframe_hp.hpp"
#include "runtime/vmStructs.hpp"
+void JNIHandleMark::push_jni_handle_block() {
+ JavaThread* thread = JavaThread::current();
+ if (thread != NULL) {
+ // Allocate a new block for JNI handles.
+ // Inlined code from jni_PushLocalFrame()
+ JNIHandleBlock* java_handles = ((JavaThread*)thread)->active_handles();
+ JNIHandleBlock* compile_handles = JNIHandleBlock::allocate_block(thread);
+ assert(compile_handles != NULL && java_handles != NULL, "should not be NULL");
+ compile_handles->set_pop_frame_link(java_handles);
+ thread->set_active_handles(compile_handles);
+ }
+}
+
+void JNIHandleMark::pop_jni_handle_block() {
+ JavaThread* thread = JavaThread::current();
+ if (thread != NULL) {
+ // Release our JNI handle block
+ JNIHandleBlock* compile_handles = thread->active_handles();
+ JNIHandleBlock* java_handles = compile_handles->pop_frame_link();
+ thread->set_active_handles(java_handles);
+ compile_handles->set_pop_frame_link(NULL);
+ JNIHandleBlock::release_block(compile_handles, thread); // may block
+ }
+}
+
// Entry to native method implementation that transitions current thread to '_thread_in_vm'.
#define C2V_VMENTRY(result_type, name, signature) \
JNIEXPORT result_type JNICALL c2v_ ## name signature { \
TRACE_jvmci_1("CompilerToVM::" #name); \
TRACE_CALL(result_type, jvmci_ ## name signature) \
@@ -86,10 +111,11 @@
return (oop)result.get_jobject();
}
return NULL;
}
+
int CompilerToVM::Data::Klass_vtable_start_offset;
int CompilerToVM::Data::Klass_vtable_length_offset;
int CompilerToVM::Data::Method_extra_stack_entries;
@@ -840,10 +866,12 @@
C2V_END
C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log))
ResourceMark rm;
HandleMark hm;
+ JNIHandleMark jni_hm;
+
Handle target_handle = JNIHandles::resolve(target);
Handle compiled_code_handle = JNIHandles::resolve(compiled_code);
CodeBlob* cb = NULL;
Handle installed_code_handle = JNIHandles::resolve(installed_code);
Handle speculation_log_handle = JNIHandles::resolve(speculation_log);
< prev index next >