/** * Estimate the expected cost of the inlining action (inclues both the inline body and the * guard/off-branch code). * * @param inlinedBodyEstimate size estimate for inlined body * @param needsGuard is it going to be a guarded inline? * @param preEx can preEx inlining be used to avoid the guard? * @param opts controlling options object * @return the estimated cost of the inlining action */ private int inliningActionCost( int inlinedBodyEstimate, boolean needsGuard, boolean preEx, OPT_Options opts) { int guardCost = 0; if (needsGuard & !preEx) { guardCost += VM_NormalMethod.CALL_COST; if (opts.guardWithMethodTest()) { guardCost += 3 * VM_NormalMethod.SIMPLE_OPERATION_COST; } else if (opts.guardWithCodePatch()) { guardCost += VM_NormalMethod.SIMPLE_OPERATION_COST; } else { // opts.guardWithClassTest() guardCost += 2 * VM_NormalMethod.SIMPLE_OPERATION_COST; } } return guardCost + inlinedBodyEstimate; }