// Save some variables
final char oldLocalDelta = this.localDelta;
final boolean oldVisitedReturn = this.visitedReturn;
final VmMethod oldMethod = this.method;
final InlineBytecodeVisitor ibv = getDelegate();
final VmByteCode bc = im.getBytecode();
// Calculate the new maxLocals
final int imLocals = bc.getNoLocals(); // #Locals of the inlined method
final int curLocals = oldMethod.getBytecode().getNoLocals(); // #Locals
// of
// the
// current
// method
maxLocals = (char) Math.max(maxLocals, oldLocalDelta + curLocals
+ imLocals);
// Set new variables
this.localDelta += curLocals;
this.visitedReturn = false;
this.inlineDepth++;
this.method = im;
// Reset optimization flags
this.optimizeFlags = 0;
this.previousOptimizeFlags = 0;
// Start the inlining
ibv.startInlinedMethodHeader(im, maxLocals);
// Store the arguments in the locals of the inlined method
storeArgumentsToLocals(im, ibv, localDelta);
// Start the inlining
ibv.startInlinedMethodCode(im, maxLocals);
// Emit a NOP so we can differentiate when a method is virtually empty
if (inlineDepth > 1) {
ibv.visit_nop();
}
// Create the control flow graph
ControlFlowGraph cfg = (ControlFlowGraph) bc.getCompilerData();
if (cfg == null) {
cfg = new ControlFlowGraph(bc);
bc.setCompilerData(cfg);
}
// Compile the code 1 basic block at a time
final CompilerBytecodeParser parser = new CompilerBytecodeParser(bc,
cfg, this);
for (BasicBlock bb : cfg) {