344 Label done; |
344 Label done; |
345 // Note: In tiered we increment either counters in MethodCounters* or in MDO |
345 // Note: In tiered we increment either counters in MethodCounters* or in MDO |
346 // depending if we're profiling or not. |
346 // depending if we're profiling or not. |
347 if (TieredCompilation) { |
347 if (TieredCompilation) { |
348 int increment = InvocationCounter::count_increment; |
348 int increment = InvocationCounter::count_increment; |
349 int mask = ((1 << Tier0InvokeNotifyFreqLog) - 1) << InvocationCounter::count_shift; |
|
350 Label no_mdo; |
349 Label no_mdo; |
351 if (ProfileInterpreter) { |
350 if (ProfileInterpreter) { |
352 // Are we profiling? |
351 // Are we profiling? |
353 __ movptr(rax, Address(rbx, Method::method_data_offset())); |
352 __ movptr(rax, Address(rbx, Method::method_data_offset())); |
354 __ testptr(rax, rax); |
353 __ testptr(rax, rax); |
355 __ jccb(Assembler::zero, no_mdo); |
354 __ jccb(Assembler::zero, no_mdo); |
356 // Increment counter in the MDO |
355 // Increment counter in the MDO |
357 const Address mdo_invocation_counter(rax, in_bytes(MethodData::invocation_counter_offset()) + |
356 const Address mdo_invocation_counter(rax, in_bytes(MethodData::invocation_counter_offset()) + |
358 in_bytes(InvocationCounter::counter_offset())); |
357 in_bytes(InvocationCounter::counter_offset())); |
|
358 const Address mask(rax, in_bytes(MethodData::invoke_mask_offset())); |
359 __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rcx, false, Assembler::zero, overflow); |
359 __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rcx, false, Assembler::zero, overflow); |
360 __ jmp(done); |
360 __ jmp(done); |
361 } |
361 } |
362 __ bind(no_mdo); |
362 __ bind(no_mdo); |
363 // Increment counter in MethodCounters |
363 // Increment counter in MethodCounters |
364 const Address invocation_counter(rax, |
364 const Address invocation_counter(rax, |
365 MethodCounters::invocation_counter_offset() + |
365 MethodCounters::invocation_counter_offset() + |
366 InvocationCounter::counter_offset()); |
366 InvocationCounter::counter_offset()); |
367 |
367 |
368 __ get_method_counters(rbx, rax, done); |
368 __ get_method_counters(rbx, rax, done); |
|
369 const Address mask(rax, in_bytes(MethodCounters::invoke_mask_offset())); |
369 __ increment_mask_and_jump(invocation_counter, increment, mask, |
370 __ increment_mask_and_jump(invocation_counter, increment, mask, |
370 rcx, false, Assembler::zero, overflow); |
371 rcx, false, Assembler::zero, overflow); |
371 __ bind(done); |
372 __ bind(done); |
372 } else { |
373 } else { // not TieredCompilation |
373 const Address backedge_counter (rax, |
374 const Address backedge_counter(rax, |
374 MethodCounters::backedge_counter_offset() + |
375 MethodCounters::backedge_counter_offset() + |
375 InvocationCounter::counter_offset()); |
376 InvocationCounter::counter_offset()); |
376 const Address invocation_counter(rax, |
377 const Address invocation_counter(rax, |
377 MethodCounters::invocation_counter_offset() + |
378 MethodCounters::invocation_counter_offset() + |
378 InvocationCounter::counter_offset()); |
379 InvocationCounter::counter_offset()); |
398 // profile_method != NULL == !native_call |
399 // profile_method != NULL == !native_call |
399 // BytecodeInterpreter only calls for native so code is elided. |
400 // BytecodeInterpreter only calls for native so code is elided. |
400 |
401 |
401 if (ProfileInterpreter && profile_method != NULL) { |
402 if (ProfileInterpreter && profile_method != NULL) { |
402 // Test to see if we should create a method data oop |
403 // Test to see if we should create a method data oop |
403 __ cmp32(rcx, |
404 __ movptr(rax, Address(rbx, Method::method_counters_offset())); |
404 ExternalAddress((address)&InvocationCounter::InterpreterProfileLimit)); |
405 __ cmp32(rcx, Address(rax, in_bytes(MethodCounters::interpreter_profile_limit_offset()))); |
405 __ jcc(Assembler::less, *profile_method_continue); |
406 __ jcc(Assembler::less, *profile_method_continue); |
406 |
407 |
407 // if no method data exists, go to profile_method |
408 // if no method data exists, go to profile_method |
408 __ test_method_data_pointer(rax, *profile_method); |
409 __ test_method_data_pointer(rax, *profile_method); |
409 } |
410 } |
410 |
411 |
411 __ cmp32(rcx, |
412 __ movptr(rax, Address(rbx, Method::method_counters_offset())); |
412 ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit)); |
413 __ cmp32(rcx, Address(rax, in_bytes(MethodCounters::interpreter_invocation_limit_offset()))); |
413 __ jcc(Assembler::aboveEqual, *overflow); |
414 __ jcc(Assembler::aboveEqual, *overflow); |
414 __ bind(done); |
415 __ bind(done); |
415 } |
416 } |
416 } |
417 } |
417 |
418 |