Mercurial > hg > release > icedtea6-1.5
changeset 1480:6123e2454ad9
2009-04-28 Gary Benson <gbenson@redhat.com>
* patches/hotspot/default/icedtea-shark.patch
(ciInstanceKlass::constant_pool_tag_at): New method.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
(SharkTopLevelBlock::do_full_instance_check): New method.
(SharkTopLevelBlock::do_trapping_instance_check): Likewise.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
(SharkTopLevelBlock::do_instance_check): Split.
(SharkTopLevelBlock::do_full_instance_check): New method.
(SharkTopLevelBlock::do_trapping_instance_check): Likewise.
* ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
(SharkRuntime::_resolve_klass): Removed.
(SharkRuntime::resolve_klass): Likewise.
(SharkRuntime::resolve_klass_C): Likewise.
* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
(SharkRuntime::_resolve_klass): Likewise.
(SharkRuntime::resolve_klass_C): Likewise.
(SharkRuntime::initialize): Removed _resolve_klass init.
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Tue, 28 Apr 2009 05:50:02 -0400 |
parents | 9b0b945113de |
children | df5a8e49d157 |
files | ChangeLog patches/hotspot/default/icedtea-shark.patch ports/hotspot/src/share/vm/shark/sharkRuntime.cpp ports/hotspot/src/share/vm/shark/sharkRuntime.hpp ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp |
diffstat | 6 files changed, 99 insertions(+), 85 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Apr 27 11:15:01 2009 -0400 +++ b/ChangeLog Tue Apr 28 05:50:02 2009 -0400 @@ -1,3 +1,23 @@ +2009-04-28 Gary Benson <gbenson@redhat.com> + + * patches/hotspot/default/icedtea-shark.patch + (ciInstanceKlass::constant_pool_tag_at): New method. + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp + (SharkTopLevelBlock::do_full_instance_check): New method. + (SharkTopLevelBlock::do_trapping_instance_check): Likewise. + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp + (SharkTopLevelBlock::do_instance_check): Split. + (SharkTopLevelBlock::do_full_instance_check): New method. + (SharkTopLevelBlock::do_trapping_instance_check): Likewise. + * ports/hotspot/src/share/vm/shark/sharkRuntime.hpp + (SharkRuntime::_resolve_klass): Removed. + (SharkRuntime::resolve_klass): Likewise. + (SharkRuntime::resolve_klass_C): Likewise. + * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp + (SharkRuntime::_resolve_klass): Likewise. + (SharkRuntime::resolve_klass_C): Likewise. + (SharkRuntime::initialize): Removed _resolve_klass init. + 2009-04-27 Deepak Bhole <dbhole@redhat.com> * plugin/icedtea/sun/applet/PluginAppletViewer.java: Unescape "
--- a/patches/hotspot/default/icedtea-shark.patch Mon Apr 27 11:15:01 2009 -0400 +++ b/patches/hotspot/default/icedtea-shark.patch Tue Apr 28 05:50:02 2009 -0400 @@ -363,29 +363,25 @@ } // ------------------------------------------------------------------ -diff -r 5297ff20101d openjdk-ecj/hotspot/src/share/vm/ci/ciInstanceKlass.hpp ---- openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Mon Dec 15 15:32:37 2008 +0000 -+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Thu Mar 05 11:48:56 2009 +0000 -@@ -198,4 +198,9 @@ - // What kind of ciObject is this? - bool is_instance_klass() { return true; } - bool is_java_klass() { return true; } -+ -+#ifdef SHARK -+ // Is this entry in the constant pool cache resolved? -+ bool is_cache_entry_resolved(int index, Bytecodes::Code opcode); -+#endif // SHARK - }; diff -r 5297ff20101d openjdk-ecj/hotspot/src/share/vm/ci/ciInstanceKlass.cpp --- openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Mon Dec 15 15:32:37 2008 +0000 -+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Thu Mar 05 11:48:56 2009 +0000 -@@ -548,3 +548,14 @@ ++++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Tue Apr 21 09:47:27 2009 +0100 +@@ -548,3 +548,23 @@ } return impl; } + +#ifdef SHARK +// ------------------------------------------------------------------ ++// ciInstanceKlass::constant_pool_tag_at ++// ++// What is in this constant pool slot? ++constantTag ciInstanceKlass::constant_pool_tag_at(int index) { ++ VM_ENTRY_MARK; ++ return get_instanceKlass()->constants()->tag_at(index); ++} ++ ++// ------------------------------------------------------------------ +// ciInstanceKlass::is_cache_entry_resolved +// +// Is this entry in the constant pool cache resolved? @@ -394,3 +390,19 @@ + return get_instanceKlass()->constants()->cache()->entry_at(index)->is_resolved(opcode); +} +#endif // SHARK +diff -r 5297ff20101d openjdk-ecj/hotspot/src/share/vm/ci/ciInstanceKlass.hpp +--- openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Mon Dec 15 15:32:37 2008 +0000 ++++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Tue Apr 21 09:47:27 2009 +0100 +@@ -198,4 +198,12 @@ + // What kind of ciObject is this? + bool is_instance_klass() { return true; } + bool is_java_klass() { return true; } ++ ++#ifdef SHARK ++ // What is in this constant pool slot? ++ constantTag constant_pool_tag_at(int index); ++ ++ // Is this entry in the constant pool cache resolved? ++ bool is_cache_entry_resolved(int index, Bytecodes::Code opcode); ++#endif // SHARK + };
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Mon Apr 27 11:15:01 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Tue Apr 28 05:50:02 2009 -0400 @@ -37,7 +37,6 @@ Constant* SharkRuntime::_anewarray; Constant* SharkRuntime::_multianewarray; Constant* SharkRuntime::_register_finalizer; -Constant* SharkRuntime::_resolve_klass; Constant* SharkRuntime::_safepoint; Constant* SharkRuntime::_throw_ArrayIndexOutOfBoundsException; Constant* SharkRuntime::_throw_NullPointerException; @@ -93,10 +92,6 @@ (intptr_t) new_instance_C, FunctionType::get(Type::VoidTy, params, false), "SharkRuntime__new_instance"); - _resolve_klass = builder->make_function( - (intptr_t) resolve_klass_C, - FunctionType::get(Type::VoidTy, params, false), - "SharkRuntime__resolve_klass"); params.clear(); params.push_back(SharkType::thread_type()); @@ -372,13 +367,6 @@ } JRT_END -JRT_ENTRY(void, SharkRuntime::resolve_klass_C(JavaThread* thread, int index)) -{ - klassOop klass = method(thread)->constants()->klass_at(index, CHECK); - thread->set_vm_result(klass); -} -JRT_END - JRT_ENTRY(void, SharkRuntime::throw_ArrayIndexOutOfBoundsException_C( JavaThread* thread, const char* file,
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp Mon Apr 27 11:15:01 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp Tue Apr 28 05:50:02 2009 -0400 @@ -37,7 +37,6 @@ static llvm::Constant* _anewarray; static llvm::Constant* _multianewarray; static llvm::Constant* _register_finalizer; - static llvm::Constant* _resolve_klass; static llvm::Constant* _safepoint; static llvm::Constant* _throw_ArrayIndexOutOfBoundsException; static llvm::Constant* _throw_NullPointerException; @@ -75,10 +74,6 @@ { return _register_finalizer; } - static llvm::Constant* resolve_klass() - { - return _resolve_klass; - } static llvm::Constant* safepoint() { return _safepoint; @@ -110,7 +105,6 @@ static void register_finalizer_C(JavaThread* thread, oop object); - static void resolve_klass_C(JavaThread* thread, int index); static void throw_ArrayIndexOutOfBoundsException_C(JavaThread* thread, const char* file, int line,
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Mon Apr 27 11:15:01 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Tue Apr 28 05:50:02 2009 -0400 @@ -1205,24 +1205,24 @@ void SharkTopLevelBlock::do_instance_check() { - // Leave the object on the stack until after all the VM calls - assert(xstack(0)->is_jobject(), "should be"); - - ciKlass *klass = NULL; - if (bc() == Bytecodes::_checkcast) { - bool will_link; - klass = iter()->get_klass(will_link); - if (!will_link) { - // XXX why is this not typeflow's responsibility? - NOT_PRODUCT(warning("unresolved checkcast in %s", function()->name())); - klass = (ciKlass *) xstack(0)->type(); - } + constantTag tag = + target()->holder()->constant_pool_tag_at(iter()->get_klass_index()); + if (!tag.is_klass()) { + assert(tag.is_unresolved_klass(), "should be"); + do_trapping_instance_check(); } + else { + do_full_instance_check(); + } +} + +void SharkTopLevelBlock::do_full_instance_check() +{ + bool will_link; + ciKlass *klass = iter()->get_klass(will_link); + assert(will_link, "should do"); BasicBlock *not_null = function()->CreateBlock("not_null"); - BasicBlock *fast_path = function()->CreateBlock("fast_path"); - BasicBlock *slow_path = function()->CreateBlock("slow_path"); - BasicBlock *got_klass = function()->CreateBlock("got_klass"); BasicBlock *subtype_check = function()->CreateBlock("subtype_check"); BasicBlock *is_instance = function()->CreateBlock("is_instance"); BasicBlock *not_instance = function()->CreateBlock("not_instance"); @@ -1235,9 +1235,12 @@ IC_NOT_INSTANCE, }; + // Pop the object off the stack + Value *object = pop()->jobject_value(); + // Null objects aren't instances of anything builder()->CreateCondBr( - builder()->CreateICmpEQ(xstack(0)->jobject_value(), LLVMValue::null()), + builder()->CreateICmpEQ(object, LLVMValue::null()), merge2, not_null); BasicBlock *null_block = builder()->GetInsertBlock(); SharkState *null_state = current_state()->copy(); @@ -1245,42 +1248,11 @@ // Get the class we're checking against builder()->SetInsertPoint(not_null); SharkConstantPool constants(this); - Value *tag = constants.tag_at(iter()->get_klass_index()); - builder()->CreateCondBr( - builder()->CreateOr( - builder()->CreateICmpEQ( - tag, LLVMValue::jbyte_constant(JVM_CONSTANT_UnresolvedClass)), - builder()->CreateICmpEQ( - tag, LLVMValue::jbyte_constant(JVM_CONSTANT_UnresolvedClassInError))), - slow_path, fast_path); - - // The fast path - builder()->SetInsertPoint(fast_path); - BasicBlock *fast_block = builder()->GetInsertBlock(); - SharkState *fast_state = current_state()->copy(); - Value *fast_klass = constants.object_at(iter()->get_klass_index()); - builder()->CreateBr(got_klass); - - // The slow path - builder()->SetInsertPoint(slow_path); - call_vm( - SharkRuntime::resolve_klass(), - LLVMValue::jint_constant(iter()->get_klass_index())); - Value *slow_klass = function()->CreateGetVMResult(); - BasicBlock *slow_block = builder()->GetInsertBlock(); - builder()->CreateBr(got_klass); - - // We have the class to test against - builder()->SetInsertPoint(got_klass); - current_state()->merge(fast_state, fast_block, slow_block); - PHINode *check_klass = builder()->CreatePHI( - SharkType::jobject_type(), "check_klass"); - check_klass->addIncoming(fast_klass, fast_block); - check_klass->addIncoming(slow_klass, slow_block); + Value *check_klass = constants.object_at(iter()->get_klass_index()); // Get the class of the object being tested Value *object_klass = builder()->CreateValueOfStructEntry( - xstack(0)->jobject_value(), in_ByteSize(oopDesc::klass_offset_in_bytes()), + object, in_ByteSize(oopDesc::klass_offset_in_bytes()), SharkType::jobject_type(), "object_klass"); @@ -1322,9 +1294,6 @@ result->addIncoming(LLVMValue::jint_constant(IC_IS_NULL), null_block); result->addIncoming(nonnull_result, nonnull_block); - // We can finally pop the object! - Value *object = pop()->jobject_value(); - // Handle the result if (bc() == Bytecodes::_checkcast) { BasicBlock *failure = function()->CreateBlock("failure"); @@ -1352,6 +1321,34 @@ } } +void SharkTopLevelBlock::do_trapping_instance_check() +{ + BasicBlock *not_null = function()->CreateBlock("not_null"); + BasicBlock *is_null = function()->CreateBlock("null"); + + // Leave the object on the stack so it's there if we trap + builder()->CreateCondBr( + builder()->CreateICmpEQ(xstack(0)->jobject_value(), LLVMValue::null()), + is_null, not_null); + SharkState *saved_state = current_state()->copy(); + + // If it's not null then we need to trap + builder()->SetInsertPoint(not_null); + set_current_state(saved_state->copy()); + do_trap( + Deoptimization::make_trap_request( + Deoptimization::Reason_uninitialized, + Deoptimization::Action_reinterpret)); + + // If it's null then we're ok + builder()->SetInsertPoint(is_null); + set_current_state(saved_state); + if (bc() == Bytecodes::_instanceof) { + pop(); + push(SharkValue::jint_constant(0)); + } +} + void SharkTopLevelBlock::do_new() { bool will_link;
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp Mon Apr 27 11:15:01 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp Tue Apr 28 05:50:02 2009 -0400 @@ -366,6 +366,9 @@ // checkcast and instanceof private: + void do_full_instance_check(); + void do_trapping_instance_check(); + void do_instance_check(); // new and *newarray