changeset 8968:e41c32a4d573

Change the register_finalizer stub to not overwrite any registers.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 09 Apr 2013 19:28:34 +0200
parents e7766460ddb3
children 1fa6536416db
files src/cpu/x86/vm/graalRuntime_x86.cpp src/share/vm/runtime/sharedRuntime.cpp
diffstat 2 files changed, 6 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- 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);
 
--- 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);