124 // This is the offset of the entry barrier from where the frame is completed.
125 // If any code changes between the end of the verified entry where the entry
126 // barrier resides, and the completion of the frame, then
127 // NativeNMethodCmpBarrier::verify() will immediately complain when it does
128 // not find the expected native instruction at this offset, which needs updating.
129 // Note that this offset is invariant of PreserveFramePointer.
130 static const int entry_barrier_offset = -19;
131
132 static NativeNMethodCmpBarrier* native_nmethod_barrier(nmethod* nm) {
133 address barrier_address = nm->code_begin() + nm->frame_complete_offset() + entry_barrier_offset;
134 NativeNMethodCmpBarrier* barrier = reinterpret_cast<NativeNMethodCmpBarrier*>(barrier_address);
135 debug_only(barrier->verify());
136 return barrier;
137 }
138
139 void BarrierSetNMethod::disarm(nmethod* nm) {
140 if (!supports_entry_barrier(nm)) {
141 return;
142 }
143
144 NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
145 cmp->set_immediate(disarmed_value());
146 }
147
148 bool BarrierSetNMethod::is_armed(nmethod* nm) {
149 if (!supports_entry_barrier(nm)) {
150 return false;
151 }
152
153 NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
154 return (disarmed_value() != cmp->get_immedate());
155 }
|
124 // This is the offset of the entry barrier from where the frame is completed.
125 // If any code changes between the end of the verified entry where the entry
126 // barrier resides, and the completion of the frame, then
127 // NativeNMethodCmpBarrier::verify() will immediately complain when it does
128 // not find the expected native instruction at this offset, which needs updating.
129 // Note that this offset is invariant of PreserveFramePointer.
130 static const int entry_barrier_offset = -19;
131
132 static NativeNMethodCmpBarrier* native_nmethod_barrier(nmethod* nm) {
133 address barrier_address = nm->code_begin() + nm->frame_complete_offset() + entry_barrier_offset;
134 NativeNMethodCmpBarrier* barrier = reinterpret_cast<NativeNMethodCmpBarrier*>(barrier_address);
135 debug_only(barrier->verify());
136 return barrier;
137 }
138
139 void BarrierSetNMethod::disarm(nmethod* nm) {
140 if (!supports_entry_barrier(nm)) {
141 return;
142 }
143
144 assert(is_armed(nm), "Should be armed");
145 NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
146 cmp->set_immediate(disarmed_value());
147 }
148
149 bool BarrierSetNMethod::is_armed(nmethod* nm) {
150 if (!supports_entry_barrier(nm)) {
151 return false;
152 }
153
154 NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
155 return (disarmed_value() != cmp->get_immedate());
156 }
|