Exemplo n.º 1
0
GenericFunctionPointer interp_find_native(Method_Handle method)
{
    hythread_suspend_enable();
    GenericFunctionPointer f = classloader_find_native((Method_Handle) method);
    hythread_suspend_disable();
    return f;
}
Exemplo n.º 2
0
static JIT_Result compile_prepare_native_method(Method* method)
{
    TRACE("compile_prepare_native_method (" << method->get_name()->bytes << ")");
#ifdef VM_STATS
    VM_Statistics::get_vm_stats().num_native_methods++;
#endif
    assert(method->is_native());

    GenericFunctionPointer func = classloader_find_native(method);

    if (!func)
        return JIT_FAILURE;

    // Calling callback for NativeMethodBind event
    jvmti_process_native_method_bind_event( (jmethodID) method, (NativeCodePtr)func, (NativeCodePtr*)&func);

    Class* cl = method->get_class();
    NativeStubOverride nso = nso_find_method_override(VM_Global_State::loader_env,
                                                    cl->get_name(), method->get_name(),
                                                    method->get_descriptor());

    NativeCodePtr stub = compile_create_jni_stub(method, func, nso);
    if (!stub)
        return JIT_FAILURE;

    method->lock();
    method->set_code_addr(stub);
    method->unlock();

    return JIT_SUCCESS;
} // compile_prepare_native_method