Exemple #1
0
 /// <summary>
 /// Execute a ldloc
 /// Initiate a DelayedRead and schedule it to the thread's queue
 /// </summary>
 /// <param name="threadState"></param>
 /// <returns></returns>
 public override CILInstruction Execute(ThreadState threadState)
 {
     VMValue source = threadState.GetLocalVariable(localVarIndex);
     VMValue target = threadState.SystemState.Values.MakeValue(source);
     target.IsThreadLocal = true;
     DelayedRead dr = new DelayedRead(target.GUID, source.GUID, this);
     dr.SourceInstruction = this;
     threadState.ThreadStack.Push(target.GUID);
     threadState.AddPendingAction(dr);
     return threadState.CurrentMethod.GetNextInstruction(this);
 }
Exemple #2
0
        /// <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);
        }