changeset in /hg/icedtea6: 2009-06-06 Gary Benson <gbenson at red...

Gary Benson gbenson at redhat.com
Fri Jun 5 06:45:09 PDT 2009


changeset 2f2bbe3b693d in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=2f2bbe3b693d
description:
	2009-06-06  Gary Benson  <gbenson at redhat.com>

		* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
		(SharkTopLevelBlock::do_optimized_instance_check): New method.
		(SharkTopLevelBlock::do_full_instance_check): Add class argument.
		* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
		(SharkTopLevelBlock::do_instance_check): Add compile time type
		checks.
		(SharkTopLevelBlock::do_optimized_instance_check): New method.
		(SharkTopLevelBlock::do_trapping_instance_check): Update the
		object with the new class if its a checkcast that passes.

diffstat:

3 files changed, 65 insertions(+), 9 deletions(-)
ChangeLog                                               |   12 +++
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp |   59 ++++++++++++---
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp |    3 

diffs (119 lines):

diff -r 26ddf03b22c3 -r 2f2bbe3b693d ChangeLog
--- a/ChangeLog	Fri Jun 05 08:17:22 2009 -0400
+++ b/ChangeLog	Fri Jun 05 14:46:31 2009 +0100
@@ -1,3 +1,15 @@ 2009-06-05  Gary Benson  <gbenson at redhat
+2009-06-06  Gary Benson  <gbenson at redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
+	(SharkTopLevelBlock::do_optimized_instance_check): New method.
+	(SharkTopLevelBlock::do_full_instance_check): Add class argument.	
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+	(SharkTopLevelBlock::do_instance_check): Add compile time type
+	checks.
+	(SharkTopLevelBlock::do_optimized_instance_check): New method.
+	(SharkTopLevelBlock::do_trapping_instance_check): Update the
+	object with the new class if its a checkcast that passes.
+
 2009-06-05  Gary Benson  <gbenson at redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
diff -r 26ddf03b22c3 -r 2f2bbe3b693d ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Jun 05 08:17:22 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Jun 05 14:46:31 2009 +0100
@@ -1166,15 +1166,55 @@ void SharkTopLevelBlock::do_call()
 
 void SharkTopLevelBlock::do_instance_check()
 {
+  // Get the class we're checking against
   bool will_link;
-  ciKlass *klass = iter()->get_klass(will_link);
-
+  ciKlass *check_klass = iter()->get_klass(will_link);
+
+  // If the class we're checking against is java.lang.Object
+  // then this is a no brainer.  Apparently this can happen
+  // in reflective code...
+  if (check_klass == function()->env()->Object_klass()) {
+    do_optimized_instance_check();
+    return;
+  }
+  
+  // Get the class of the object we're checking
+  ciKlass *object_klass = xstack(0)->type()->as_klass();
+
+  // If the classes are defined enough now then we
+  // don't need a runtime check.  NB opto's code for
+  // this (GraphKit::static_subtype_check) says we
+  // cannot trust static interface types yet, hence
+  // the extra check
+  if (!object_klass->is_interface()) {
+    if (object_klass == check_klass) {
+      do_optimized_instance_check();
+      return;
+    }
+
+    if (object_klass->is_loaded() && check_klass->is_loaded()) {
+      if (object_klass->is_subtype_of(check_klass)) {
+        do_optimized_instance_check();
+        return;
+      }
+    }
+  }
+
+  // Need to check this one at runtime
   if (will_link)
-    do_full_instance_check(klass);
+    do_full_instance_check(check_klass);
   else
-    do_trapping_instance_check();
-}
-
+    do_trapping_instance_check(check_klass);
+}
+                
+void SharkTopLevelBlock::do_optimized_instance_check()
+{
+  if (bc() == Bytecodes::_instanceof) {
+    pop();
+    push(SharkValue::jint_constant(1));
+  }
+}
+    
 void SharkTopLevelBlock::do_full_instance_check(ciKlass* klass)
 { 
   BasicBlock *not_null      = function()->CreateBlock("not_null");
@@ -1275,7 +1315,7 @@ void SharkTopLevelBlock::do_full_instanc
   }
 }
 
-void SharkTopLevelBlock::do_trapping_instance_check()
+void SharkTopLevelBlock::do_trapping_instance_check(ciKlass* klass)
 {
   BasicBlock *not_null = function()->CreateBlock("not_null");
   BasicBlock *is_null  = function()->CreateBlock("null");
@@ -1297,7 +1337,10 @@ void SharkTopLevelBlock::do_trapping_ins
   // If it's null then we're ok
   builder()->SetInsertPoint(is_null);
   set_current_state(saved_state);
-  if (bc() == Bytecodes::_instanceof) {
+  if (bc() == Bytecodes::_checkcast) {
+    push(SharkValue::create_generic(klass, pop()->jobject_value(), false));    
+  }
+  else {
     pop();
     push(SharkValue::jint_constant(0));
   }
diff -r 26ddf03b22c3 -r 2f2bbe3b693d ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Fri Jun 05 08:17:22 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Fri Jun 05 14:46:31 2009 +0100
@@ -386,8 +386,9 @@ class SharkTopLevelBlock : public SharkB
 
   // checkcast and instanceof
  private:
+  void do_optimized_instance_check();
   void do_full_instance_check(ciKlass* klass);
-  void do_trapping_instance_check();
+  void do_trapping_instance_check(ciKlass* klass);
 
   void do_instance_check();
 



More information about the distro-pkg-dev mailing list