Shark invokeinterface improvements (part 2)
Gary Benson
gbenson at redhat.com
Tue Jun 9 04:09:11 PDT 2009
Hi all,
This commit replaces the interpreter-style constant pool lookup
of the method and itable index with compile time lookups.
Cheers,
Gary
--
http://gbenson.net/
-------------- next part --------------
diff -r 0be8e3334758 -r d55dfba8404f ChangeLog
--- a/ChangeLog Mon Jun 08 14:26:32 2009 -0400
+++ b/ChangeLog Tue Jun 09 06:22:07 2009 -0400
@@ -1,3 +1,18 @@
+2009-06-09 Gary Benson <gbenson at redhat.com>
+
+ * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
+ (SharkTopLevelBlock::get_interface_callee): New argument.
+ * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+ (SharkTopLevelBlock::scan_for_traps): Update traps for
+ invokeinterface.
+ (SharkTopLevelBlock::get_callee): Pass method to
+ get_interface_callee.
+ (SharkTopLevelBlock::get_interface_callee): Removed constant
+ pool lookup.
+
+ * patches/hotspot/default/icedtea-shark.patch
+ (ciMethod::itable_index): New method.
+
2009-06-08 Omair Majid <omajid at redhat.com>
* Makefile.am
diff -r 0be8e3334758 -r d55dfba8404f ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Mon Jun 08 14:26:32 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Tue Jun 09 06:22:07 2009 -0400
@@ -107,8 +107,14 @@
if (method->holder() == function()->env()->Object_klass())
Unimplemented();
- // Continue to the check
- index = iter()->get_method_index();
+ // Bail out if the holder is unloaded
+ if (!method->holder()->is_linked()) {
+ set_trap(
+ Deoptimization::make_trap_request(
+ Deoptimization::Reason_uninitialized,
+ Deoptimization::Action_reinterpret), bci());
+ return;
+ }
break;
case Bytecodes::_new:
@@ -873,7 +879,7 @@
case CALL_VIRTUAL:
return get_virtual_callee(receiver, method);
case CALL_INTERFACE:
- return get_interface_callee(receiver);
+ return get_interface_callee(receiver, method);
default:
ShouldNotReachHere();
}
@@ -911,11 +917,9 @@
}
// Interface calls are handled here
-Value* SharkTopLevelBlock::get_interface_callee(SharkValue *receiver)
+Value* SharkTopLevelBlock::get_interface_callee(SharkValue *receiver,
+ ciMethod* method)
{
- SharkConstantPool constants(this);
- Value *cache = constants.cache_entry_at(iter()->get_method_index());
-
BasicBlock *loop = function()->CreateBlock("loop");
BasicBlock *got_null = function()->CreateBlock("got_null");
BasicBlock *not_null = function()->CreateBlock("not_null");
@@ -955,11 +959,7 @@
itable_start, BytesPerLong, itable_start_name);
// Locate this interface's entry in the table
- Value *iklass = builder()->CreateValueOfStructEntry(
- cache, ConstantPoolCacheEntry::f1_offset(),
- SharkType::jobject_type(),
- "iklass");
-
+ Value *iklass = builder()->CreateInlineOop(method->holder());
BasicBlock *loop_entry = builder()->GetInsertBlock();
builder()->CreateBr(loop);
builder()->SetInsertPoint(loop);
@@ -1009,11 +1009,6 @@
offset =
builder()->CreateIntCast(offset, SharkType::intptr_type(), false);
- Value *index = builder()->CreateValueOfStructEntry(
- cache, ConstantPoolCacheEntry::f2_offset(),
- SharkType::intptr_type(),
- "index");
-
return builder()->CreateLoad(
builder()->CreateIntToPtr(
builder()->CreateAdd(
@@ -1022,10 +1017,8 @@
builder()->CreatePtrToInt(
object_klass, SharkType::intptr_type()),
offset),
- builder()->CreateShl(
- index,
- LLVMValue::intptr_constant(
- exact_log2(itableMethodEntry::size() * wordSize)))),
+ LLVMValue::intptr_constant(
+ method->itable_index() * itableMethodEntry::size() * wordSize)),
LLVMValue::intptr_constant(
itableMethodEntry::method_offset_in_bytes())),
PointerType::getUnqual(SharkType::methodOop_type())),
diff -r 0be8e3334758 -r d55dfba8404f ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp Mon Jun 08 14:26:32 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp Tue Jun 09 06:22:07 2009 -0400
@@ -383,7 +383,7 @@
llvm::Value* get_direct_callee(ciMethod* method);
llvm::Value* get_virtual_callee(SharkValue* receiver, ciMethod* method);
- llvm::Value* get_interface_callee(SharkValue* receiver);
+ llvm::Value* get_interface_callee(SharkValue* receiver, ciMethod* method);
void do_call();
More information about the zero-dev
mailing list