Esempio n. 1
0
 public override CILInstruction Execute(mmchecker.vm.ThreadState threadState)
 {
     int src = threadState.SystemState.GetStaticVariable(classType, field);
     int dest = threadState.SystemState.Values.MakeValue(threadState.GetValue(src)).GUID;
     DelayedRead dr = new DelayedRead(dest, src, this);
     dr.SourceInstruction = this;
     threadState.ThreadStack.Push(dest);
     threadState.AddPendingAction(dr);
     return threadState.CurrentMethod.GetNextInstruction(this);
 }
Esempio n. 2
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);
 }
Esempio n. 3
0
 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.GetLocalArgument(argIndex);
     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);
 }
Esempio n. 4
0
        public override CILInstruction Execute(mmchecker.vm.ThreadState threadState)
        {
            if(CanExecute(threadState) == false)
                throw new Exception("This ldelem is not ready to execute");
            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);

            VMValue destValue = threadState.SystemState.Values.MakeValue(threadState.GetValue(arrinst.GetElement(index)));
            destValue.IsThreadLocal = true;
            threadState.ThreadStack.Push(destValue.GUID);

            DelayedRead dr = new DelayedRead(destValue.GUID, arrinst.GetElement(index), this);
            threadState.AddPendingAction(dr);

            return threadState.CurrentMethod.GetNextInstruction(this);
        }
Esempio n. 5
0
 public override CILInstruction Execute(mmchecker.vm.ThreadState threadState)
 {
     if(CanExecute(threadState) == false)
         throw new Exception("ldfld is not ready to execute now");
     VMValue_object objptr = (VMValue_object)threadState.GetValue(threadState.ThreadStack.Pop());
     VMValue_objectinst obj = (VMValue_objectinst)threadState.GetValue(objptr.ValueGUID);
     int src = obj.GetFieldGUID(className, fieldName);
     int dest = threadState.SystemState.Values.MakeValue(threadState.GetValue(src)).GUID;
     threadState.GetValue(dest).IsThreadLocal = true;
     DelayedRead dr;
     if(isVolatile)
         dr = new DelayedVolatileRead(dest, src, this);
     else
         dr = new DelayedRead(dest, src, this);
     dr.SourceInstruction = this;
     threadState.ThreadStack.Push(dest);
     threadState.AddPendingAction(dr);
     return threadState.CurrentMethod.GetNextInstruction(this);
 }