# HG changeset patch # User Thomas Wuerthinger # Date 1365528514 -7200 # Node ID e41c32a4d573eec905bd20d3c21a6499619b3d89 # Parent e7766460ddb3f5e6924f2ddc3fb4b6b082eb5d33 Change the register_finalizer stub to not overwrite any registers. diff -r e7766460ddb3 -r e41c32a4d573 src/cpu/x86/vm/graalRuntime_x86.cpp --- a/src/cpu/x86/vm/graalRuntime_x86.cpp Tue Apr 09 15:26:29 2013 +0200 +++ b/src/cpu/x86/vm/graalRuntime_x86.cpp Tue Apr 09 19:28:34 2013 +0200 @@ -879,30 +879,10 @@ // This is called via call_runtime so the arguments // will be place in C abi locations - -#ifdef _LP64 __ verify_oop(j_rarg0); - __ mov(rax, j_rarg0); -#else - // The object is passed on the stack and we haven't pushed a - // frame yet so it's one work away from top of stack. - __ movptr(rax, Address(rsp, 1 * BytesPerWord)); - __ verify_oop(rax); -#endif // _LP64 - - // load the klass and check the has finalizer flag - Label register_finalizer; - Register t = rsi; - __ load_klass(t, rax); - __ movl(t, Address(t, Klass::access_flags_offset())); - __ testl(t, JVM_ACC_HAS_FINALIZER); - __ jcc(Assembler::notZero, register_finalizer); - __ ret(0); - - __ bind(register_finalizer); __ enter(); OopMap* oop_map = save_live_registers(sasm, 2 /*num_rt_args */); - int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), rax); + int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), j_rarg0); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); diff -r e7766460ddb3 -r e41c32a4d573 src/share/vm/runtime/sharedRuntime.cpp --- a/src/share/vm/runtime/sharedRuntime.cpp Tue Apr 09 15:26:29 2013 +0200 +++ b/src/share/vm/runtime/sharedRuntime.cpp Tue Apr 09 19:28:34 2013 +0200 @@ -969,6 +969,11 @@ JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, oopDesc* obj)) +#ifdef GRAAL + if (!obj->klass()->has_finalizer()) { + return; + } +#endif assert(obj->is_oop(), "must be a valid oop"); assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise"); InstanceKlass::register_finalizer(instanceOop(obj), CHECK);