// resetCache // Clear out any existing continuation and install the initial one. public static void reset() { heap = Factory.False; cont = ROOT; cont.prepare0(); cont.Slot0 = InitialContinuation.singletonProcedure; cont.returnIndex = 0; }
/* pop */ public static void pop() { cont.lastslot = 0; cont = cont.before; if (cont == SENTINEL) { fillCache(); } }
// clear // Clear all frames in the cache (so GC doesn't hold dead objects) // Called on every timer interrupt (see Exn.faultTimer). public static void clear() { StackCacheFrame frame = ROOT; while (frame != SENTINEL) { frame.clear(); frame = frame.after; } }
// save that assumes that lastslot is < num slots. public static void save_small(int lastslot) { if (cont == LIMIT) { heap = copyOutStack(); cont = SENTINEL; } cont = cont.after; cont.prepare_small(lastslot); cont.Slot0 = Reg.ProcRegister0; }
public static void save0() { if (cont == LIMIT) { heap = copyOutStack(); cont = SENTINEL; } cont = cont.after; cont.prepare0(); cont.Slot0 = Reg.ProcRegister0; }
/* copyOutStack * Flush all frames out of the cache to the heap. Does not change stack cache. */ public static SObject copyOutStack() { #if HAS_PERFORMANCE_COUNTERS if (stackFlushCounter != null) { stackFlushCounter.Increment(); } #endif SObject h = heap; for (StackCacheFrame f = ROOT; f != cont.after; f = f.after) { h = f.toVector(h); } return(h); }
// static constructor initializes stack cache structure // static constructors are slow. Make an explicit initialization method. public static void Initialize () { StackCacheFrame limit = SENTINEL; for (int i = 0; i < NUM_CACHE_FRAMES; ++i) { StackCacheFrame newframe = new StackCacheFrame(); newframe.before = limit; limit.after = newframe; limit = newframe; } limit.after = SENTINEL; SENTINEL.before = limit; ROOT = SENTINEL.after; LIMIT = SENTINEL.before; cont = ROOT; clear(); // Install the initial continuation. reset(); }
// static constructor initializes stack cache structure // static constructors are slow. Make an explicit initialization method. public static void Initialize() { StackCacheFrame limit = SENTINEL; for (int i = 0; i < NUM_CACHE_FRAMES; ++i) { StackCacheFrame newframe = new StackCacheFrame(); newframe.before = limit; limit.after = newframe; limit = newframe; } limit.after = SENTINEL; SENTINEL.before = limit; ROOT = SENTINEL.after; LIMIT = SENTINEL.before; cont = ROOT; clear(); // Install the initial continuation. reset(); }
/* fillCache */ public static void fillCache() { #if HAS_PERFORMANCE_COUNTERS if (stackReloadCounter != null) { stackReloadCounter.Increment(); } #endif cont = ROOT; SVL h = heap as SVL; if (h == null) { Exn.internalError("fillCache: Cont.heap is not a vector"); } else { heap = h.elements[Cont.HC_DYNLINK]; cont.fillFromVector(h); } }
/* fillCache */ public static void fillCache() { #if HAS_PERFORMANCE_COUNTERS if (stackReloadCounter != null) stackReloadCounter.Increment(); #endif cont = ROOT; SVL h = heap as SVL; if (h == null) { Exn.internalError ("fillCache: Cont.heap is not a vector"); } else { heap = h.elements[Cont.HC_DYNLINK]; cont.fillFromVector (h); } }
// save that assumes that lastslot is < num slots. public static void save_small (int lastslot) { if (cont == LIMIT) { heap = copyOutStack(); cont = SENTINEL; } cont = cont.after; cont.prepare_small (lastslot); cont.Slot0 = Reg.ProcRegister0; }
public static void save0 () { if (cont == LIMIT) { heap = copyOutStack(); cont = SENTINEL; } cont = cont.after; cont.prepare0 (); cont.Slot0 = Reg.ProcRegister0; }