< prev index next >

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp

Print this page


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


3823 //       in the assembly code structure as well
3824 //
3825 // Stack layout:
3826 //
3827 // [expressions  ] <--- esp               = expression stack top
3828 // ..
3829 // [expressions  ]
3830 // [monitor entry] <--- monitor block top = expression stack bot
3831 // ..
3832 // [monitor entry]
3833 // [frame data   ] <--- monitor block bot
3834 // ...
3835 // [saved rbp    ] <--- rbp
3836 void TemplateTable::monitorenter()
3837 {
3838   transition(atos, vtos);
3839 
3840   // check for NULL object
3841   __ null_check(r0);
3842 





3843   const Address monitor_block_top(
3844         rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3845   const Address monitor_block_bot(
3846         rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3847   const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3848 
3849   Label allocated;
3850 
3851   // initialize entry pointer
3852   __ mov(c_rarg1, zr); // points to free slot or NULL
3853 
3854   // find a free slot in the monitor block (result in c_rarg1)
3855   {
3856     Label entry, loop, exit;
3857     __ ldr(c_rarg3, monitor_block_top); // points to current entry,
3858                                         // starting with top-most entry
3859     __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3860 
3861     __ b(entry);
3862 


3921   // store object
3922   __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes()));
3923   __ lock_object(c_rarg1);
3924 
3925   // check to make sure this monitor doesn't cause stack overflow after locking
3926   __ save_bcp();  // in case of exception
3927   __ generate_stack_overflow_check(0);
3928 
3929   // The bcp has already been incremented. Just need to dispatch to
3930   // next instruction.
3931   __ dispatch_next(vtos);
3932 }
3933 
3934 
3935 void TemplateTable::monitorexit()
3936 {
3937   transition(atos, vtos);
3938 
3939   // check for NULL object
3940   __ null_check(r0);





3941 
3942   const Address monitor_block_top(
3943         rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3944   const Address monitor_block_bot(
3945         rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3946   const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3947 
3948   Label found;
3949 
3950   // find matching slot
3951   {
3952     Label entry, loop;
3953     __ ldr(c_rarg1, monitor_block_top); // points to current entry,
3954                                         // starting with top-most entry
3955     __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3956                                         // of monitor block
3957     __ b(entry);
3958 
3959     __ bind(loop);
3960     // check if current entry is for same object


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


3823 //       in the assembly code structure as well
3824 //
3825 // Stack layout:
3826 //
3827 // [expressions  ] <--- esp               = expression stack top
3828 // ..
3829 // [expressions  ]
3830 // [monitor entry] <--- monitor block top = expression stack bot
3831 // ..
3832 // [monitor entry]
3833 // [frame data   ] <--- monitor block bot
3834 // ...
3835 // [saved rbp    ] <--- rbp
3836 void TemplateTable::monitorenter()
3837 {
3838   transition(atos, vtos);
3839 
3840   // check for NULL object
3841   __ null_check(r0);
3842 
3843   // We need to preemptively evacuate the object, because we later compare
3844   // it to objects in the BasicObjectLock list, and we might get false negatives
3845   // if another thread evacuates the object in the meantime. See acmp.
3846   __ resolve_for_write(0, r0);
3847 
3848   const Address monitor_block_top(
3849         rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3850   const Address monitor_block_bot(
3851         rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3852   const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3853 
3854   Label allocated;
3855 
3856   // initialize entry pointer
3857   __ mov(c_rarg1, zr); // points to free slot or NULL
3858 
3859   // find a free slot in the monitor block (result in c_rarg1)
3860   {
3861     Label entry, loop, exit;
3862     __ ldr(c_rarg3, monitor_block_top); // points to current entry,
3863                                         // starting with top-most entry
3864     __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3865 
3866     __ b(entry);
3867 


3926   // store object
3927   __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes()));
3928   __ lock_object(c_rarg1);
3929 
3930   // check to make sure this monitor doesn't cause stack overflow after locking
3931   __ save_bcp();  // in case of exception
3932   __ generate_stack_overflow_check(0);
3933 
3934   // The bcp has already been incremented. Just need to dispatch to
3935   // next instruction.
3936   __ dispatch_next(vtos);
3937 }
3938 
3939 
3940 void TemplateTable::monitorexit()
3941 {
3942   transition(atos, vtos);
3943 
3944   // check for NULL object
3945   __ null_check(r0);
3946 
3947   // We need to preemptively evacuate the object, because we later compare
3948   // it to objects in the BasicObjectLock list, and we might get false negatives
3949   // if another thread evacuates the object in the meantime. See acmp.
3950   __ resolve_for_write(0, r0);
3951 
3952   const Address monitor_block_top(
3953         rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3954   const Address monitor_block_bot(
3955         rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3956   const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3957 
3958   Label found;
3959 
3960   // find matching slot
3961   {
3962     Label entry, loop;
3963     __ ldr(c_rarg1, monitor_block_top); // points to current entry,
3964                                         // starting with top-most entry
3965     __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3966                                         // of monitor block
3967     __ b(entry);
3968 
3969     __ bind(loop);
3970     // check if current entry is for same object


< prev index next >