diff src/share/vm/graal/graalCompilerToVM.cpp @ 4443:6fb167f79df6

fixed methodDataOop access
author Christian Haeubl <christian.haeubl@oracle.com>
date Mon, 23 Jan 2012 15:02:58 -0800
parents dc6f6e2f1a00
children 7d9469b37f1f
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Mon Jan 23 13:37:40 2012 -0800
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Mon Jan 23 15:02:58 2012 -0800
@@ -182,13 +182,18 @@
   return getMethodFromHotSpotMethod(hotspot_method)->invocation_count();
 }
 
+// public native HotSpotMethodData RiMethod_methodData(HotSpotMethodResolved method);
 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1methodData(JNIEnv *, jobject, jobject hotspot_method) {
   TRACE_graal_3("CompilerToVM::RiMethod_methodData");
   VM_ENTRY_MARK;
 
   methodDataHandle method_data = getMethodFromHotSpotMethod(hotspot_method)->method_data();
-  Handle graalMethodData = GraalCompiler::createHotSpotMethodData(method_data, THREAD);
-  return JNIHandles::make_local(THREAD, graalMethodData());
+  if(method_data.is_null()) {
+    return NULL;
+  } else {
+    Handle graalMethodData = GraalCompiler::createHotSpotMethodData(method_data, THREAD);
+    return JNIHandles::make_local(THREAD, graalMethodData());
+  }
 }
 
 // ------------------------------------------------------------------
@@ -731,13 +736,13 @@
   set_int(env, config, "classMirrorOffset", klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes());
   
   set_int(env, config, "methodDataOopDataOffset", in_bytes(methodDataOopDesc::data_offset()));
-  set_int(env, config, "dataLayoutHeaderSize", DataLayout::header_size_in_bytes());
-  set_int(env, config, "dataLayoutTagOffset", in_bytes(DataLayout::tag_offset()));
-  set_int(env, config, "dataLayoutFlagsOffset", in_bytes(DataLayout::flags_offset()));
-  set_int(env, config, "dataLayoutBCIOffset", in_bytes(DataLayout::bci_offset()));
-  set_int(env, config, "dataLayoutCellsOffset", in_bytes(DataLayout::cell_offset(0)));
-  set_int(env, config, "dataLayoutCellSize", DataLayout::cell_size);
-  set_int(env, config, "bciProfileWidth", BciProfileWidth);
+  set_int(env, config, "dataLayoutHeaderSize", DataLayout::header_size_in_bytes());
+  set_int(env, config, "dataLayoutTagOffset", in_bytes(DataLayout::tag_offset()));
+  set_int(env, config, "dataLayoutFlagsOffset", in_bytes(DataLayout::flags_offset()));
+  set_int(env, config, "dataLayoutBCIOffset", in_bytes(DataLayout::bci_offset()));
+  set_int(env, config, "dataLayoutCellsOffset", in_bytes(DataLayout::cell_offset(0)));
+  set_int(env, config, "dataLayoutCellSize", DataLayout::cell_size);
+  set_int(env, config, "bciProfileWidth", BciProfileWidth);
   set_int(env, config, "typeProfileWidth", TypeProfileWidth);
 
   set_long(env, config, "debugStub", VmIds::addStub((address)warning));
@@ -898,7 +903,7 @@
 #define CONFIG          "Lcom/oracle/max/graal/hotspot/HotSpotVMConfig;"
 #define HS_METHOD       "Lcom/oracle/max/graal/hotspot/ri/HotSpotMethod;"
 #define HS_COMP_METHOD  "Lcom/oracle/max/graal/hotspot/ri/HotSpotCompiledMethod;"
-#define METHOD_DATA     "Lcom/oracle/max/graal/hotspot/HotSpotMethodData;"
+#define METHOD_DATA     "Lcom/oracle/max/graal/hotspot/ri/HotSpotMethodData;"
 #define CI_CONSTANT     "Lcom/oracle/max/cri/ci/CiConstant;"
 #define CI_KIND         "Lcom/oracle/max/cri/ci/CiKind;"
 #define CI_RUNTIME_CALL "Lcom/oracle/max/cri/ci/CiRuntimeCall;"
@@ -913,7 +918,7 @@
   {CC"RiMethod_hasBalancedMonitors",      CC"("RESOLVED_METHOD")Z",                   FN_PTR(RiMethod_1hasBalancedMonitors)},
   {CC"RiMethod_uniqueConcreteMethod",     CC"("RESOLVED_METHOD")"METHOD,              FN_PTR(RiMethod_1uniqueConcreteMethod)},
   {CC"getRiMethod",                       CC"("REFLECT_METHOD")"METHOD,               FN_PTR(getRiMethod)},
-  {CC"RiMethod_methodData",               CC"("RESOLVED_METHOD"I)"METHOD_DATA,        FN_PTR(RiMethod_1methodData)},
+  {CC"RiMethod_methodData",               CC"("RESOLVED_METHOD")"METHOD_DATA,         FN_PTR(RiMethod_1methodData)},
   {CC"RiMethod_invocationCount",          CC"("RESOLVED_METHOD")I",                   FN_PTR(RiMethod_1invocationCount)},
   {CC"RiMethod_hasCompiledCode",          CC"("RESOLVED_METHOD")Z",                   FN_PTR(RiMethod_1hasCompiledCode)},
   {CC"RiSignature_lookupType",            CC"("STRING RESOLVED_TYPE")"TYPE,           FN_PTR(RiSignature_1lookupType)},