1 /* |
1 /* |
2 * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
281 int entries = 0; |
281 int entries = 0; |
282 for (row = 0; row < row_limit(); row++) { |
282 for (row = 0; row < row_limit(); row++) { |
283 if (receiver(row) != NULL) entries++; |
283 if (receiver(row) != NULL) entries++; |
284 } |
284 } |
285 st->print_cr("count(%u) entries(%u)", count(), entries); |
285 st->print_cr("count(%u) entries(%u)", count(), entries); |
|
286 int total = count(); |
|
287 for (row = 0; row < row_limit(); row++) { |
|
288 if (receiver(row) != NULL) { |
|
289 total += receiver_count(row); |
|
290 } |
|
291 } |
286 for (row = 0; row < row_limit(); row++) { |
292 for (row = 0; row < row_limit(); row++) { |
287 if (receiver(row) != NULL) { |
293 if (receiver(row) != NULL) { |
288 tab(st); |
294 tab(st); |
289 receiver(row)->print_value_on(st); |
295 receiver(row)->print_value_on(st); |
290 st->print_cr("(%u)", receiver_count(row)); |
296 st->print_cr("(%u %4.2f)", receiver_count(row), (float) receiver_count(row) / (float) total); |
291 } |
297 } |
292 } |
298 } |
293 } |
299 } |
294 void ReceiverTypeData::print_data_on(outputStream* st) { |
300 void ReceiverTypeData::print_data_on(outputStream* st) { |
295 print_shared(st, "ReceiverTypeData"); |
301 print_shared(st, "ReceiverTypeData"); |
741 } |
747 } |
742 |
748 |
743 // Initialize the methodDataOop corresponding to a given method. |
749 // Initialize the methodDataOop corresponding to a given method. |
744 void methodDataOopDesc::initialize(methodHandle method) { |
750 void methodDataOopDesc::initialize(methodHandle method) { |
745 ResourceMark rm; |
751 ResourceMark rm; |
746 |
|
747 // Set the method back-pointer. |
752 // Set the method back-pointer. |
748 _method = method(); |
753 _method = method(); |
|
754 |
|
755 if (TieredCompilation) { |
|
756 _invocation_counter.init(); |
|
757 _backedge_counter.init(); |
|
758 _num_loops = 0; |
|
759 _num_blocks = 0; |
|
760 _highest_comp_level = 0; |
|
761 _highest_osr_comp_level = 0; |
|
762 _would_profile = false; |
|
763 } |
749 set_creation_mileage(mileage_of(method())); |
764 set_creation_mileage(mileage_of(method())); |
750 |
765 |
751 // Initialize flags and trap history. |
766 // Initialize flags and trap history. |
752 _nof_decompiles = 0; |
767 _nof_decompiles = 0; |
753 _nof_overflow_recompiles = 0; |
768 _nof_overflow_recompiles = 0; |
796 } |
811 } |
797 |
812 |
798 // Get a measure of how much mileage the method has on it. |
813 // Get a measure of how much mileage the method has on it. |
799 int methodDataOopDesc::mileage_of(methodOop method) { |
814 int methodDataOopDesc::mileage_of(methodOop method) { |
800 int mileage = 0; |
815 int mileage = 0; |
801 int iic = method->interpreter_invocation_count(); |
816 if (TieredCompilation) { |
802 if (mileage < iic) mileage = iic; |
817 mileage = MAX2(method->invocation_count(), method->backedge_count()); |
803 |
818 } else { |
804 InvocationCounter* ic = method->invocation_counter(); |
819 int iic = method->interpreter_invocation_count(); |
805 InvocationCounter* bc = method->backedge_counter(); |
820 if (mileage < iic) mileage = iic; |
806 |
821 InvocationCounter* ic = method->invocation_counter(); |
807 int icval = ic->count(); |
822 InvocationCounter* bc = method->backedge_counter(); |
808 if (ic->carry()) icval += CompileThreshold; |
823 int icval = ic->count(); |
809 if (mileage < icval) mileage = icval; |
824 if (ic->carry()) icval += CompileThreshold; |
810 int bcval = bc->count(); |
825 if (mileage < icval) mileage = icval; |
811 if (bc->carry()) bcval += CompileThreshold; |
826 int bcval = bc->count(); |
812 if (mileage < bcval) mileage = bcval; |
827 if (bc->carry()) bcval += CompileThreshold; |
|
828 if (mileage < bcval) mileage = bcval; |
|
829 } |
813 return mileage; |
830 return mileage; |
814 } |
831 } |
815 |
832 |
816 bool methodDataOopDesc::is_mature() const { |
833 bool methodDataOopDesc::is_mature() const { |
817 uint current = mileage_of(_method); |
834 return CompilationPolicy::policy()->is_mature(_method); |
818 uint initial = creation_mileage(); |
|
819 if (current < initial) |
|
820 return true; // some sort of overflow |
|
821 uint target; |
|
822 if (ProfileMaturityPercentage <= 0) |
|
823 target = (uint) -ProfileMaturityPercentage; // absolute value |
|
824 else |
|
825 target = (uint)( (ProfileMaturityPercentage * CompileThreshold) / 100 ); |
|
826 return (current >= initial + target); |
|
827 } |
835 } |
828 |
836 |
829 // Translate a bci to its corresponding data index (di). |
837 // Translate a bci to its corresponding data index (di). |
830 address methodDataOopDesc::bci_to_dp(int bci) { |
838 address methodDataOopDesc::bci_to_dp(int bci) { |
831 ResourceMark rm; |
839 ResourceMark rm; |