hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp
changeset 46338 e84b501fa52e
parent 46329 53ccc37bda19
parent 44092 bc842cc2356b
child 46481 a8e8bb9d1603
equal deleted inserted replaced
46337:307e52ec20cd 46338:e84b501fa52e
    54 #include "runtime/vframe_hp.hpp"
    54 #include "runtime/vframe_hp.hpp"
    55 #include "runtime/vmStructs.hpp"
    55 #include "runtime/vmStructs.hpp"
    56 #include "utilities/resourceHash.hpp"
    56 #include "utilities/resourceHash.hpp"
    57 
    57 
    58 
    58 
       
    59 void JNIHandleMark::push_jni_handle_block() {
       
    60   JavaThread* thread = JavaThread::current();
       
    61   if (thread != NULL) {
       
    62     // Allocate a new block for JNI handles.
       
    63     // Inlined code from jni_PushLocalFrame()
       
    64     JNIHandleBlock* java_handles = ((JavaThread*)thread)->active_handles();
       
    65     JNIHandleBlock* compile_handles = JNIHandleBlock::allocate_block(thread);
       
    66     assert(compile_handles != NULL && java_handles != NULL, "should not be NULL");
       
    67     compile_handles->set_pop_frame_link(java_handles);
       
    68     thread->set_active_handles(compile_handles);
       
    69   }
       
    70 }
       
    71 
       
    72 void JNIHandleMark::pop_jni_handle_block() {
       
    73   JavaThread* thread = JavaThread::current();
       
    74   if (thread != NULL) {
       
    75     // Release our JNI handle block
       
    76     JNIHandleBlock* compile_handles = thread->active_handles();
       
    77     JNIHandleBlock* java_handles = compile_handles->pop_frame_link();
       
    78     thread->set_active_handles(java_handles);
       
    79     compile_handles->set_pop_frame_link(NULL);
       
    80     JNIHandleBlock::release_block(compile_handles, thread); // may block
       
    81   }
       
    82 }
       
    83 
    59 // Entry to native method implementation that transitions current thread to '_thread_in_vm'.
    84 // Entry to native method implementation that transitions current thread to '_thread_in_vm'.
    60 #define C2V_VMENTRY(result_type, name, signature) \
    85 #define C2V_VMENTRY(result_type, name, signature) \
    61   JNIEXPORT result_type JNICALL c2v_ ## name signature { \
    86   JNIEXPORT result_type JNICALL c2v_ ## name signature { \
    62   TRACE_jvmci_1("CompilerToVM::" #name); \
    87   TRACE_jvmci_1("CompilerToVM::" #name); \
    63   TRACE_CALL(result_type, jvmci_ ## name signature) \
    88   TRACE_CALL(result_type, jvmci_ ## name signature) \
    86 
   111 
    87     return (oop)result.get_jobject();
   112     return (oop)result.get_jobject();
    88   }
   113   }
    89   return NULL;
   114   return NULL;
    90 }
   115 }
       
   116 
    91 
   117 
    92 int CompilerToVM::Data::Klass_vtable_start_offset;
   118 int CompilerToVM::Data::Klass_vtable_start_offset;
    93 int CompilerToVM::Data::Klass_vtable_length_offset;
   119 int CompilerToVM::Data::Klass_vtable_length_offset;
    94 
   120 
    95 int CompilerToVM::Data::Method_extra_stack_entries;
   121 int CompilerToVM::Data::Method_extra_stack_entries;
   985 C2V_END
  1011 C2V_END
   986 
  1012 
   987 C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log))
  1013 C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log))
   988   ResourceMark rm;
  1014   ResourceMark rm;
   989   HandleMark hm;
  1015   HandleMark hm;
       
  1016   JNIHandleMark jni_hm;
       
  1017 
   990   Handle target_handle(THREAD, JNIHandles::resolve(target));
  1018   Handle target_handle(THREAD, JNIHandles::resolve(target));
   991   Handle compiled_code_handle(THREAD, JNIHandles::resolve(compiled_code));
  1019   Handle compiled_code_handle(THREAD, JNIHandles::resolve(compiled_code));
   992   CodeBlob* cb = NULL;
  1020   CodeBlob* cb = NULL;
   993   Handle installed_code_handle(THREAD, JNIHandles::resolve(installed_code));
  1021   Handle installed_code_handle(THREAD, JNIHandles::resolve(installed_code));
   994   Handle speculation_log_handle(THREAD, JNIHandles::resolve(speculation_log));
  1022   Handle speculation_log_handle(THREAD, JNIHandles::resolve(speculation_log));