308 } |
308 } |
309 if( inline_depth() > MaxInlineLevel ) { |
309 if( inline_depth() > MaxInlineLevel ) { |
310 return "inlining too deep"; |
310 return "inlining too deep"; |
311 } |
311 } |
312 |
312 |
313 // We need to detect recursive inlining of method handle targets: if |
313 // detect direct and indirect recursive inlining |
314 // the current method is a method handle adapter and one of the |
314 { |
315 // callers is the same method as the callee, we bail out if |
315 // count the current method and the callee |
316 // MaxRecursiveInlineLevel is hit. |
316 int inline_level = (method() == callee_method) ? 1 : 0; |
317 if (method()->is_method_handle_adapter()) { |
317 if (inline_level > MaxRecursiveInlineLevel) |
|
318 return "recursively inlining too deep"; |
|
319 // count callers of current method and callee |
318 JVMState* jvms = caller_jvms(); |
320 JVMState* jvms = caller_jvms(); |
319 int inline_level = 0; |
|
320 while (jvms != NULL && jvms->has_method()) { |
321 while (jvms != NULL && jvms->has_method()) { |
321 if (jvms->method() == callee_method) { |
322 if (jvms->method() == callee_method) { |
322 inline_level++; |
323 inline_level++; |
323 if (inline_level > MaxRecursiveInlineLevel) |
324 if (inline_level > MaxRecursiveInlineLevel) |
324 return "recursively inlining too deep"; |
325 return "recursively inlining too deep"; |
325 } |
326 } |
326 jvms = jvms->caller(); |
327 jvms = jvms->caller(); |
327 } |
328 } |
328 } |
|
329 |
|
330 if (method() == callee_method && inline_depth() > MaxRecursiveInlineLevel) { |
|
331 return "recursively inlining too deep"; |
|
332 } |
329 } |
333 |
330 |
334 int size = callee_method->code_size(); |
331 int size = callee_method->code_size(); |
335 |
332 |
336 if (UseOldInlining && ClipInlining |
333 if (UseOldInlining && ClipInlining |