예제 #1
0
        public ILEmitterCtx(
            MemoryManager memory,
            TranslatorCache cache,
            TranslatorQueue queue,
            TranslationTier tier,
            Block graph)
        {
            Memory     = memory ?? throw new ArgumentNullException(nameof(memory));
            _cache     = cache ?? throw new ArgumentNullException(nameof(cache));
            _queue     = queue ?? throw new ArgumentNullException(nameof(queue));
            _currBlock = graph ?? throw new ArgumentNullException(nameof(graph));

            Tier = tier;

            _labels = new Dictionary <long, ILLabel>();

            _visitedBlocks = new Dictionary <Block, ILBlock>();

            _visitedBlocks.Add(graph, new ILBlock());

            _branchTargets = new Queue <Block>();

            _ilBlocks = new List <ILBlock>();

            _subPosition = graph.Position;

            ResetBlockState();

            if (AdvanceOpCode())
            {
                EmitSynchronization();

                _ilBlock.Add(new ILOpCodeLoadState(_ilBlock, isSubEntry: true));
            }
        }
예제 #2
0
        public Translator(MemoryManager memory)
        {
            _memory = memory;

            _dummyThreadState = new CpuThreadState();

            _dummyThreadState.Running = false;

            _cache = new TranslatorCache();
            _queue = new TranslatorQueue();
        }
예제 #3
0
        public ILEmitterCtx(TranslatorCache cache, Block graph)
        {
            _cache     = cache ?? throw new ArgumentNullException(nameof(cache));
            _currBlock = graph ?? throw new ArgumentNullException(nameof(graph));

            _labels = new Dictionary <long, ILLabel>();

            _visitedBlocks = new Dictionary <Block, ILBlock>();

            _visitedBlocks.Add(graph, new ILBlock());

            _branchTargets = new Queue <Block>();

            _ilBlocks = new List <ILBlock>();

            _subPosition = graph.Position;

            ResetBlockState();

            AdvanceOpCode();
        }
예제 #4
0
        public ILEmitterCtx(
            TranslatorCache cache,
            Block[]         graph,
            Block root,
            string subName)
        {
            _cache = cache ?? throw new ArgumentNullException(nameof(cache));
            _graph = graph ?? throw new ArgumentNullException(nameof(graph));
            _root  = root ?? throw new ArgumentNullException(nameof(root));

            _labels = new Dictionary <long, ILLabel>();

            _emitter = new ILEmitter(graph, root, subName);

            _ilBlock = _emitter.GetIlBlock(0);

            _opcIndex = -1;

            if (graph.Length == 0 || !AdvanceOpCode())
            {
                throw new ArgumentException(nameof(graph));
            }
        }
예제 #5
0
        public ILEmitterCtx(
            MemoryManager memory,
            TranslatorCache cache,
            TranslatorQueue queue,
            TranslationTier tier)
        {
            Memory = memory ?? throw new ArgumentNullException(nameof(memory));
            _cache = cache ?? throw new ArgumentNullException(nameof(cache));
            _queue = queue ?? throw new ArgumentNullException(nameof(queue));

            Tier = tier;

            _labels = new Dictionary <long, ILLabel>();

            _irLabels = new Dictionary <ILLabel, BasicBlock>();

            _irBlocks = new List <BasicBlock>();

            NewNextBlock();

            EmitSynchronization();

            EmitLoadContext();
        }