changeset 5839:58a607307306

renaming in native code for CiTargetMethod -> CompilationResult
author Doug Simon <doug.simon@oracle.com>
date Mon, 16 Jul 2012 15:18:38 +0200
parents 0095a9c235c6
children f565e8d4d200
files src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCodeInstaller.hpp src/share/vm/graal/graalCompilerToVM.cpp
diffstat 3 files changed, 26 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- 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");
   }
--- 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;
--- 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 {