コード例 #1
0
ファイル: Debugger.cs プロジェクト: hackerlank/zlr
            private void OneStep()
            {
                CachedCode entry;
                int        thisPC = zm.pc;

                if (thisPC < zm.romStart || zm.cache.TryGetValue(thisPC, out entry) == false)
                {
                    int count;
                    entry = new CachedCode(zm.pc, zm.CompileZCode(out count));
                    if (thisPC >= zm.romStart)
                    {
                        zm.cache.Add(thisPC, entry, count);
                    }
                }
                zm.pc = entry.NextPC;
                entry.Code();
            }
コード例 #2
0
ファイル: ZMachine.cs プロジェクト: dbremner/zlr
        /// <summary>
        /// Compiles and executes code, starting from the current <see cref="pc"/> and continuing
        /// until <see cref="running"/> becomes false or the current call frame is exited.
        /// </summary>
        private void JitLoop()
        {
            int initialCallDepth = callStack.Count;

            while (running && callStack.Count >= initialCallDepth)
            {
#if TRACING
                Console.Write("===== Call: {1,2} Eval: {0,2}", stack.Count, callStack.Count);
                if (debugFile != null)
                {
                    RoutineInfo ri = debugFile.FindRoutine(pc);
                    if (ri != null)
                        Console.Write("   (in {0})", ri.Name);
                }
                Console.WriteLine();
#endif

                CachedCode entry;
                int thisPC = pc;
#if !DISABLE_CACHE
                if (thisPC < romStart || cache.TryGetValue(thisPC, out entry) == false)
#endif
                {
#if BENCHMARK
                    cacheMisses++;
#endif
                    int count;
                    var code = CompileZCode(out count);
                    entry = new CachedCode(pc, code);
#if BENCHMARK
                    entry.Cycles = count;   // only used to calculate the amount of cached z-code
#endif
#if !DISABLE_CACHE
                    if (thisPC >= romStart)
                        cache.Add(thisPC, entry, count);
#endif
                }
#if BENCHMARK
                else
                    cacheHits++;
#endif
                pc = entry.NextPC;
                entry.Code();
            }
        }
コード例 #3
0
ファイル: Debugger.cs プロジェクト: KeanW/zlr--git
 private void OneStep()
 {
     CachedCode entry;
     int thisPC = zm.pc;
     if (thisPC < zm.romStart || zm.cache.TryGetValue(thisPC, out entry) == false)
     {
         int count;
         entry = new CachedCode(zm.pc, zm.CompileZCode(out count));
         if (thisPC >= zm.romStart)
             zm.cache.Add(thisPC, entry, count);
     }
     zm.pc = entry.NextPC;
     entry.Code();
 }