コード例 #1
0
        private void Init(
            StackValue thisPtr,
            int classIndex,
            int functionIndex,
            int returnAddress,
            int functionBlockIndex,
            int callerBlockIndex,
            StackFrameType callerStackFrameType,
            StackFrameType stackFrameType,
            int depth,
            int framePointer,
            int blockIndex,
            List <StackValue> registers,
            int execStateSize)
        {
            Frame = new StackValue[StackFrameSize];

            Frame[AbsoluteIndex.ThisPtr]              = thisPtr;
            Frame[AbsoluteIndex.ClassIndex]           = StackValue.BuildClassIndex(classIndex);
            Frame[AbsoluteIndex.FunctionIndex]        = StackValue.BuildFunctionIndex(functionIndex);
            Frame[AbsoluteIndex.ReturnAddress]        = StackValue.BuildInt(returnAddress);
            Frame[AbsoluteIndex.FunctionBlockIndex]   = StackValue.BuildBlockIndex(functionBlockIndex);
            Frame[AbsoluteIndex.CallerBlockIndex]     = StackValue.BuildBlockIndex(callerBlockIndex);
            Frame[AbsoluteIndex.CallerStackFrameType] = StackValue.BuildFrameType((int)callerStackFrameType);
            Frame[AbsoluteIndex.StackFrameType]       = StackValue.BuildFrameType((int)stackFrameType);
            Frame[AbsoluteIndex.StackFrameDepth]      = StackValue.BuildInt(depth);
            Frame[AbsoluteIndex.LocalVariableCount]   = StackValue.BuildInt(0);
            Frame[AbsoluteIndex.ExecutionStates]      = StackValue.BuildInt(execStateSize);
            Frame[AbsoluteIndex.BlockIndex]           = StackValue.BuildBlockIndex(blockIndex);
            Frame[AbsoluteIndex.RX]           = registers[0];
            Frame[AbsoluteIndex.TX]           = registers[1];
            Frame[AbsoluteIndex.FramePointer] = StackValue.BuildInt(framePointer);
        }
コード例 #2
0
        private void Init(StackValue svThisPtr, int classIndex, int funcIndex, int pc, int functionBlockDecl, int functionBlockCaller, StackFrameType callerType, StackFrameType type, int depth,
                          int framePointer, List <StackValue> stack, List <bool> execStates)
        {
            Validity.Assert((int)StackFrame.AbsoluteIndex.kSize == kStackFrameSize);

            Frame = new StackValue[kStackFrameSize];

            Frame[(int)AbsoluteIndex.kFramePointer]         = StackValue.BuildInt(framePointer);
            Frame[(int)AbsoluteIndex.kStackFrameType]       = StackValue.BuildFrameType((int)type);
            Frame[(int)AbsoluteIndex.kCallerStackFrameType] = StackValue.BuildFrameType((int)callerType);
            Frame[(int)AbsoluteIndex.kStackFrameDepth]      = StackValue.BuildInt(depth);
            Frame[(int)AbsoluteIndex.kFunctionCallerBlock]  = StackValue.BuildBlockIndex(functionBlockCaller);
            Frame[(int)AbsoluteIndex.kFunctionBlock]        = StackValue.BuildBlockIndex(functionBlockDecl);
            Frame[(int)AbsoluteIndex.kReturnAddress]        = StackValue.BuildInt(pc);
            Frame[(int)AbsoluteIndex.kFunction]             = StackValue.BuildInt(funcIndex);
            Frame[(int)AbsoluteIndex.kClass]   = StackValue.BuildInt(classIndex);
            Frame[(int)AbsoluteIndex.kThisPtr] = svThisPtr;

            Frame[(int)AbsoluteIndex.kRegisterAX] = stack[0];
            Frame[(int)AbsoluteIndex.kRegisterBX] = stack[1];
            Frame[(int)AbsoluteIndex.kRegisterCX] = stack[2];
            Frame[(int)AbsoluteIndex.kRegisterDX] = stack[3];
            Frame[(int)AbsoluteIndex.kRegisterEX] = stack[4];
            Frame[(int)AbsoluteIndex.kRegisterFX] = stack[5];
            Frame[(int)AbsoluteIndex.kRegisterLX] = stack[6];
            Frame[(int)AbsoluteIndex.kRegisterRX] = stack[7];
            Frame[(int)AbsoluteIndex.kRegisterSX] = stack[8];
            Frame[(int)AbsoluteIndex.kRegisterTX] = stack[9];

            int execStateSize = 0;

            if (null != execStates)
            {
                execStateSize   = execStates.Count;
                ExecutionStates = new StackValue[execStateSize];
                for (int n = 0; n < execStateSize; ++n)
                {
                    ExecutionStates[n] = StackValue.BuildBoolean(execStates[n]);
                }
            }

            Frame[(int)AbsoluteIndex.kExecutionStates] = StackValue.BuildInt(execStateSize);
            Frame[(int)AbsoluteIndex.kLocalVariables]  = StackValue.BuildInt(0);

            Validity.Assert(kStackFrameSize == Frame.Length);
        }