changeset 2199:7195e112b39f

Fix bugs preventing Shark building itself 2010-03-11 Gary Benson <gbenson@redhat.com> * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::compile_method): Catch typeflow failures more generally. * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp (SharkTopLevelBlock::scan_for_traps): New trap. (SharkTopLevelBlock::do_call): Add assertion to check the above. (SharkTopLevelBlock::static_subtype_check): Deal with unloaded object_klass.
author Gary Benson <gbenson@redhat.com>
date Thu, 11 Mar 2010 16:35:10 -0500
parents 693114a512ea
children 53d08a835f60
files ChangeLog ports/hotspot/src/share/vm/shark/sharkCompiler.cpp ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
diffstat 3 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 01 17:44:01 2010 +0100
+++ b/ChangeLog	Thu Mar 11 16:35:10 2010 -0500
@@ -1,3 +1,14 @@
+2010-03-11  Gary Benson  <gbenson@redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
+	(SharkCompiler::compile_method): Catch typeflow failures more
+	generally.
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+	(SharkTopLevelBlock::scan_for_traps): New trap.
+	(SharkTopLevelBlock::do_call): Add assertion to check the above.
+	(SharkTopLevelBlock::static_subtype_check): Deal with unloaded
+	object_klass.
+
 2010-03-11  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp:
--- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp	Tue Jun 01 17:44:01 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp	Thu Mar 11 16:35:10 2010 -0500
@@ -137,7 +137,7 @@
     flow = target->get_flow_analysis();
   else
     flow = target->get_osr_flow_analysis(entry_bci);
-  if (env->failing())
+  if (flow->failing())
     return;
   if (SharkPrintTypeflowOf != NULL) {
     if (!fnmatch(SharkPrintTypeflowOf, name, 0))
@@ -259,7 +259,7 @@
         llvm::SetCurrentDebugType("");
         llvm::DebugFlag = false;
       }
-#endif
+#endif // !NDEBUG
 #else
       // NB you need to patch LLVM with http://tinyurl.com/yf3baln for this
       std::vector<const char*> args;
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Tue Jun 01 17:44:01 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Thu Mar 11 16:35:10 2010 -0500
@@ -88,6 +88,18 @@
             Deoptimization::Action_reinterpret), bci());
           return;
       }
+
+      if (bc() == Bytecodes::_invokevirtual) {
+        klass = ciEnv::get_instance_klass_for_declared_method_holder(
+          iter()->get_declared_method_holder());
+        if (!klass->is_linked()) {
+          set_trap(
+            Deoptimization::make_trap_request(
+              Deoptimization::Reason_uninitialized,
+              Deoptimization::Action_reinterpret), bci());
+            return;
+        }
+      }
       break;
 
     case Bytecodes::_new:
@@ -1099,6 +1111,7 @@
   Value *callee;
   if (call_is_virtual) {
     if (is_virtual) {
+      assert(klass->is_linked(), "scan_for_traps responsibility");
       int vtable_index = call_method->resolve_vtable_index(
         target()->holder(), klass);
       assert(vtable_index >= 0, "should be");
@@ -1153,14 +1166,12 @@
   // (GraphKit::static_subtype_check) it says that static
   // interface types cannot be trusted, and if opto can't
   // trust them then I assume we can't either.
-  if (!object_klass->is_interface()) {
+  if (object_klass->is_loaded() && !object_klass->is_interface()) {
     if (object_klass == check_klass)
       return true;
 
-    if (object_klass->is_loaded() && check_klass->is_loaded()) {
-      if (object_klass->is_subtype_of(check_klass))
-        return true;
-    }
+    if (check_klass->is_loaded() && object_klass->is_subtype_of(check_klass))
+      return true;
   }
 
   return false;