Shark checkcast and instanceof improvements (part 1)

Gary Benson gbenson at redhat.com
Fri Jun 5 05:22:47 PDT 2009


Hi all,

This commit replaces the interpreter-style constant pool lookup of the
class to be checked against in the instanceof and checkcast bytecodes
with an inlined oop.

Cheers,
Gary

-- 
http://gbenson.net/
-------------- next part --------------
diff -r a2125c262913 ChangeLog
--- a/ChangeLog	Fri Jun 05 12:12:47 2009 +0100
+++ b/ChangeLog	Fri Jun 05 13:21:26 2009 +0100
@@ -1,3 +1,12 @@
+2009-06-05  Gary Benson  <gbenson at redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
+	(SharkTopLevelBlock::do_full_instance_check): Add class argument.
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+	(SharkTopLevelBlock::do_instance_check): Removed constant pool check.
+	(SharkTopLevelBlock::do_full_instance_check): Removed constant
+	pool lookup.
+
 2009-06-05  Gary Benson  <gbenson at redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
diff -r a2125c262913 ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Jun 05 12:12:47 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Jun 05 13:21:26 2009 +0100
@@ -1166,23 +1166,17 @@
 
 void SharkTopLevelBlock::do_instance_check()
 {
-  constantTag tag =
-    target()->holder()->constant_pool_tag_at(iter()->get_klass_index());
-  if (!tag.is_klass()) {
-    assert(tag.is_unresolved_klass(), "should be");
+  bool will_link;
+  ciKlass *klass = iter()->get_klass(will_link);
+
+  if (will_link)
+    do_full_instance_check(klass);
+  else
     do_trapping_instance_check();
-  }
-  else {
-    do_full_instance_check();
-  }
 }
 
-void SharkTopLevelBlock::do_full_instance_check()
+void SharkTopLevelBlock::do_full_instance_check(ciKlass* klass)
 { 
-  bool will_link;
-  ciKlass *klass = iter()->get_klass(will_link);
-  assert(will_link, "should do");
-
   BasicBlock *not_null      = function()->CreateBlock("not_null");
   BasicBlock *subtype_check = function()->CreateBlock("subtype_check");
   BasicBlock *is_instance   = function()->CreateBlock("is_instance");
@@ -1208,8 +1202,7 @@
 
   // Get the class we're checking against
   builder()->SetInsertPoint(not_null);
-  SharkConstantPool constants(this);
-  Value *check_klass = constants.object_at(iter()->get_klass_index());
+  Value *check_klass = builder()->CreateInlineOop(klass);
 
   // Get the class of the object being tested
   Value *object_klass = builder()->CreateValueOfStructEntry(
diff -r a2125c262913 ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Fri Jun 05 12:12:47 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Fri Jun 05 13:21:26 2009 +0100
@@ -386,7 +386,7 @@
 
   // checkcast and instanceof
  private:
-  void do_full_instance_check();
+  void do_full_instance_check(ciKlass* klass);
   void do_trapping_instance_check();
 
   void do_instance_check();


More information about the distro-pkg-dev mailing list