Mercurial > hg > truffle
comparison src/share/vm/opto/doCall.cpp @ 7473:d092d1b31229
8005071: Incremental inlining for JSR 292
Summary: post parse inlining driven by number of live nodes.
Reviewed-by: twisti, kvn, jrose
author | roland |
---|---|
date | Sun, 23 Dec 2012 17:08:22 +0100 |
parents | ad5dd04754ee |
children | 5698813d45eb |
comparison
equal
deleted
inserted
replaced
7445:cd962e15c08e | 7473:d092d1b31229 |
---|---|
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_is_virtual, | 64 CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_is_virtual, |
65 JVMState* jvms, bool allow_inline, | 65 JVMState* jvms, bool allow_inline, |
66 float prof_factor, bool allow_intrinsics) { | 66 float prof_factor, bool allow_intrinsics, bool delayed_forbidden) { |
67 ciMethod* caller = jvms->method(); | 67 ciMethod* caller = jvms->method(); |
68 int bci = jvms->bci(); | 68 int bci = jvms->bci(); |
69 Bytecodes::Code bytecode = caller->java_code_at_bci(bci); | 69 Bytecodes::Code bytecode = caller->java_code_at_bci(bci); |
70 guarantee(callee != NULL, "failed method resolution"); | 70 guarantee(callee != NULL, "failed method resolution"); |
71 | 71 |
128 // Do method handle calls. | 128 // Do method handle calls. |
129 // NOTE: This must happen before normal inlining logic below since | 129 // NOTE: This must happen before normal inlining logic below since |
130 // MethodHandle.invoke* are native methods which obviously don't | 130 // MethodHandle.invoke* are native methods which obviously don't |
131 // have bytecodes and so normal inlining fails. | 131 // have bytecodes and so normal inlining fails. |
132 if (callee->is_method_handle_intrinsic()) { | 132 if (callee->is_method_handle_intrinsic()) { |
133 return CallGenerator::for_method_handle_call(jvms, caller, callee); | 133 CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee, delayed_forbidden); |
134 assert (cg == NULL || !delayed_forbidden || !cg->is_late_inline() || cg->is_mh_late_inline(), "unexpected CallGenerator"); | |
135 return cg; | |
134 } | 136 } |
135 | 137 |
136 // Do not inline strict fp into non-strict code, or the reverse | 138 // Do not inline strict fp into non-strict code, or the reverse |
137 if (caller->is_strict() ^ callee->is_strict()) { | 139 if (caller->is_strict() ^ callee->is_strict()) { |
138 allow_inline = false; | 140 allow_inline = false; |
159 ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio, MaxInlineLevel); | 161 ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio, MaxInlineLevel); |
160 } | 162 } |
161 WarmCallInfo scratch_ci; | 163 WarmCallInfo scratch_ci; |
162 if (!UseOldInlining) | 164 if (!UseOldInlining) |
163 scratch_ci.init(jvms, callee, profile, prof_factor); | 165 scratch_ci.init(jvms, callee, profile, prof_factor); |
164 WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci); | 166 bool should_delay = false; |
167 WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay); | |
165 assert(ci != &scratch_ci, "do not let this pointer escape"); | 168 assert(ci != &scratch_ci, "do not let this pointer escape"); |
166 bool allow_inline = (ci != NULL && !ci->is_cold()); | 169 bool allow_inline = (ci != NULL && !ci->is_cold()); |
167 bool require_inline = (allow_inline && ci->is_hot()); | 170 bool require_inline = (allow_inline && ci->is_hot()); |
168 | 171 |
169 if (allow_inline) { | 172 if (allow_inline) { |
170 CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses); | 173 CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses); |
171 if (require_inline && cg != NULL && should_delay_inlining(callee, jvms)) { | 174 |
175 if (require_inline && cg != NULL) { | |
172 // Delay the inlining of this method to give us the | 176 // Delay the inlining of this method to give us the |
173 // opportunity to perform some high level optimizations | 177 // opportunity to perform some high level optimizations |
174 // first. | 178 // first. |
175 return CallGenerator::for_late_inline(callee, cg); | 179 if (should_delay_inlining(callee, jvms)) { |
180 assert(!delayed_forbidden, "strange"); | |
181 return CallGenerator::for_string_late_inline(callee, cg); | |
182 } else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) { | |
183 return CallGenerator::for_late_inline(callee, cg); | |
184 } | |
176 } | 185 } |
177 if (cg == NULL) { | 186 if (cg == NULL || should_delay) { |
178 // Fall through. | 187 // Fall through. |
179 } else if (require_inline || !InlineWarmCalls) { | 188 } else if (require_inline || !InlineWarmCalls) { |
180 return cg; | 189 return cg; |
181 } else { | 190 } else { |
182 CallGenerator* cold_cg = call_generator(callee, vtable_index, call_is_virtual, jvms, false, prof_factor); | 191 CallGenerator* cold_cg = call_generator(callee, vtable_index, call_is_virtual, jvms, false, prof_factor); |