asm.doInst(p);
int start = asm.getMachineCodeIndex(); int estimate = estimateSize(p); try { asm.doInst(p); } catch (RuntimeException e) { System.err.println("Failed while assembling "+p.toString()); ir.printInstructions(); int end = asm.getMachineCodeIndex(); if (start-end > estimate) { VM.sysWriteln("Bad estimate: "+(start-end)+" "+estimate+" "+p); } VM._assert(false); } int end = asm.getMachineCodeIndex(); if (start-end > estimate) { VM.sysWriteln("Bad estimate: "+(start-end)+" "+estimate+" "+p); }
  public static final int generateCode(OPT_IR ir, boolean shouldPrint) {    int count = 0;    for (OPT_Instruction p = ir.firstInstructionInCodeOrder();          p != null; p = p.nextInstructionInCodeOrder())       {        p.setmcOffset( - ++count);      }          OPT_Assembler asm = new OPT_Assembler(count, shouldPrint);    for (OPT_Instruction p = ir.firstInstructionInCodeOrder();          p != null; p = p.nextInstructionInCodeOrder())       {        asm.doInst(p);      }          ir.MIRInfo.machinecode = asm.getMachineCodes();    return ir.MIRInfo.machinecode.length();  }