Mercurial > hg > release > icedtea-1.10
changeset 1785:559f45c9f58a
Shark merge.
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 | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Tue, 19 May 2009 16:12:46 +0100 |
parents | eaa4c58a52a4 |
children | 1dd098e01109 |
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, 119 insertions(+), 105 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Apr 27 07:13:07 2009 -0400 +++ b/ChangeLog Tue May 19 16:12:46 2009 +0100 @@ -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 Gary Benson <gbenson@redhat.com> * ports/hotspot/src/share/vm/shark/sharkBlock.hpp
--- a/patches/hotspot/default/icedtea-shark.patch Mon Apr 27 07:13:07 2009 -0400 +++ b/patches/hotspot/default/icedtea-shark.patch Tue May 19 16:12:46 2009 +0100 @@ -1,13 +1,22 @@ diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.cpp openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp ---- openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.cpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp 2009-03-19 14:32:38.000000000 +0000 -@@ -548,3 +548,14 @@ +--- openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp 2009-05-19 16:10:18.000000000 +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? @@ -17,21 +26,24 @@ +} +#endif // SHARK diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.hpp openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp ---- openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.hpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp 2009-03-19 14:32:38.000000000 +0000 -@@ -198,4 +198,9 @@ +--- openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.hpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp 2009-05-19 16:11:21.000000000 +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 -+ // Is this entry in the constant pool cache resolved? -+ bool is_cache_entry_resolved(int index, Bytecodes::Code opcode); ++ // 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 }; diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciMethod.cpp openjdk/hotspot/src/share/vm/ci/ciMethod.cpp ---- openjdk.orig/hotspot/src/share/vm/ci/ciMethod.cpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/ci/ciMethod.cpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/ci/ciMethod.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/ci/ciMethod.cpp 2009-05-19 16:07:37.000000000 +0100 @@ -56,9 +56,9 @@ _liveness = NULL; _bcea = NULL; @@ -98,8 +110,8 @@ // ------------------------------------------------------------------ diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciMethod.hpp openjdk/hotspot/src/share/vm/ci/ciMethod.hpp ---- openjdk.orig/hotspot/src/share/vm/ci/ciMethod.hpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/ci/ciMethod.hpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/ci/ciMethod.hpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/ci/ciMethod.hpp 2009-05-19 16:07:37.000000000 +0100 @@ -69,7 +69,7 @@ // Optional liveness analyzer. @@ -110,8 +122,8 @@ #endif diff -Nru openjdk.orig/hotspot/src/share/vm/code/nmethod.cpp openjdk/hotspot/src/share/vm/code/nmethod.cpp ---- openjdk.orig/hotspot/src/share/vm/code/nmethod.cpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/code/nmethod.cpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/code/nmethod.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/code/nmethod.cpp 2009-05-19 16:07:37.000000000 +0100 @@ -65,6 +65,11 @@ assert(compiler() != NULL, "must be"); return compiler()->is_c2(); @@ -150,8 +162,8 @@ tty->print("(nm) "); } diff -Nru openjdk.orig/hotspot/src/share/vm/code/nmethod.hpp openjdk/hotspot/src/share/vm/code/nmethod.hpp ---- openjdk.orig/hotspot/src/share/vm/code/nmethod.hpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/code/nmethod.hpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/code/nmethod.hpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/code/nmethod.hpp 2009-05-19 16:07:37.000000000 +0100 @@ -318,6 +318,7 @@ bool is_compiled_by_c1() const; @@ -161,8 +173,8 @@ // boundaries for different parts address code_begin () const { return _entry_point; } diff -Nru openjdk.orig/hotspot/src/share/vm/compiler/abstractCompiler.hpp openjdk/hotspot/src/share/vm/compiler/abstractCompiler.hpp ---- openjdk.orig/hotspot/src/share/vm/compiler/abstractCompiler.hpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/compiler/abstractCompiler.hpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/compiler/abstractCompiler.hpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/compiler/abstractCompiler.hpp 2009-05-19 16:07:37.000000000 +0100 @@ -45,18 +45,26 @@ // Missing feature tests virtual bool supports_native() { return true; } @@ -192,8 +204,8 @@ // Customization diff -Nru openjdk.orig/hotspot/src/share/vm/compiler/compileBroker.cpp openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp ---- openjdk.orig/hotspot/src/share/vm/compiler/compileBroker.cpp 2009-03-05 08:25:32.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/compiler/compileBroker.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp 2009-05-19 16:07:37.000000000 +0100 @@ -554,6 +554,14 @@ #endif #endif // COMPILER2 @@ -210,8 +222,8 @@ _task_free_list = NULL; diff -Nru openjdk.orig/hotspot/src/share/vm/memory/cardTableModRefBS.hpp openjdk/hotspot/src/share/vm/memory/cardTableModRefBS.hpp ---- openjdk.orig/hotspot/src/share/vm/memory/cardTableModRefBS.hpp 2009-03-05 08:25:33.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/memory/cardTableModRefBS.hpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/memory/cardTableModRefBS.hpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/memory/cardTableModRefBS.hpp 2009-05-19 16:07:37.000000000 +0100 @@ -44,6 +44,7 @@ friend class VMStructs; friend class CardTableRS; @@ -221,9 +233,9 @@ // For debugging. friend class GuaranteeNotModClosure; diff -Nru openjdk.orig/hotspot/src/share/vm/oops/methodOop.cpp openjdk/hotspot/src/share/vm/oops/methodOop.cpp ---- openjdk.orig/hotspot/src/share/vm/oops/methodOop.cpp 2009-03-05 08:25:34.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/oops/methodOop.cpp 2009-03-19 14:32:38.000000000 +0000 -@@ -727,10 +727,14 @@ +--- openjdk.orig/hotspot/src/share/vm/oops/methodOop.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/oops/methodOop.cpp 2009-05-19 16:07:37.000000000 +0100 +@@ -738,10 +738,14 @@ } OrderAccess::storestore(); @@ -239,8 +251,8 @@ } diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/deoptimization.cpp openjdk/hotspot/src/share/vm/runtime/deoptimization.cpp ---- openjdk.orig/hotspot/src/share/vm/runtime/deoptimization.cpp 2009-03-05 08:25:35.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/runtime/deoptimization.cpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/runtime/deoptimization.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/runtime/deoptimization.cpp 2009-05-19 16:07:37.000000000 +0100 @@ -229,6 +229,7 @@ } @@ -316,8 +328,8 @@ -#endif // COMPILER2 +#endif // COMPILER2 || SHARK diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.cpp openjdk/hotspot/src/share/vm/runtime/globals.cpp ---- openjdk.orig/hotspot/src/share/vm/runtime/globals.cpp 2009-03-05 08:25:35.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/runtime/globals.cpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/runtime/globals.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/runtime/globals.cpp 2009-05-19 16:07:37.000000000 +0100 @@ -176,6 +176,18 @@ #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 notproduct}", DEFAULT }, #endif @@ -348,8 +360,8 @@ }; diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp openjdk/hotspot/src/share/vm/runtime/globals.hpp ---- openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp 2009-03-19 14:27:37.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/runtime/globals.hpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp 2009-05-19 01:11:05.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/runtime/globals.hpp 2009-05-19 16:07:37.000000000 +0100 @@ -22,7 +22,7 @@ * */ @@ -360,8 +372,8 @@ define_pd_global(bool, UseTLAB, false); define_pd_global(bool, CICompileOSR, false); diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/vframeArray.cpp openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp ---- openjdk.orig/hotspot/src/share/vm/runtime/vframeArray.cpp 2009-03-05 08:25:35.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp 2009-03-19 14:32:38.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/runtime/vframeArray.cpp 2009-05-14 18:57:58.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp 2009-05-19 16:07:37.000000000 +0100 @@ -64,6 +64,11 @@ assert(monitor->owner() == NULL || (!monitor->owner()->is_unlocked() && !monitor->owner()->has_bias_pattern()), "object must be null or locked, and unbiased"); BasicObjectLock* dest = _monitors->at(index); @@ -387,8 +399,8 @@ } if (ProfileInterpreter) { diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp openjdk/hotspot/src/share/vm/runtime/vm_version.cpp ---- openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp 2009-03-19 14:27:37.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/runtime/vm_version.cpp 2009-03-19 14:34:18.000000000 +0000 +--- openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp 2009-05-19 01:11:05.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/runtime/vm_version.cpp 2009-05-19 16:07:37.000000000 +0100 @@ -94,6 +94,9 @@ #ifdef TIERED #define VMTYPE "Server"
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Mon Apr 27 07:13:07 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Tue May 19 16:12:46 2009 +0100 @@ -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 07:13:07 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp Tue May 19 16:12:46 2009 +0100 @@ -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 07:13:07 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Tue May 19 16:12:46 2009 +0100 @@ -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 07:13:07 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp Tue May 19 16:12:46 2009 +0100 @@ -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