Esempio n. 1
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);
        }
Esempio n. 2
0
        private TranslatedSub TranslateLowCq(long position, ExecutionMode mode)
        {
            Block[] blocks = Decoder.DecodeBasicBlock(_memory, (ulong)position, mode);

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

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

            TranslatedSubBuilder builder = new TranslatedSubBuilder(mode);

            string name = GetSubroutineName(position);

            TranslatedSub subroutine = builder.Build(bbs, name, TranslationTier.Tier0);

            return(_cache.GetOrAdd(position, subroutine, GetOpsCount(bbs)));
        }