< prev index next >

src/share/vm/jvmci/jvmciCompilerToVM.cpp

Print this page

        

*** 74,85 **** return (oop)result.get_jobject(); } return NULL; } ! oop CompilerToVM::get_jvmci_type(KlassHandle klass, TRAPS) { ! if (klass() != NULL) { JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(Handle(THREAD, klass->java_mirror())); JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL); --- 74,85 ---- return (oop)result.get_jobject(); } return NULL; } ! oop CompilerToVM::get_jvmci_type(Klass* klass, TRAPS) { ! if (klass != NULL) { JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(Handle(THREAD, klass->java_mirror())); JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL);
*** 537,547 **** JavaCalls::call_static(&method_result, SystemDictionary::HotSpotConstantPool_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::constantPool_fromMetaspace_signature(), &args, CHECK_NULL); return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject()); } C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlong offset, jboolean compressed)) ! KlassHandle klass; oop base_object = JNIHandles::resolve(base); jlong base_address = 0; if (base_object != NULL && offset == oopDesc::klass_offset_in_bytes()) { klass = base_object->klass(); } else if (!compressed) { --- 537,547 ---- JavaCalls::call_static(&method_result, SystemDictionary::HotSpotConstantPool_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::constantPool_fromMetaspace_signature(), &args, CHECK_NULL); return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject()); } C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlong offset, jboolean compressed)) ! Klass* klass = NULL; oop base_object = JNIHandles::resolve(base); jlong base_address = 0; if (base_object != NULL && offset == oopDesc::klass_offset_in_bytes()) { klass = base_object->klass(); } else if (!compressed) {
*** 562,588 **** klass = *((Klass**) (intptr_t) (base_address + offset)); } else { THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); } ! assert (klass.is_null() || klass->is_klass(), "invalid read"); oop result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); return JNIHandles::make_local(THREAD, result); } C2V_VMENTRY(jobject, findUniqueConcreteMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) ResourceMark rm; methodHandle method = CompilerToVM::asMethod(jvmci_method); ! KlassHandle holder = CompilerToVM::asKlass(jvmci_type); if (holder->is_interface()) { THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", holder->external_name())); } methodHandle ucm; { MutexLocker locker(Compile_lock); ! ucm = Dependencies::find_unique_concrete_method(holder(), method()); } oop result = CompilerToVM::get_jvmci_method(ucm, CHECK_NULL); return JNIHandles::make_local(THREAD, result); C2V_END --- 562,588 ---- klass = *((Klass**) (intptr_t) (base_address + offset)); } else { THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); } ! assert (klass == NULL || klass->is_klass(), "invalid read"); oop result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); return JNIHandles::make_local(THREAD, result); } C2V_VMENTRY(jobject, findUniqueConcreteMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) ResourceMark rm; methodHandle method = CompilerToVM::asMethod(jvmci_method); ! Klass* holder = CompilerToVM::asKlass(jvmci_type); if (holder->is_interface()) { THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", holder->external_name())); } methodHandle ucm; { MutexLocker locker(Compile_lock); ! ucm = Dependencies::find_unique_concrete_method(holder, method()); } oop result = CompilerToVM::get_jvmci_method(ucm, CHECK_NULL); return JNIHandles::make_local(THREAD, result); C2V_END
*** 709,727 **** return JNIHandles::make_local(THREAD, klass); C2V_END C2V_VMENTRY(jobject, lookupKlassInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); ! KlassHandle loading_klass(cp->pool_holder()); bool is_accessible = false; ! KlassHandle klass = JVMCIEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); Symbol* symbol = NULL; ! if (klass.is_null()) { symbol = cp->klass_name_at(index); } oop result_oop; ! if (!klass.is_null()) { result_oop = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); } else { Handle result = java_lang_String::create_from_symbol(symbol, CHECK_NULL); result_oop = result(); } --- 709,727 ---- return JNIHandles::make_local(THREAD, klass); C2V_END C2V_VMENTRY(jobject, lookupKlassInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); ! Klass* loading_klass = cp->pool_holder(); bool is_accessible = false; ! Klass* klass = JVMCIEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); Symbol* symbol = NULL; ! if (klass == NULL) { symbol = cp->klass_name_at(index); } oop result_oop; ! if (klass != NULL) { result_oop = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); } else { Handle result = java_lang_String::create_from_symbol(symbol, CHECK_NULL); result_oop = result(); }
*** 734,744 **** return JNIHandles::make_local(THREAD, appendix_oop); C2V_END C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); ! instanceKlassHandle pool_holder(cp->pool_holder()); Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); methodHandle method = JVMCIEnv::get_method_by_index(cp, index, bc, pool_holder); oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); return JNIHandles::make_local(THREAD, result); C2V_END --- 734,744 ---- return JNIHandles::make_local(THREAD, appendix_oop); C2V_END C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); ! InstanceKlass* pool_holder = cp->pool_holder(); Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); methodHandle method = JVMCIEnv::get_method_by_index(cp, index, bc, pool_holder); oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); return JNIHandles::make_local(THREAD, result); C2V_END
*** 778,807 **** } return LinkResolver::vtable_index_of_interface_method(klass, method); C2V_END C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type)) ! KlassHandle recv_klass = CompilerToVM::asKlass(receiver_jvmci_type); ! KlassHandle caller_klass = CompilerToVM::asKlass(caller_jvmci_type); methodHandle method = CompilerToVM::asMethod(jvmci_method); ! KlassHandle h_resolved (THREAD, method->method_holder()); Symbol* h_name = method->name(); Symbol* h_signature = method->signature(); if (MethodHandles::is_signature_polymorphic_method(method())) { // Signature polymorphic methods are already resolved, JVMCI just returns NULL in this case. return NULL; } ! LinkInfo link_info(h_resolved, h_name, h_signature, caller_klass); methodHandle m; // Only do exact lookup if receiver klass has been linked. Otherwise, // the vtable has not been setup, and the LinkResolver will fail. if (recv_klass->is_array_klass() || ! InstanceKlass::cast(recv_klass())->is_linked() && !recv_klass->is_interface()) { ! if (h_resolved->is_interface()) { m = LinkResolver::resolve_interface_call_or_null(recv_klass, link_info); } else { m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info); } } --- 778,807 ---- } return LinkResolver::vtable_index_of_interface_method(klass, method); C2V_END C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type)) ! Klass* recv_klass = CompilerToVM::asKlass(receiver_jvmci_type); ! Klass* caller_klass = CompilerToVM::asKlass(caller_jvmci_type); methodHandle method = CompilerToVM::asMethod(jvmci_method); ! Klass* resolved = method->method_holder(); Symbol* h_name = method->name(); Symbol* h_signature = method->signature(); if (MethodHandles::is_signature_polymorphic_method(method())) { // Signature polymorphic methods are already resolved, JVMCI just returns NULL in this case. return NULL; } ! LinkInfo link_info(resolved, h_name, h_signature, caller_klass); methodHandle m; // Only do exact lookup if receiver klass has been linked. Otherwise, // the vtable has not been setup, and the LinkResolver will fail. if (recv_klass->is_array_klass() || ! InstanceKlass::cast(recv_klass)->is_linked() && !recv_klass->is_interface()) { ! if (resolved->is_interface()) { m = LinkResolver::resolve_interface_call_or_null(recv_klass, link_info); } else { m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info); } }
*** 1340,1355 **** cp_cache_entry->set_dynamic_call(cp, callInfo); C2V_END C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); ! KlassHandle holder = cp->klass_ref_at(index, CHECK); Symbol* name = cp->name_ref_at(index); ! if (MethodHandles::is_signature_polymorphic_name(holder(), name)) { CallInfo callInfo; LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK); ! ConstantPoolCacheEntry* cp_cache_entry = cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index)); cp_cache_entry->set_method_handle(cp, callInfo); } C2V_END C2V_VMENTRY(jobject, getSignaturePolymorphicHolders, (JNIEnv*, jobject)) --- 1340,1355 ---- cp_cache_entry->set_dynamic_call(cp, callInfo); C2V_END C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); ! Klass* holder = cp->klass_ref_at(index, CHECK); Symbol* name = cp->name_ref_at(index); ! if (MethodHandles::is_signature_polymorphic_name(holder, name)) { CallInfo callInfo; LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK); ! ConstantPoolCacheEntry* cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index)); cp_cache_entry->set_method_handle(cp, callInfo); } C2V_END C2V_VMENTRY(jobject, getSignaturePolymorphicHolders, (JNIEnv*, jobject))
< prev index next >