@@ -589,82 +589,31 @@ address TemplateInterpreterGenerator::generate_safept_entry_for(
589
589
//
590
590
// rmethod: method
591
591
//
592
- void TemplateInterpreterGenerator::generate_counter_incr (
593
- Label* overflow,
594
- Label* profile_method,
595
- Label* profile_method_continue) {
592
+ void TemplateInterpreterGenerator::generate_counter_incr (Label* overflow) {
596
593
Label done;
597
594
// Note: In tiered we increment either counters in Method* or in MDO depending if we're profiling or not.
598
- if (TieredCompilation) {
599
- int increment = InvocationCounter::count_increment;
600
- Label no_mdo;
601
- if (ProfileInterpreter) {
602
- // Are we profiling?
603
- __ ldr (r0, Address (rmethod, Method::method_data_offset ()));
604
- __ cbz (r0, no_mdo);
605
- // Increment counter in the MDO
606
- const Address mdo_invocation_counter (r0, in_bytes (MethodData::invocation_counter_offset ()) +
607
- in_bytes (InvocationCounter::counter_offset ()));
608
- const Address mask (r0, in_bytes (MethodData::invoke_mask_offset ()));
609
- __ increment_mask_and_jump (mdo_invocation_counter, increment, mask, rscratch1, rscratch2, false , Assembler::EQ, overflow);
610
- __ b (done);
611
- }
612
- __ bind (no_mdo);
613
- // Increment counter in MethodCounters
614
- const Address invocation_counter (rscratch2,
615
- MethodCounters::invocation_counter_offset () +
616
- InvocationCounter::counter_offset ());
617
- __ get_method_counters (rmethod, rscratch2, done);
618
- const Address mask (rscratch2, in_bytes (MethodCounters::invoke_mask_offset ()));
619
- __ increment_mask_and_jump (invocation_counter, increment, mask, rscratch1, r1, false , Assembler::EQ, overflow);
620
- __ bind (done);
621
- } else { // not TieredCompilation
622
- const Address backedge_counter (rscratch2,
623
- MethodCounters::backedge_counter_offset () +
624
- InvocationCounter::counter_offset ());
625
- const Address invocation_counter (rscratch2,
626
- MethodCounters::invocation_counter_offset () +
627
- InvocationCounter::counter_offset ());
628
-
629
- __ get_method_counters (rmethod, rscratch2, done);
630
-
631
- if (ProfileInterpreter) { // %%% Merge this into MethodData*
632
- __ ldrw (r1, Address (rscratch2, MethodCounters::interpreter_invocation_counter_offset ()));
633
- __ addw (r1, r1, 1 );
634
- __ strw (r1, Address (rscratch2, MethodCounters::interpreter_invocation_counter_offset ()));
635
- }
636
- // Update standard invocation counters
637
- __ ldrw (r1, invocation_counter);
638
- __ ldrw (r0, backedge_counter);
639
-
640
- __ addw (r1, r1, InvocationCounter::count_increment);
641
- __ andw (r0, r0, InvocationCounter::count_mask_value);
642
-
643
- __ strw (r1, invocation_counter);
644
- __ addw (r0, r0, r1); // add both counters
645
-
646
- // profile_method is non-null only for interpreted method so
647
- // profile_method != NULL == !native_call
648
-
649
- if (ProfileInterpreter && profile_method != NULL ) {
650
- // Test to see if we should create a method data oop
651
- __ ldr (rscratch2, Address (rmethod, Method::method_counters_offset ()));
652
- __ ldrw (rscratch2, Address (rscratch2, in_bytes (MethodCounters::interpreter_profile_limit_offset ())));
653
- __ cmpw (r0, rscratch2);
654
- __ br (Assembler::LT, *profile_method_continue);
655
-
656
- // if no method data exists, go to profile_method
657
- __ test_method_data_pointer (rscratch2, *profile_method);
658
- }
659
-
660
- {
661
- __ ldr (rscratch2, Address (rmethod, Method::method_counters_offset ()));
662
- __ ldrw (rscratch2, Address (rscratch2, in_bytes (MethodCounters::interpreter_invocation_limit_offset ())));
663
- __ cmpw (r0, rscratch2);
664
- __ br (Assembler::HS, *overflow);
665
- }
666
- __ bind (done);
595
+ int increment = InvocationCounter::count_increment;
596
+ Label no_mdo;
597
+ if (ProfileInterpreter) {
598
+ // Are we profiling?
599
+ __ ldr (r0, Address (rmethod, Method::method_data_offset ()));
600
+ __ cbz (r0, no_mdo);
601
+ // Increment counter in the MDO
602
+ const Address mdo_invocation_counter (r0, in_bytes (MethodData::invocation_counter_offset ()) +
603
+ in_bytes (InvocationCounter::counter_offset ()));
604
+ const Address mask (r0, in_bytes (MethodData::invoke_mask_offset ()));
605
+ __ increment_mask_and_jump (mdo_invocation_counter, increment, mask, rscratch1, rscratch2, false , Assembler::EQ, overflow);
606
+ __ b (done);
667
607
}
608
+ __ bind (no_mdo);
609
+ // Increment counter in MethodCounters
610
+ const Address invocation_counter (rscratch2,
611
+ MethodCounters::invocation_counter_offset () +
612
+ InvocationCounter::counter_offset ());
613
+ __ get_method_counters (rmethod, rscratch2, done);
614
+ const Address mask (rscratch2, in_bytes (MethodCounters::invoke_mask_offset ()));
615
+ __ increment_mask_and_jump (invocation_counter, increment, mask, rscratch1, r1, false , Assembler::EQ, overflow);
616
+ __ bind (done);
668
617
}
669
618
670
619
void TemplateInterpreterGenerator::generate_counter_overflow (Label& do_continue) {
@@ -1205,7 +1154,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
1205
1154
// increment invocation count & check for overflow
1206
1155
Label invocation_counter_overflow;
1207
1156
if (inc_counter) {
1208
- generate_counter_incr (&invocation_counter_overflow, NULL , NULL );
1157
+ generate_counter_incr (&invocation_counter_overflow);
1209
1158
}
1210
1159
1211
1160
Label continue_after_compile;
@@ -1649,15 +1598,8 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
1649
1598
1650
1599
// increment invocation count & check for overflow
1651
1600
Label invocation_counter_overflow;
1652
- Label profile_method;
1653
- Label profile_method_continue;
1654
1601
if (inc_counter) {
1655
- generate_counter_incr (&invocation_counter_overflow,
1656
- &profile_method,
1657
- &profile_method_continue);
1658
- if (ProfileInterpreter) {
1659
- __ bind (profile_method_continue);
1660
- }
1602
+ generate_counter_incr (&invocation_counter_overflow);
1661
1603
}
1662
1604
1663
1605
Label continue_after_compile;
@@ -1709,15 +1651,6 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
1709
1651
1710
1652
// invocation counter overflow
1711
1653
if (inc_counter) {
1712
- if (ProfileInterpreter) {
1713
- // We have decided to profile this method in the interpreter
1714
- __ bind (profile_method);
1715
- __ call_VM (noreg, CAST_FROM_FN_PTR (address, InterpreterRuntime::profile_method));
1716
- __ set_method_data_pointer_for_bcp ();
1717
- // don't think we need this
1718
- __ get_method (r1);
1719
- __ b (profile_method_continue);
1720
- }
1721
1654
// Handle overflow of counter and compile method
1722
1655
__ bind (invocation_counter_overflow);
1723
1656
generate_counter_overflow (continue_after_compile);
0 commit comments