예제 #1
0
        private void TranslateHighCq(long position, ExecutionMode mode)
        {
            Block graph = Decoder.DecodeSubroutine(_memory, position, mode);

            ILEmitterCtx context = new ILEmitterCtx(_cache, _queue, TranslationTier.Tier1, graph);

            ILBlock[] ilBlocks = context.GetILBlocks();

            string subName = GetSubroutineName(position);

            ILMethodBuilder ilMthdBuilder = new ILMethodBuilder(ilBlocks, subName);

            TranslatedSub subroutine = ilMthdBuilder.GetSubroutine(TranslationTier.Tier1);

            int ilOpCount = 0;

            foreach (ILBlock ilBlock in ilBlocks)
            {
                ilOpCount += ilBlock.Count;
            }

            _cache.AddOrUpdate(position, subroutine, ilOpCount);

            ForceAheadOfTimeCompilation(subroutine);
        }
예제 #2
0
        private TranslatedSub TranslateHighCq(long position, ExecutionMode mode, bool isComplete)
        {
            Block[] blocks = Decoder.DecodeSubroutine(_memory, (ulong)position, mode);

            ILEmitterCtx context = new ILEmitterCtx(_memory, _cache, _queue, TranslationTier.Tier1);

            if (blocks[0].Address != (ulong)position)
            {
                context.Emit(OpCodes.Br, context.GetLabel(position));
            }

            BasicBlock[] bbs = EmitAndGetBlocks(context, blocks);

            isComplete &= !context.HasIndirectJump;

            TranslatedSubBuilder builder = new TranslatedSubBuilder(mode, isComplete);

            string name = GetSubroutineName(position);

            TranslatedSub subroutine = builder.Build(bbs, name, TranslationTier.Tier1, context.HasSlowCall);

            ForceAheadOfTimeCompilation(subroutine);

            _cache.AddOrUpdate(position, subroutine, GetOpsCount(bbs));

            return(subroutine);
        }
예제 #3
0
        private TranslatedSub TranslateHighCq(long position, ExecutionMode mode, bool isComplete)
        {
            Block graph = Decoder.DecodeSubroutine(_memory, position, mode);

            ILEmitterCtx context = new ILEmitterCtx(_memory, _cache, _queue, TranslationTier.Tier1, graph);

            ILBlock[] ilBlocks = context.GetILBlocks();

            string subName = GetSubroutineName(position);

            bool isAarch64 = mode == ExecutionMode.Aarch64;

            isComplete &= !context.HasIndirectJump;

            ILMethodBuilder ilMthdBuilder = new ILMethodBuilder(ilBlocks, subName, isAarch64, isComplete);

            TranslatedSub subroutine = ilMthdBuilder.GetSubroutine(TranslationTier.Tier1, context.HasSlowCall);

            int ilOpCount = 0;

            foreach (ILBlock ilBlock in ilBlocks)
            {
                ilOpCount += ilBlock.Count;
            }

            ForceAheadOfTimeCompilation(subroutine);

            _cache.AddOrUpdate(position, subroutine, ilOpCount);

            return(subroutine);
        }