changeset 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
files graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HOTSPOTPROFILINGINFOIMPL.JAVA make/windows/makefiles/projectcreator.make src/share/vm/classfile/systemDictionary.hpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalCompilerToVM.cpp
diffstat 6 files changed, 42 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HOTSPOTPROFILINGINFOIMPL.JAVA	Mon Jan 23 13:37:40 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HOTSPOTPROFILINGINFOIMPL.JAVA	Mon Jan 23 15:02:58 2012 -0800
@@ -79,30 +79,31 @@
 
     private void findBCI(int targetBCI) {
         assert targetBCI >= 0 : "invalid BCI";
-
-        if (methodData.hasNormalData()) {
-            int currentPosition = targetBCI < hintBCI ? 0 : hintPosition;
-            HotSpotMethodDataAccessor currentAccessor;
-            while ((currentAccessor = methodData.getNormalData(currentPosition)) != null) {
-                int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
-                if (currentBCI == targetBCI) {
-                    normalDataFound(currentAccessor, currentPosition, currentBCI);
-                    return;
-                } else if (currentBCI > targetBCI) {
-                    break;
+        if (methodData != null) {
+            if (methodData.hasNormalData()) {
+                int currentPosition = targetBCI < hintBCI ? 0 : hintPosition;
+                HotSpotMethodDataAccessor currentAccessor;
+                while ((currentAccessor = methodData.getNormalData(currentPosition)) != null) {
+                    int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
+                    if (currentBCI == targetBCI) {
+                        normalDataFound(currentAccessor, currentPosition, currentBCI);
+                        return;
+                    } else if (currentBCI > targetBCI) {
+                        break;
+                    }
+                    currentAccessor = methodData.getNormalData(currentPosition);
                 }
-                currentAccessor = methodData.getNormalData(currentPosition);
             }
-        }
 
-        if (methodData.hasExtraData()) {
-            int currentPosition = 0;
-            HotSpotMethodDataAccessor currentAccessor;
-            while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
-                int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
-                if (currentBCI == targetBCI) {
-                    extraDataFound(currentAccessor, currentPosition);
-                    return;
+            if (methodData.hasExtraData()) {
+                int currentPosition = 0;
+                HotSpotMethodDataAccessor currentAccessor;
+                while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
+                    int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
+                    if (currentBCI == targetBCI) {
+                        extraDataFound(currentAccessor, currentPosition);
+                        return;
+                    }
                 }
             }
         }
--- a/make/windows/makefiles/projectcreator.make	Mon Jan 23 13:37:40 2012 -0800
+++ b/make/windows/makefiles/projectcreator.make	Mon Jan 23 15:02:58 2012 -0800
@@ -89,7 +89,7 @@
         -define ALIGN_STACK_FRAMES \
         -define VM_LITTLE_ENDIAN \
         -prelink  "" "Generating vm.def..." "cd %o	set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME)	$(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LINK_VER)" \
-        -postbuild "" "Building hotspot.exe..." "cd %o	HOTSPOTMKSHOME=$(HOTSPOTMKSHOME)	nmake -f $(HOTSPOTWORKSPACE)\make\windows\projectfiles\common\Makefile LOCAL_MAKE=$(HOTSPOTBUILDSPACE)\%f\local.make JAVA_HOME=$(HOTSPOTJDKDIST) launcher" \
+        -postbuild "" "Building hotspot.exe..." "cd %o	set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME)	nmake -f $(HOTSPOTWORKSPACE)\make\windows\projectfiles\common\Makefile LOCAL_MAKE=$(HOTSPOTBUILDSPACE)\%f\local.make JAVA_HOME=$(HOTSPOTJDKDIST) launcher" \
         -ignoreFile jsig.c \
         -ignoreFile jvmtiEnvRecommended.cpp \
         -ignoreFile jvmtiEnvStub.cpp \
--- a/src/share/vm/classfile/systemDictionary.hpp	Mon Jan 23 13:37:40 2012 -0800
+++ b/src/share/vm/classfile/systemDictionary.hpp	Mon Jan 23 15:02:58 2012 -0800
@@ -193,7 +193,7 @@
   template(HotSpotField_klass,                    com_oracle_max_graal_hotspot_HotSpotField,                        Opt) \
   template(HotSpotCompiledMethod_klass,           com_oracle_max_graal_hotspot_HotSpotCompiledMethod,               Opt) \
   template(HotSpotMethodResolved_klass,           com_oracle_max_graal_hotspot_ri_HotSpotMethodResolved,            Opt) \
-  template(HotSpotMethodData_klass,               com_oracle_max_graal_hotspot_HotSpotMethodData,                   Opt) \
+  template(HotSpotMethodData_klass,               com_oracle_max_graal_hotspot_ri_HotSpotMethodData,                Opt) \
   template(HotSpotTargetMethod_klass,             com_oracle_max_graal_hotspot_HotSpotTargetMethod,                 Opt) \
   template(HotSpotExceptionHandler_klass,         com_oracle_max_graal_hotspot_HotSpotExceptionHandler,             Opt) \
   template(HotSpotProxy_klass,                    com_oracle_max_graal_hotspot_HotSpotProxy,                        Opt) \
@@ -224,7 +224,6 @@
   template(RiType_klass,                          com_oracle_max_cri_ri_RiType,                                     Opt) \
   template(RiResolvedField_klass,                 com_oracle_max_cri_ri_RiResolvedField,                            Opt) \
   template(RiExceptionHandler_klass,              com_oracle_max_cri_ri_RiExceptionHandler,                         Opt) \
-  template(RiProfilingInfo_klass,                 com_oracle_max_cri_ri_RiProfilingInfo,                            Opt) \
 
   /*end*/
 
--- a/src/share/vm/classfile/vmSymbols.hpp	Mon Jan 23 13:37:40 2012 -0800
+++ b/src/share/vm/classfile/vmSymbols.hpp	Mon Jan 23 15:02:58 2012 -0800
@@ -272,7 +272,7 @@
   template(com_oracle_max_graal_hotspot_bridge_VMToCompiler,          "com/oracle/max/graal/hotspot/bridge/VMToCompiler")                 \
   template(com_oracle_max_graal_hotspot_ri_HotSpotMethodResolved,     "com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl")        \
   template(com_oracle_max_graal_hotspot_HotSpotTargetMethod,          "com/oracle/max/graal/hotspot/HotSpotTargetMethod")                 \
-  template(com_oracle_max_graal_hotspot_HotSpotMethodData,            "com/oracle/max/graal/hotspot/HotSpotMethodData")                   \
+  template(com_oracle_max_graal_hotspot_ri_HotSpotMethodData,         "com/oracle/max/graal/hotspot/ri/HotSpotMethodData")                \
   template(com_oracle_max_graal_hotspot_HotSpotField,                 "com/oracle/max/graal/hotspot/ri/HotSpotField")                     \
   template(com_oracle_max_graal_hotspot_HotSpotCompiledMethod,        "com/oracle/max/graal/hotspot/ri/HotSpotCompiledMethod")            \
   template(com_oracle_max_graal_hotspot_HotSpotOptions,               "com/oracle/max/graal/hotspot/HotSpotOptions")                      \
@@ -285,7 +285,6 @@
   template(com_oracle_max_cri_ri_RiMethod,                            "com/oracle/max/cri/ri/RiMethod")                                   \
   template(com_oracle_max_cri_ri_RiResolvedField,                     "com/oracle/max/cri/ri/RiResolvedField")                            \
   template(com_oracle_max_cri_ri_RiType,                              "com/oracle/max/cri/ri/RiType")                                     \
-  template(com_oracle_max_cri_ri_RiProfilingInfo,                     "com/oracle/max/cri/ri/RiProfilingInfo")                            \
   template(com_oracle_max_cri_ri_RiConstantPool,                      "com/oracle/max/cri/ri/RiConstantPool")                             \
   template(com_oracle_max_cri_ri_RiExceptionHandler,                  "com/oracle/max/cri/ri/RiExceptionHandler")                         \
   template(com_oracle_max_cri_ci_CiAssumptions,                       "com/oracle/max/cri/ci/CiAssumptions")                              \
--- a/src/share/vm/graal/graalCompiler.cpp	Mon Jan 23 13:37:40 2012 -0800
+++ b/src/share/vm/graal/graalCompiler.cpp	Mon Jan 23 15:02:58 2012 -0800
@@ -284,7 +284,7 @@
 
   instanceKlass::cast(HotSpotMethodData::klass())->initialize(CHECK_NULL);
   Handle obj = instanceKlass::cast(HotSpotMethodData::klass())->allocate_instance(CHECK_NULL);
-  assert(obj.not_null, "must be");
+  assert(obj.not_null(), "must succeed in allocating instance");
   
   HotSpotMethodData::set_compiler(obj, VMToCompiler::compilerInstance()());
   HotSpotMethodData::set_javaMirror(obj, method_data());
--- 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)},