DoCheckIn() public méthode

public DoCheckIn ( ) : object
Résultat object
Exemple #1
0
        private Stack checkInStackFrames()
        {
            // this is the first time we checked in
            if (stackULEs == null)
            {
                stackULEs = new Stack();
                for (savedTopOfStack = topOfStack;
                     savedTopOfStack != null;
                     savedTopOfStack = savedTopOfStack.Caller)
                    savedTopOfStack.DoCheckIn();

                savedTopOfStack = topOfStack;
                return null;
            }

            object zmULE = null;

            if (savedTopOfStack != null)
                zmULE = savedTopOfStack.DoCheckIn();

            // small optimization when no changes was made in the
            // current transition
            if (stackULEs.Count == 0 && zmULE == null)
            {
                Debug.Assert(savedTopOfStack == topOfStack);
                return null;
            }

            // the result
            Stack resStack = stackULEs;

            stackULEs = new Stack();

            ZingMethod stackFrame = topOfStack;

            // move newly pushed frames away from the result, save
            // them temporarily in stackULEs; while doing that, we
            // checkIn every newly pushed node
            while (resStack.Count > 0 && resStack.Peek() is UndoPush)
            {
                //object sfULE =
                // this would be the first time we check in these
                // freshly pushed nodes. so we discard their undo log
                // entries
                stackFrame.DoCheckIn();
                stackULEs.Push(resStack.Pop());
                stackFrame = stackFrame.Caller;
            }

            // everything below should be UndoPop's or UndoResetLastFunctionCompleted,
            // and if anything is to be saved, it should be right there at stackFrame
            Debug.Assert(resStack.Count == 0 || resStack.Peek() is UndoPop
                         || resStack.Peek() is UndoResetLastFunctionCompleted);
            Debug.Assert(savedTopOfStack == stackFrame);

            // insert zmULE between UndoPop objects and UndoPush
            // objects
            if (zmULE != null)
                resStack.Push(new UndoUpdate(this, zmULE));

            // move undoPush objects back into the result
            while (stackULEs.Count > 0)
                resStack.Push(stackULEs.Pop());

            savedTopOfStack = topOfStack;
            return resStack;
        }