os.writeLEA(Register.ESP, Register.EBP, -(noLocalVars * 4));
if (noLocalVars < 0) { System.out.println("@#@#@#@# noLocalVars = " + noLocalVars); } final int ofs = Math.max(0, noLocalVars) * 4; os.writeLEA(Register.ESP, Register.EBP, -ofs);
	public void emitTrailer(int maxLocals) {		final int argSlotCount = method.getArgSlotCount();		final Label stackOverflowLabel = helper.genLabel("$$stack-overflow");		// Begin footer		// Now start the actual footer		os.setObjectRef(footerLabel);		/* Go restore the previous current frame */		emitSynchronizationCode(context.getMonitorExitMethod());		os.writeLEA(Register.ESP, Register.EBP, EbpFrameRefOffset);		os.writePOP(Register.EBP);		restoreRegisters();		// Return		if (argSlotCount > 0) {			os.writeRET(argSlotCount * 4);		} else {			os.writeRET();		}		// End footer		// Begin header        // Init starts here        os.setObjectRef(initLabel);                // Test stack overflow                final int stackEndOffset = context.getVmProcessorStackEnd().getOffset();        os.writePrefix(X86Constants.FS_PREFIX);        os.writeCMP_MEM(Register.ESP, stackEndOffset);        os.writeJCC(stackOverflowLabel, X86Constants.JLE);				// Create class initialization code (if needed)		helper.writeClassInitialize(method, EAX, ECX);		// Increment the invocation count		helper.writeIncInvocationCount(EAX);		// Fixed framelayout		saveRegisters();		os.writePUSH(Register.EBP);		os.writePUSH(context.getMagic());		//os.writePUSH(0); // PC, which is only used in interpreted methods		/** EAX MUST contain the VmMethod structure upon entry of the method */		os.writePUSH(Register.EAX);		os.writeMOV(INTSIZE, Register.EBP, Register.ESP);		// Emit the code to create the locals		final int noLocalVars = maxLocals - argSlotCount;		// Create and clear all local variables		if (noLocalVars > 0) {			os.writeXOR(Register.EAX, Register.EAX);			for (int i = 0; i < noLocalVars; i++) {				os.writePUSH(Register.EAX);			}		}		// Load the statics table reference		if (method.canThrow(LoadStaticsPragma.class)) {			helper.writeLoadSTATICS(helper.genLabel("$$edi"), "init", false);		}		/* Create the synchronization enter code */		emitSynchronizationCode(context.getMonitorEnterMethod());				// And jump back to the actual code start		os.writeJMP(startCodeLabel);		// Write stack overflow code		os.setObjectRef(stackOverflowLabel);        os.writeINT(0x31);        // End header       		// No set the exception start&endPtr's		//final int noLocals = bc.getNoLocals();		//final int noLocalVars = noLocals - noArgs;		final int count = bc.getNoExceptionHandlers();		CompiledExceptionHandler[] ceh = new CompiledExceptionHandler[count];		for (int i = 0; i < count; i++) {			final VmInterpretedExceptionHandler eh = bc.getExceptionHandler(i);			final Label handlerLabel = helper.genLabel("$$ex-handler" + i);			final ObjectRef handlerRef = os.setObjectRef(handlerLabel);			/** Clear the calculation stack (only locals are left) */			os.writeLEA(Register.ESP, Register.EBP, -(noLocalVars * 4));			/** Push the exception in EAX */			os.writePUSH(Register.EAX);			/** Goto the real handler */			os.writeJMP(helper.getInstrLabel(eh.getHandlerPC()));			ceh[i] = new CompiledExceptionHandler();			ceh[i].setStartPc(os.getObjectRef(helper.getInstrLabel(eh					.getStartPC())));			ceh[i].setEndPc(os					.getObjectRef(helper.getInstrLabel(eh.getEndPC())));			ceh[i].setHandler(handlerRef);		}		cm.setExceptionHandlers(ceh);		// Now create the default exception handler		Label handlerLabel = helper.genLabel("$$def-ex-handler");		cm.setDefExceptionHandler(os.setObjectRef(handlerLabel));		emitSynchronizationCode(context.getMonitorExitMethod());		os.writeLEA(Register.ESP, Register.EBP, EbpFrameRefOffset);		os.writePOP(Register.EBP);		restoreRegisters();		/**		 * Do not do a ret here, this way the return address will be used by		 * vm_athrow as its return address		 */		helper.writeJumpTableJMP(X86JumpTable.VM_ATHROW_NOTRACE_OFS);		//os.writeJMP(helper.VM_ATHROW_NOTRACE);		codeObject.markEnd();		cm.setCodeEnd(os.setObjectRef(helper.genLabel("$$end-code-object")));	}