changeset in /hg/icedtea: 2009-06-06 Gary Benson <gbenson at redh...
Gary Benson
gbenson at redhat.com
Wed Jun 10 13:45:38 PDT 2009
changeset 8783e4b809e0 in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=8783e4b809e0
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 2493b242458e -r 8783e4b809e0 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 2493b242458e -r 8783e4b809e0 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 2493b242458e -r 8783e4b809e0 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