Esempio n. 1
0
        public static bool Exit(out object answer, object arg)
        {
            UnwinderState env = new UnwinderState(null);

            env.ExitValue = arg;
            // Return from the primitive with instructions to unwind the stack.
            answer = new TailCallInterpreter(Interpreter.UnwindStackExpression, env);
            return(true);
        }
Esempio n. 2
0
        public static bool WithinControlPoint(out object answer, object arg0, object arg1)
        {
            // extreme hair ahead

            IApplicable thunk = arg1 as IApplicable;

            if (thunk == null)
            {
                throw new NotImplementedException("Thunk is not applicable.");
            }

            // Create an initial unwinder state.  After reload, we resume at
            // WithinControlPointFrame.
            UnwinderState env = new UnwinderState((ControlPoint)arg0, new WithinControlPointFrame(thunk));

            // Return from the primitive with instructions to unwind the stack.
            answer = new TailCallInterpreter(Interpreter.UnwindStackExpression, env);
            return(true);
        }
Esempio n. 3
0
        public static bool CallWithCurrentContinuation(out object answer, object arg)
        {
            //if (cwccTroubleCount++ > 7) Debugger.Break ();
            // extreme hair ahead

            IApplicable receiver = arg as IApplicable;

            if (receiver == null)
            {
                throw new NotImplementedException("Receiver cannot be applied.");
            }
            // Create an initial unwinder state.  After reload, we resume at
            // CWCCFrame0.
            UnwinderState env = new UnwinderState(new CWCCFrame0(receiver));

            // Return from the primitive with instructions to unwind the stack.
            answer = new TailCallInterpreter(Interpreter.UnwindStackExpression, env);
            return(true);
        }
Esempio n. 4
0
        public static bool WithinControlPoint(out object answer, object arg0, object arg1)
        {
            // extreme hair ahead

            IApplicable thunk = arg1 as IApplicable;
            if (thunk == null) throw new NotImplementedException ("Thunk is not applicable.");

            // Create an initial unwinder state.  After reload, we resume at
            // WithinControlPointFrame.
            UnwinderState env = new UnwinderState ((ControlPoint) arg0, new WithinControlPointFrame (thunk));

            // Return from the primitive with instructions to unwind the stack.
            answer = new TailCallInterpreter (Interpreter.UnwindStackExpression, env);
            return true;
        }
Esempio n. 5
0
 public static bool Exit(out object answer, object arg)
 {
     UnwinderState env = new UnwinderState (null);
     env.ExitValue = arg;
     // Return from the primitive with instructions to unwind the stack.
     answer = new TailCallInterpreter (Interpreter.UnwindStackExpression, env);
     return true;
 }
Esempio n. 6
0
        public static bool CallWithCurrentContinuation(out object answer, object arg)
        {
            //if (cwccTroubleCount++ > 7) Debugger.Break ();
            // extreme hair ahead

            IApplicable receiver = arg as IApplicable;
            if (receiver == null) throw new NotImplementedException ("Receiver cannot be applied.");
            // Create an initial unwinder state.  After reload, we resume at
            // CWCCFrame0.
            UnwinderState env = new UnwinderState (new CWCCFrame0 (receiver));

            // Return from the primitive with instructions to unwind the stack.
            answer = new TailCallInterpreter (Interpreter.UnwindStackExpression, env);
            return true;
        }