src/cpu/sparc/vm/sharedRuntime_sparc.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2647     // leaf call, the pending exception (if any) can be kept in a register.
2648     __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), I2_ex_oop);
2649     // Now unlock
2650     //                       (Roop, Rmark, Rbox,   Rscratch)
2651     __ compiler_unlock_object(L4,   L1,    L3_box, L2);
2652     __ br(Assembler::equal, false, Assembler::pt, done);
2653     __ delayed()-> add(SP, lock_offset+STACK_BIAS, L3_box);
2654 
2655     // save and restore any potential method result value around the unlocking
2656     // operation.  Will save in I0 (or stack for FP returns).
2657     save_native_result(masm, ret_type, stack_slots);
2658 
2659     // Must clear pending-exception before re-entering the VM.  Since this is
2660     // a leaf call, pending-exception-oop can be safely kept in a register.
2661     __ st_ptr(G0, G2_thread, in_bytes(Thread::pending_exception_offset()));
2662 
2663     // slow case of monitor enter.  Inline a special case of call_VM that
2664     // disallows any pending_exception.
2665     __ mov(L3_box, O1);
2666 



2667     __ call(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), relocInfo::runtime_call_type);
2668     __ delayed()->mov(L4, O0);              // Need oop in O0
2669 
2670     __ restore_thread(L7_thread_cache); // restore G2_thread
2671 
2672 #ifdef ASSERT
2673     { Label L;
2674     __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0);
2675     __ br_null_short(O0, Assembler::pt, L);
2676     __ stop("no pending exception allowed on exit from IR::monitorexit");
2677     __ bind(L);
2678     }
2679 #endif
2680     restore_native_result(masm, ret_type, stack_slots);
2681     // check_forward_pending_exception jump to forward_exception if any pending
2682     // exception is set.  The forward_exception routine expects to see the
2683     // exception in pending_exception and not in a register.  Kind of clumsy,
2684     // since all folks who branch to forward_exception must have tested
2685     // pending_exception first and hence have it in a register already.
2686     __ st_ptr(I2_ex_oop, G2_thread, in_bytes(Thread::pending_exception_offset()));


   1 /*
   2  * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2647     // leaf call, the pending exception (if any) can be kept in a register.
2648     __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), I2_ex_oop);
2649     // Now unlock
2650     //                       (Roop, Rmark, Rbox,   Rscratch)
2651     __ compiler_unlock_object(L4,   L1,    L3_box, L2);
2652     __ br(Assembler::equal, false, Assembler::pt, done);
2653     __ delayed()-> add(SP, lock_offset+STACK_BIAS, L3_box);
2654 
2655     // save and restore any potential method result value around the unlocking
2656     // operation.  Will save in I0 (or stack for FP returns).
2657     save_native_result(masm, ret_type, stack_slots);
2658 
2659     // Must clear pending-exception before re-entering the VM.  Since this is
2660     // a leaf call, pending-exception-oop can be safely kept in a register.
2661     __ st_ptr(G0, G2_thread, in_bytes(Thread::pending_exception_offset()));
2662 
2663     // slow case of monitor enter.  Inline a special case of call_VM that
2664     // disallows any pending_exception.
2665     __ mov(L3_box, O1);
2666 
2667     // Pass in current thread pointer
2668     __ mov(G2_thread, O2);
2669 
2670     __ call(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), relocInfo::runtime_call_type);
2671     __ delayed()->mov(L4, O0);              // Need oop in O0
2672 
2673     __ restore_thread(L7_thread_cache); // restore G2_thread
2674 
2675 #ifdef ASSERT
2676     { Label L;
2677     __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0);
2678     __ br_null_short(O0, Assembler::pt, L);
2679     __ stop("no pending exception allowed on exit from IR::monitorexit");
2680     __ bind(L);
2681     }
2682 #endif
2683     restore_native_result(masm, ret_type, stack_slots);
2684     // check_forward_pending_exception jump to forward_exception if any pending
2685     // exception is set.  The forward_exception routine expects to see the
2686     // exception in pending_exception and not in a register.  Kind of clumsy,
2687     // since all folks who branch to forward_exception must have tested
2688     // pending_exception first and hence have it in a register already.
2689     __ st_ptr(I2_ex_oop, G2_thread, in_bytes(Thread::pending_exception_offset()));