203
204 JavaThread *thread = (JavaThread *) THREAD;
205 ZeroStack *stack = thread->zero_stack();
206
207 // Allocate and initialize our frame
208 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
209 thread->push_zero_frame(frame);
210 interpreterState istate = frame->interpreter_state();
211 intptr_t *locals = istate->locals();
212
213 // Update the invocation counter
214 if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
215 MethodCounters* mcs = method->method_counters();
216 if (mcs == NULL) {
217 CALL_VM_NOCHECK(mcs = InterpreterRuntime::build_method_counters(thread, method));
218 if (HAS_PENDING_EXCEPTION)
219 goto unwind_and_return;
220 }
221 InvocationCounter *counter = mcs->invocation_counter();
222 counter->increment();
223 if (counter->reached_InvocationLimit()) {
224 CALL_VM_NOCHECK(
225 InterpreterRuntime::frequency_counter_overflow(thread, NULL));
226 if (HAS_PENDING_EXCEPTION)
227 goto unwind_and_return;
228 }
229 }
230
231 // Lock if necessary
232 BasicObjectLock *monitor;
233 monitor = NULL;
234 if (method->is_synchronized()) {
235 monitor = (BasicObjectLock*) istate->stack_base();
236 oop lockee = monitor->obj();
237 markOop disp = lockee->mark()->set_unlocked();
238
239 monitor->lock()->set_displaced_header(disp);
240 if (Atomic::cmpxchg_ptr(monitor, lockee->mark_addr(), disp) != disp) {
241 if (thread->is_lock_owned((address) disp->clear_lock_bits())) {
242 monitor->lock()->set_displaced_header(NULL);
243 }
|
203
204 JavaThread *thread = (JavaThread *) THREAD;
205 ZeroStack *stack = thread->zero_stack();
206
207 // Allocate and initialize our frame
208 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
209 thread->push_zero_frame(frame);
210 interpreterState istate = frame->interpreter_state();
211 intptr_t *locals = istate->locals();
212
213 // Update the invocation counter
214 if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
215 MethodCounters* mcs = method->method_counters();
216 if (mcs == NULL) {
217 CALL_VM_NOCHECK(mcs = InterpreterRuntime::build_method_counters(thread, method));
218 if (HAS_PENDING_EXCEPTION)
219 goto unwind_and_return;
220 }
221 InvocationCounter *counter = mcs->invocation_counter();
222 counter->increment();
223 if (counter->reached_InvocationLimit(mcs->backedge_counter())) {
224 CALL_VM_NOCHECK(
225 InterpreterRuntime::frequency_counter_overflow(thread, NULL));
226 if (HAS_PENDING_EXCEPTION)
227 goto unwind_and_return;
228 }
229 }
230
231 // Lock if necessary
232 BasicObjectLock *monitor;
233 monitor = NULL;
234 if (method->is_synchronized()) {
235 monitor = (BasicObjectLock*) istate->stack_base();
236 oop lockee = monitor->obj();
237 markOop disp = lockee->mark()->set_unlocked();
238
239 monitor->lock()->set_displaced_header(disp);
240 if (Atomic::cmpxchg_ptr(monitor, lockee->mark_addr(), disp) != disp) {
241 if (thread->is_lock_owned((address) disp->clear_lock_bits())) {
242 monitor->lock()->set_displaced_header(NULL);
243 }
|