private AstNodeStm EmitInstructionCountIncrement(bool CheckForYield)
{
// CountInstructionsAndYield
if (!CpuProcessor.CpuConfig.CountInstructionsAndYield)
{
return ast.Statement();
}
throw (new NotImplementedException("EmitInstructionCountIncrement"));
////Console.WriteLine("EmiteInstructionCountIncrement: {0},{1}", InstructionsEmitedSinceLastWaypoint, CheckForYield);
//if (InstructionsEmitedSinceLastWaypoint > 0)
//{
// MipsMethodEmiter.SaveStepInstructionCount(() =>
// {
// MipsMethodEmiter.LoadStepInstructionCount();
// SafeILGenerator.Push((int)InstructionsEmitedSinceLastWaypoint);
// SafeILGenerator.BinaryOperation(SafeBinaryOperator.SubstractionSigned);
// });
// //ILGenerator.Emit(OpCodes.Ldc_I4, 100);
// //ILGenerator.EmitCall(OpCodes.Call, typeof(Console).GetMethod("WriteLine"), new Type[] { typeof(int) });
// InstructionsEmitedSinceLastWaypoint = 0;
//}
//
//if (CheckForYield)
//{
// if (!CpuProcessor.CpuConfig.BreakInstructionThreadSwitchingForSpeed)
// {
// var NoYieldLabel = SafeILGenerator.DefineLabel("NoYieldLabel");
// MipsMethodEmiter.LoadStepInstructionCount();
// SafeILGenerator.Push((int)0);
// SafeILGenerator.BranchBinaryComparison(SafeBinaryComparison.GreaterThanSigned, NoYieldLabel);
// //ILGenerator.Emit(OpCodes.Ldc_I4, 1000000);
// //ILGenerator.Emit(OpCodes.Blt, NoYieldLabel);
// MipsMethodEmiter.SaveStepInstructionCount(() =>
// {
// SafeILGenerator.Push((int)0);
// });
// StorePC();
// SafeILGenerator.LoadArgument0CpuThreadState();
// SafeILGenerator.Call((Action)CpuThreadState.Methods.Yield);
// //ILGenerator.Emit(OpCodes.Call, typeof(GreenThread).GetMethod("Yield"));
// NoYieldLabel.Mark();
// }
//}
}