< prev index next >

src/share/vm/opto/graphKit.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2014, 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  *


3230 
3231 //------------------------------shared_unlock----------------------------------
3232 // Emit unlocking code.
3233 void GraphKit::shared_unlock(Node* box, Node* obj) {
3234   // bci is either a monitorenter bc or InvocationEntryBci
3235   // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
3236   assert(SynchronizationEntryBCI == InvocationEntryBci, "");
3237 
3238   if( !GenerateSynchronizationCode )
3239     return;
3240   if (stopped()) {               // Dead monitor?
3241     map()->pop_monitor();        // Kill monitor from debug info
3242     return;
3243   }
3244 
3245   // Memory barrier to avoid floating things down past the locked region
3246   insert_mem_bar(Op_MemBarReleaseLock);
3247 
3248   const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type();
3249   UnlockNode *unlock = new UnlockNode(C, tf);



3250   uint raw_idx = Compile::AliasIdxRaw;
3251   unlock->init_req( TypeFunc::Control, control() );
3252   unlock->init_req( TypeFunc::Memory , memory(raw_idx) );
3253   unlock->init_req( TypeFunc::I_O    , top() )     ;   // does no i/o
3254   unlock->init_req( TypeFunc::FramePtr, frameptr() );
3255   unlock->init_req( TypeFunc::ReturnAdr, top() );
3256 
3257   unlock->init_req(TypeFunc::Parms + 0, obj);
3258   unlock->init_req(TypeFunc::Parms + 1, box);
3259   unlock = _gvn.transform(unlock)->as_Unlock();
3260 
3261   Node* mem = reset_memory();
3262 
3263   // unlock has no side-effects, sets few values
3264   set_predefined_output_for_runtime_call(unlock, mem, TypeRawPtr::BOTTOM);
3265 
3266   // Kill monitor from debug info
3267   map()->pop_monitor( );
3268 }
3269 


   1 /*
   2  * Copyright (c) 2001, 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  *


3230 
3231 //------------------------------shared_unlock----------------------------------
3232 // Emit unlocking code.
3233 void GraphKit::shared_unlock(Node* box, Node* obj) {
3234   // bci is either a monitorenter bc or InvocationEntryBci
3235   // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
3236   assert(SynchronizationEntryBCI == InvocationEntryBci, "");
3237 
3238   if( !GenerateSynchronizationCode )
3239     return;
3240   if (stopped()) {               // Dead monitor?
3241     map()->pop_monitor();        // Kill monitor from debug info
3242     return;
3243   }
3244 
3245   // Memory barrier to avoid floating things down past the locked region
3246   insert_mem_bar(Op_MemBarReleaseLock);
3247 
3248   const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type();
3249   UnlockNode *unlock = new UnlockNode(C, tf);
3250 #ifdef ASSERT
3251   unlock->set_dbg_jvms(sync_jvms());
3252 #endif
3253   uint raw_idx = Compile::AliasIdxRaw;
3254   unlock->init_req( TypeFunc::Control, control() );
3255   unlock->init_req( TypeFunc::Memory , memory(raw_idx) );
3256   unlock->init_req( TypeFunc::I_O    , top() )     ;   // does no i/o
3257   unlock->init_req( TypeFunc::FramePtr, frameptr() );
3258   unlock->init_req( TypeFunc::ReturnAdr, top() );
3259 
3260   unlock->init_req(TypeFunc::Parms + 0, obj);
3261   unlock->init_req(TypeFunc::Parms + 1, box);
3262   unlock = _gvn.transform(unlock)->as_Unlock();
3263 
3264   Node* mem = reset_memory();
3265 
3266   // unlock has no side-effects, sets few values
3267   set_predefined_output_for_runtime_call(unlock, mem, TypeRawPtr::BOTTOM);
3268 
3269   // Kill monitor from debug info
3270   map()->pop_monitor( );
3271 }
3272 


< prev index next >