3129
3130 //------------------------------shared_lock------------------------------------
3131 // Emit locking code.
3132 FastLockNode* GraphKit::shared_lock(Node* obj) {
3133 // bci is either a monitorenter bc or InvocationEntryBci
3134 // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
3135 assert(SynchronizationEntryBCI == InvocationEntryBci, "");
3136
3137 if( !GenerateSynchronizationCode )
3138 return NULL; // Not locking things?
3139 if (stopped()) // Dead monitor?
3140 return NULL;
3141
3142 assert(dead_locals_are_killed(), "should kill locals before sync. point");
3143
3144 // Box the stack location
3145 Node* box = _gvn.transform(new (C) BoxLockNode(next_monitor()));
3146 Node* mem = reset_memory();
3147
3148 FastLockNode * flock = _gvn.transform(new (C) FastLockNode(0, obj, box) )->as_FastLock();
3149 if (PrintPreciseBiasedLockingStatistics) {
3150 // Create the counters for this fast lock.
3151 flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci
3152 }
3153 // Add monitor to debug info for the slow path. If we block inside the
3154 // slow path and de-opt, we need the monitor hanging around
3155 map()->push_monitor( flock );
3156
3157 const TypeFunc *tf = LockNode::lock_type();
3158 LockNode *lock = new (C) LockNode(C, tf);
3159
3160 lock->init_req( TypeFunc::Control, control() );
3161 lock->init_req( TypeFunc::Memory , mem );
3162 lock->init_req( TypeFunc::I_O , top() ) ; // does no i/o
3163 lock->init_req( TypeFunc::FramePtr, frameptr() );
3164 lock->init_req( TypeFunc::ReturnAdr, top() );
3165
3166 lock->init_req(TypeFunc::Parms + 0, obj);
3167 lock->init_req(TypeFunc::Parms + 1, box);
3168 lock->init_req(TypeFunc::Parms + 2, flock);
3169 add_safepoint_edges(lock);
3170
3171 lock = _gvn.transform( lock )->as_Lock();
3172
|
3129
3130 //------------------------------shared_lock------------------------------------
3131 // Emit locking code.
3132 FastLockNode* GraphKit::shared_lock(Node* obj) {
3133 // bci is either a monitorenter bc or InvocationEntryBci
3134 // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
3135 assert(SynchronizationEntryBCI == InvocationEntryBci, "");
3136
3137 if( !GenerateSynchronizationCode )
3138 return NULL; // Not locking things?
3139 if (stopped()) // Dead monitor?
3140 return NULL;
3141
3142 assert(dead_locals_are_killed(), "should kill locals before sync. point");
3143
3144 // Box the stack location
3145 Node* box = _gvn.transform(new (C) BoxLockNode(next_monitor()));
3146 Node* mem = reset_memory();
3147
3148 FastLockNode * flock = _gvn.transform(new (C) FastLockNode(0, obj, box) )->as_FastLock();
3149 if (UseBiasedLocking && PrintPreciseBiasedLockingStatistics) {
3150 // Create the counters for this fast lock.
3151 flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci
3152 }
3153
3154 // Create the rtm counters for this fast lock if needed.
3155 flock->create_rtm_lock_counter(sync_jvms()); // sync_jvms used to get current bci
3156
3157 // Add monitor to debug info for the slow path. If we block inside the
3158 // slow path and de-opt, we need the monitor hanging around
3159 map()->push_monitor( flock );
3160
3161 const TypeFunc *tf = LockNode::lock_type();
3162 LockNode *lock = new (C) LockNode(C, tf);
3163
3164 lock->init_req( TypeFunc::Control, control() );
3165 lock->init_req( TypeFunc::Memory , mem );
3166 lock->init_req( TypeFunc::I_O , top() ) ; // does no i/o
3167 lock->init_req( TypeFunc::FramePtr, frameptr() );
3168 lock->init_req( TypeFunc::ReturnAdr, top() );
3169
3170 lock->init_req(TypeFunc::Parms + 0, obj);
3171 lock->init_req(TypeFunc::Parms + 1, box);
3172 lock->init_req(TypeFunc::Parms + 2, flock);
3173 add_safepoint_edges(lock);
3174
3175 lock = _gvn.transform( lock )->as_Lock();
3176
|