@@ -151,7 +151,7 @@ ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
151151 }
152152 if (_interpreter_invocation_count == 0 )
153153 _interpreter_invocation_count = 1 ;
154- _instructions_size = -1 ;
154+ _inline_instructions_size = -1 ;
155155 if (ReplayCompiles) {
156156 ciReplay::initialize (this );
157157 }
@@ -172,7 +172,7 @@ ciMethod::ciMethod(ciInstanceKlass* holder,
172172 _method_data( NULL ),
173173 _method_blocks( NULL ),
174174 _intrinsic_id( vmIntrinsics::_none),
175- _instructions_size (-1 ),
175+ _inline_instructions_size (-1 ),
176176 _can_be_statically_bound(false ),
177177 _can_omit_stack_trace(true ),
178178 _liveness( NULL )
@@ -1087,7 +1087,7 @@ bool ciMethod::can_be_compiled() {
10871087// ------------------------------------------------------------------
10881088// ciMethod::has_compiled_code
10891089bool ciMethod::has_compiled_code () {
1090- return instructions_size () > 0 ;
1090+ return inline_instructions_size () > 0 ;
10911091}
10921092
10931093int ciMethod::highest_osr_comp_level () {
@@ -1110,25 +1110,28 @@ int ciMethod::code_size_for_inlining() {
11101110}
11111111
11121112// ------------------------------------------------------------------
1113- // ciMethod::instructions_size
1113+ // ciMethod::inline_instructions_size
11141114//
11151115// This is a rough metric for "fat" methods, compared before inlining
11161116// with InlineSmallCode. The CodeBlob::code_size accessor includes
11171117// junk like exception handler, stubs, and constant table, which are
11181118// not highly relevant to an inlined method. So we use the more
11191119// specific accessor nmethod::insts_size.
1120- int ciMethod::instructions_size () {
1121- if (_instructions_size == -1 ) {
1120+ // Also some instructions inside the code are excluded from inline
1121+ // heuristic (e.g. post call nop instructions; see InlineSkippedInstructionsCounter)
1122+ int ciMethod::inline_instructions_size () {
1123+ if (_inline_instructions_size == -1 ) {
11221124 GUARDED_VM_ENTRY (
1123- CompiledMethod* code = get_Method ()->code ();
1124- if (code != NULL && (code->comp_level () == CompLevel_full_optimization)) {
1125- _instructions_size = code->insts_end () - code->verified_entry_point ();
1126- } else {
1127- _instructions_size = 0 ;
1128- }
1129- );
1125+ CompiledMethod* code = get_Method ()->code ();
1126+ if (code != NULL && (code->comp_level () == CompLevel_full_optimization)) {
1127+ int isize = code->insts_end () - code->verified_entry_point () - code->skipped_instructions_size ();
1128+ _inline_instructions_size = isize > 0 ? isize : 0 ;
1129+ } else {
1130+ _inline_instructions_size = 0 ;
1131+ }
1132+ );
11301133 }
1131- return _instructions_size ;
1134+ return _inline_instructions_size ;
11321135}
11331136
11341137// ------------------------------------------------------------------
@@ -1315,7 +1318,7 @@ void ciMethod::dump_replay_data(outputStream* st) {
13151318 mcs == NULL ? 0 : mcs->backedge_counter ()->raw_counter (),
13161319 interpreter_invocation_count (),
13171320 interpreter_throwout_count (),
1318- _instructions_size );
1321+ _inline_instructions_size );
13191322}
13201323
13211324// ------------------------------------------------------------------
0 commit comments