changeset 1036:0a46d0c5dccb

6891750: deopt blob kills values in O5 Reviewed-by: kvn, twisti
author never
date Thu, 15 Oct 2009 11:47:13 -0700
parents d40f03b57795
children 71fdc5052e49
files src/cpu/sparc/vm/sharedRuntime_sparc.cpp test/compiler/6891750/Test6891750.java
diffstat 2 files changed, 117 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Wed Oct 14 15:03:32 2009 -0700
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Thu Oct 15 11:47:13 2009 -0700
@@ -3213,9 +3213,8 @@
   Register        Oreturn0           = O0;
   Register        Oreturn1           = O1;
   Register        O2UnrollBlock      = O2;
-  Register        O3tmp              = O3;
-  Register        I5exception_tmp    = I5;
-  Register        G4exception_tmp    = G4_scratch;
+  Register        L0deopt_mode       = L0;
+  Register        G4deopt_mode       = G4_scratch;
   int             frame_size_words;
   Address         saved_Freturn0_addr(FP, -sizeof(double) + STACK_BIAS);
 #if !defined(_LP64) && defined(COMPILER2)
@@ -3265,7 +3264,7 @@
 
   map = RegisterSaver::save_live_registers(masm, 0, &frame_size_words);
   __ ba(false, cont);
-  __ delayed()->mov(Deoptimization::Unpack_deopt, I5exception_tmp);
+  __ delayed()->mov(Deoptimization::Unpack_deopt, L0deopt_mode);
 
   int exception_offset = __ offset() - start;
 
@@ -3316,7 +3315,7 @@
 #endif
 
   __ ba(false, cont);
-  __ delayed()->mov(Deoptimization::Unpack_exception, I5exception_tmp);;
+  __ delayed()->mov(Deoptimization::Unpack_exception, L0deopt_mode);;
 
   //
   // Reexecute entry, similar to c2 uncommon trap
@@ -3326,7 +3325,7 @@
   // No need to update oop_map  as each call to save_live_registers will produce identical oopmap
   (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words);
 
-  __ mov(Deoptimization::Unpack_reexecute, I5exception_tmp);
+  __ mov(Deoptimization::Unpack_reexecute, L0deopt_mode);
 
   __ bind(cont);
 
@@ -3349,14 +3348,14 @@
   // NOTE: we know that only O0/O1 will be reloaded by restore_result_registers
   // so this move will survive
 
-  __ mov(I5exception_tmp, G4exception_tmp);
+  __ mov(L0deopt_mode, G4deopt_mode);
 
   __ mov(O0, O2UnrollBlock->after_save());
 
   RegisterSaver::restore_result_registers(masm);
 
   Label noException;
-  __ cmp(G4exception_tmp, Deoptimization::Unpack_exception);   // Was exception pending?
+  __ cmp(G4deopt_mode, Deoptimization::Unpack_exception);   // Was exception pending?
   __ br(Assembler::notEqual, false, Assembler::pt, noException);
   __ delayed()->nop();
 
@@ -3390,10 +3389,10 @@
   }
 #endif
   __ set_last_Java_frame(SP, noreg);
-  __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), G2_thread, G4exception_tmp);
+  __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), G2_thread, G4deopt_mode);
 #else
   // LP64 uses g4 in set_last_Java_frame
-  __ mov(G4exception_tmp, O1);
+  __ mov(G4deopt_mode, O1);
   __ set_last_Java_frame(SP, G0);
   __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), G2_thread, O1);
 #endif
@@ -3446,7 +3445,6 @@
 #endif
   MacroAssembler* masm               = new MacroAssembler(&buffer);
   Register        O2UnrollBlock      = O2;
-  Register        O3tmp              = O3;
   Register        O2klass_index      = O2;
 
   //
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/6891750/Test6891750.java	Thu Oct 15 11:47:13 2009 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6891750
+ * @summary deopt blob kills values in O5
+ *
+ * @run main Test6891750
+ */
+
+abstract class Base6891750 extends Thread {
+    abstract public long m();
+}
+class Other6891750 extends Base6891750 {
+    public long m() {
+        return 0;
+    }
+}
+
+public class Test6891750 extends Base6891750 {
+    Base6891750 d;
+    volatile long  value = 9;
+
+    static int limit = 400000;
+
+    Test6891750() {
+        d = this;
+
+    }
+    public long m() {
+        return value;
+    }
+
+    public long test(boolean doit) {
+        if (doit) {
+            long total0 = 0;
+            long total1 = 0;
+            long total2 = 0;
+            long total3 = 0;
+            long total4 = 0;
+            long total5 = 0;
+            long total6 = 0;
+            long total7 = 0;
+            long total8 = 0;
+            long total9 = 0;
+            for (int i = 0; i < limit; i++) {
+                total0 += d.m();
+                total1 += d.m();
+                total2 += d.m();
+                total3 += d.m();
+                total4 += d.m();
+                total5 += d.m();
+                total6 += d.m();
+                total7 += d.m();
+                total8 += d.m();
+                total9 += d.m();
+            }
+            return total0 + total1 + total2 + total3 + total4 + total5 + total6 + total7 + total8 + total9;
+        }
+        return 0;
+    }
+
+    public void run() {
+        long result = test(true);
+        for (int i = 0; i < 300; i++) {
+            long result2 = test(true);
+            if (result != result2) {
+                throw new InternalError(result + " != " + result2);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Test6891750 Test6891750 = new Test6891750();
+        // warm it up
+        for (int i = 0; i < 200000; i++) {
+            Test6891750.test(false);
+        }
+        // set in off running
+        Test6891750.start();
+        Thread.sleep(2000);
+
+        // Load a class to invalidate CHA
+        new Other6891750();
+    }
+}