public override CILInstruction Execute(mmchecker.vm.ThreadState threadState) { // TODONOW: Fix this when semantic for ldarg and starg is clear if(CanExecute(threadState) == false) throw new Exception("This instruction is not ready to execute"); VMValue source = threadState.GetValue(threadState.ThreadStack.Pop()); VMValue target = threadState.GetLocalArgument(argIndex); target.IsThreadLocal = true; DelayedWrite dw = new DelayedWrite(target.GUID, source.GUID, this); threadState.AddPendingAction(dw); return threadState.CurrentMethod.GetNextInstruction(this); }
/// <summary> /// Execute a stloc /// It will initiate a write and schedule it to the thread's queue /// </summary> /// <param name="threadState"></param> /// <returns></returns> public override CILInstruction Execute(ThreadState threadState) { if(CanExecute(threadState) == false) throw new Exception("Can't execute this stloc now"); VMValue source = threadState.GetValue((int)threadState.ThreadStack.Pop()); VMValue target = threadState.GetLocalVariable(localVarIndex); DelayedWrite dw = new DelayedWrite(target.GUID, source.GUID, this); dw.SourceInstruction = this; threadState.AddPendingAction(dw); return threadState.CurrentMethod.GetNextInstruction(this); }
public override CILInstruction Execute(mmchecker.vm.ThreadState threadState) { if(CanExecute(threadState) == false) throw new Exception("This stfld is not ready to execute"); VMValue source = threadState.GetValue(threadState.ThreadStack.Pop()); VMValue target = threadState.GetValue(threadState.SystemState.GetStaticVariable(classType, field)); DelayedWrite dw = new DelayedWrite(target.GUID, source.GUID, this); dw.SourceInstruction = this; // target.AddDelayedAction(dw); threadState.AddPendingAction(dw); return threadState.CurrentMethod.GetNextInstruction(this); }
public override CILInstruction Execute(mmchecker.vm.ThreadState threadState) { if(CanExecute(threadState) == false) throw new Exception("This stelem is not ready to execute"); int gValue = threadState.ThreadStack.Pop(); int index = ((VMValue_int32)threadState.GetValue(threadState.ThreadStack.Pop())).Value; VMValue_array arr = (VMValue_array)threadState.GetValue(threadState.ThreadStack.Pop()); VMValue_arrayinst arrinst = (VMValue_arrayinst)threadState.GetValue(arr.ArrayInstGuid); DelayedWrite dw = new DelayedWrite(arrinst.GetElement(index), gValue, this); threadState.AddPendingAction(dw); return threadState.CurrentMethod.GetNextInstruction(this); }