# HG changeset patch # User Doug Simon # Date 1342444718 -7200 # Node ID 58a60730730694d89790628c423e4be01c129fe3 # Parent 0095a9c235c672c56607760505d646a78a64ded6 renaming in native code for CiTargetMethod -> CompilationResult diff -r 0095a9c235c6 -r 58a607307306 src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Sat Jul 14 21:38:19 2012 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Mon Jul 16 15:18:38 2012 +0200 @@ -273,22 +273,22 @@ } // constructor used to create a method -CodeInstaller::CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code) { +CodeInstaller::CodeInstaller(Handle& comp_result, nmethod*& nm, bool install_code) { _env = CURRENT_ENV; GraalCompiler::initialize_buffer_blob(); CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); - jobject target_method_obj = JNIHandles::make_local(target_method()); - initialize_assumptions(JNIHandles::resolve(target_method_obj)); + jobject comp_result_obj = JNIHandles::make_local(comp_result()); + initialize_assumptions(JNIHandles::resolve(comp_result_obj)); { No_Safepoint_Verifier no_safepoint; - initialize_fields(JNIHandles::resolve(target_method_obj)); + initialize_fields(JNIHandles::resolve(comp_result_obj)); initialize_buffer(buffer); process_exception_handlers(); } int stack_slots = _total_frame_size / HeapWordSize; // conversion to words - methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(JNIHandles::resolve(target_method_obj))); + methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(JNIHandles::resolve(comp_result_obj))); nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, true, false, install_code); @@ -317,22 +317,23 @@ id = VmIds::addStub(blob->code_begin()); } -void CodeInstaller::initialize_fields(oop target_method) { - _citarget_method = HotSpotCompilationResult::comp(target_method); - _hotspot_method = HotSpotCompilationResult::method(target_method); +void CodeInstaller::initialize_fields(oop comp_result) { + _comp_result = HotSpotCompilationResult::comp(comp_result); + _hotspot_method = HotSpotCompilationResult::method(comp_result); if (_hotspot_method != NULL) { - _parameter_count = getMethodFromHotSpotMethod(_hotspot_method)->size_of_parameters(); + methodOop method = getMethodFromHotSpotMethod(_hotspot_method); + _parameter_count = method->size_of_parameters(); + TRACE_graal_1("installing code for %s", method->name_and_sig_as_C_string()); } - _name = HotSpotCompilationResult::name(target_method); - _sites = (arrayOop) HotSpotCompilationResult::sites(target_method); - _exception_handlers = (arrayOop) HotSpotCompilationResult::exceptionHandlers(target_method); + _name = HotSpotCompilationResult::name(comp_result); + _sites = (arrayOop) HotSpotCompilationResult::sites(comp_result); + _exception_handlers = (arrayOop) HotSpotCompilationResult::exceptionHandlers(comp_result); - _code = (arrayOop) InstalledCode::targetCode(_citarget_method); - _code_size = InstalledCode::targetCodeSize(_citarget_method); + _code = (arrayOop) InstalledCode::targetCode(_comp_result); + _code_size = InstalledCode::targetCodeSize(_comp_result); // The frame size we get from the target method does not include the return address, so add one word for it here. - _total_frame_size = InstalledCode::frameSize(_citarget_method) + HeapWordSize; - _custom_stack_area_offset = InstalledCode::customStackAreaOffset(_citarget_method); - + _total_frame_size = InstalledCode::frameSize(_comp_result) + HeapWordSize; + _custom_stack_area_offset = InstalledCode::customStackAreaOffset(_comp_result); // (very) conservative estimate: each site needs a constant section entry _constants_size = _sites->length() * (BytesPerLong*2); @@ -627,11 +628,12 @@ assert((call[0] == 0x40 || call[0] == 0x41) && call[1] == 0xFF, "expected call with rex/rexb prefix byte"); next_pc_offset += 3; /* prefix byte + opcode byte + modrm byte */ } else if (inst->is_call_reg()) { - // the inlined vtable stub contains a "call register" instruction, which isn't recognized here + // the inlined vtable stub contains a "call register" instruction assert(hotspot_method != NULL, "only valid for virtual calls"); is_call_reg = true; - next_pc_offset = pc_offset + NativeCallReg::instruction_size; + next_pc_offset = pc_offset + ((NativeCallReg *) inst)->next_instruction_offset(); } else { + tty->print_cr("at pc_offset %d", pc_offset); runtime_call->print(); fatal("unsupported type of instruction for call site"); } diff -r 0095a9c235c6 -r 58a607307306 src/share/vm/graal/graalCodeInstaller.hpp --- a/src/share/vm/graal/graalCodeInstaller.hpp Sat Jul 14 21:38:19 2012 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.hpp Mon Jul 16 15:18:38 2012 +0200 @@ -56,7 +56,7 @@ ciEnv* _env; - oop _citarget_method; + oop _comp_result; oop _hotspot_method; oop _name; arrayOop _sites; diff -r 0095a9c235c6 -r 58a607307306 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Sat Jul 14 21:38:19 2012 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Mon Jul 16 15:18:38 2012 +0200 @@ -876,15 +876,15 @@ } // public HotSpotCompiledMethod installMethod(HotSpotCompilationResult comp, boolean installCode); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installMethod(JNIEnv *jniEnv, jobject, jobject comp, jboolean install_code, jobject info) { +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installMethod(JNIEnv *jniEnv, jobject, jobject compResult, jboolean install_code, jobject info) { VM_ENTRY_MARK; ResourceMark rm; HandleMark hm; - Handle targetMethodHandle = JNIHandles::resolve(comp); + Handle compResultHandle = JNIHandles::resolve(compResult); nmethod* nm = NULL; Arena arena; ciEnv env(&arena); - CodeInstaller installer(targetMethodHandle, nm, install_code != 0); + CodeInstaller installer(compResultHandle, nm, install_code != 0); if (info != NULL) { arrayOop codeCopy = oopFactory::new_byteArray(nm->code_size(), CHECK_0); @@ -899,7 +899,7 @@ Handle obj = instanceKlass::cast(HotSpotCompiledMethod::klass())->allocate_permanent_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); HotSpotCompiledMethod::set_nmethod(obj, (jlong) nm); - HotSpotCompiledMethod::set_method(obj, HotSpotCompilationResult::method(comp)); + HotSpotCompiledMethod::set_method(obj, HotSpotCompilationResult::method(compResult)); nm->set_graal_compiled_method(obj()); return JNIHandles::make_local(obj()); } else {