Пример #1
0
 // 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;
 }
Пример #2
0
 /* pop
  */
 public static void pop()
 {
     cont.lastslot = 0;
     cont          = cont.before;
     if (cont == SENTINEL)
     {
         fillCache();
     }
 }
Пример #3
0
        // 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;
            }
        }
Пример #4
0
 // 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;
 }
Пример #5
0
 public static void save0()
 {
     if (cont == LIMIT)
     {
         heap = copyOutStack();
         cont = SENTINEL;
     }
     cont = cont.after;
     cont.prepare0();
     cont.Slot0 = Reg.ProcRegister0;
 }
Пример #6
0
        /* 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);
        }
Пример #7
0
  // 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();
  }
Пример #8
0
        // 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();
        }
Пример #9
0
        /* 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);
            }
        }
Пример #10
0
 // 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;
 }
Пример #11
0
  /* 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);
	}
  }
Пример #12
0
  /* pop
   */
  public static void pop()
  {
    cont.lastslot = 0;
    cont = cont.before;
    if (cont == SENTINEL) {
	fillCache();
	}
  }
Пример #13
0
  // 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;
  }
Пример #14
0
  public static void save0 ()
  {
    if (cont == LIMIT) {
	heap = copyOutStack();
	cont = SENTINEL;
	}
    cont = cont.after;
    cont.prepare0 ();
    cont.Slot0 = Reg.ProcRegister0;
  }