public override bool Continue(out object answer, ref Control expression, ref Environment environment, object ev1) { object ev0; Environment env = environment; Control unevop = this.expression.Components [1]; while (unevop.EvalStep(out ev0, ref unevop, ref env)) { } ; #if DEBUG SCode.location = "Combination3"; #endif if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); } object evop; env = environment; unevop = this.expression.Operator; while (unevop.EvalStep(out evop, ref unevop, ref env)) { } ; #if DEBUG SCode.location = "Combination3"; #endif if (evop == Interpreter.UnwindStack) { throw new NotImplementedException(); } return(Interpreter.Call(out answer, ref expression, ref environment, evop, ev0, ev1, this.ev2)); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); NoteCalls(this.rand1); rand0TypeHistogram.Note(this.rand0Type); rand1TypeHistogram.Note(this.rand1Type); SCode.location = "PCondIsObjectType"; #endif Control unev = this.rand1; Environment env = environment; object ev1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); } unev = this.rand0; env = environment; object ev0; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination1Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } ObjectModel.IsPrimitiveObjectType(out answer, ev0, ev1); if ((answer is bool) && (bool)answer == false) { #if DEBUG NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); #endif expression = this.alternative; return(true); } else { #if DEBUG NoteCalls(this.consequent); consequentTypeHistogram.Note(this.consequentType); #endif expression = this.consequent; return(true); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rator); NoteCalls(this.rand0); NoteCalls(this.rand1); rand0TypeHistogram.Note(this.rand0Type); rand1TypeHistogram.Note(this.rand1Type); SCode.location = "StaticLet2"; #endif object ev1; Environment env = environment; Control unev = this.rand1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "StaticLet2"; #endif if (ev1 == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new Combination2Frame0(this, environment)); environment = env; answer = Interpreter.UnwindStack; return(false); } object ev0; env = environment; unev = this.rand0; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; #if DEBUG SCode.location = "StaticLet2"; #endif if (ev0 == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new Combination2Frame1(this, environment, ev1)); environment = env; answer = Interpreter.UnwindStack; return(false); } object [] cells = environment.GetValueCells(this.lambda.StaticMapping); #if DEBUG SCode.location = "StaticLet2"; #endif // StaticClosure cl = new StaticClosure ((StaticLambda) this.rator, environment); StaticClosure cl = new StaticClosure(this.lambda, environment.BaseEnvironment, cells); expression = this.body; environment = new StaticEnvironment(cl, new object [] { ev0, ev1 }); answer = null; return(true); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); NoteCalls(this.rand1); rand0TypeHistogram.Note(this.rand0Type); rand1TypeHistogram.Note(this.rand1Type); SCode.location = "PrimitiveIsObjectType"; #endif // Eval argument1 object ev1; Control unev = this.rand1; Environment env = environment; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveIsObjectType"; #endif if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } // Eval argument0 object ev0; unev = this.rand0; env = environment; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveIsObjectType.EvalStep"; #endif if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } if (ObjectModel.IsPrimitiveObjectType(out answer, ev0, ev1)) { throw new NotImplementedException(); } return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); rand0TypeHistogram.Note(this.rand0Type); NoteCalls(this.rand1); rand1TypeHistogram.Note(this.rand1Type); SCode.location = "PrimitiveGreaterThanFixnum"; #endif // Eval argument1 object ev1; Control unev = this.rand1; Environment env = environment; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveGreaterThanFixnum"; #endif if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } // Eval argument0 object ev0; unev = this.rand0; env = environment; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveGreaterThanFixnum"; #endif if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } // Greater-than-fixnum? answer = (int)ev0 > (int)ev1 ? Constant.sharpT : Constant.sharpF; return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.arg1); NoteCalls(this.arg2); rand1TypeHistogram.Note(this.rand1Type); rand2TypeHistogram.Note(this.rand2Type); SCode.location = "PrimitiveStringSetS"; #endif object ev2; Environment env = environment; Control unev = this.arg2; while (unev.EvalStep(out ev2, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveStringSetS"; #endif if (ev2 == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new PrimitiveCombination3Frame0(this, environment)); answer = Interpreter.UnwindStack; environment = env; return(false); } object ev1; env = environment; unev = this.arg1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveStringSetS"; #endif if (ev1 == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new PrimitiveCombination3Frame1(this, environment, ev2)); answer = Interpreter.UnwindStack; environment = env; return(false); } object ev0; if (environment.StaticValue(out ev0, this.rand0Name, this.rand0Offset)) { throw new NotImplementedException(); } answer = ((char [])ev0) [(int)ev1]; ((char [])ev0) [(int)ev1] = (char)ev2; return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm(); noteCalls(this.rand0); noteCalls(this.rand1); #endif // Eval argument1 object ev1; Control unev = this.rand1; Environment env = environment; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } // Eval argument0 object ev0; unev = this.rand0; env = environment; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } // Compute answer if (Cons.GeneralCarCdr(out answer, ev0, ev1)) { throw new NotImplementedException(); } return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.arg1); NoteCalls(this.arg2); rand1TypeHistogram.Note(this.rand1Type); rand2TypeHistogram.Note(this.rand2Type); SCode.location = "PrimitiveRecordSetA0"; #endif object ev2; Environment env = environment; Control unev = this.arg2; while (unev.EvalStep(out ev2, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveRecordSetA0"; #endif if (ev2 == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new PrimitiveCombination3Frame0(this, environment)); answer = Interpreter.UnwindStack; environment = env; return(false); } object ev1; env = environment; unev = this.arg1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveRecordSetA0"; #endif if (ev1 == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new PrimitiveCombination3Frame1(this, environment, ev2)); answer = Interpreter.UnwindStack; environment = env; return(false); } answer = ((Record)environment.Argument0Value).Set((int)ev1, ev2); return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm(); noteCalls(this.rand1); #endif // Eval argument1 object ev1; Control unev = this.rand1; Environment env = environment; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } // Eval argument0 object ev0; if (environment.FastLexicalRef(out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset)) { throw new NotImplementedException(); } // Compute answer answer = (int)ev0 + (int)ev1; return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); rand0TypeHistogram.Note(this.rand0Type); SCode.location = "PrimitiveVectorRefXA0"; #endif // Eval argument1 object ev1 = environment.Argument0Value; // Eval argument0 object ev0; Control unev = this.rand0; Environment env = environment; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveVectorRefXA0"; #endif if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } answer = ((object [])ev0) [(int)ev1]; return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); rand0TypeHistogram.Note(this.rand0Type); offsetHistogram [this.offset] += 1; SCode.location = "PrimitiveRecordRefXQ"; #endif // Eval argument0 object ev0; Control unev = this.rand0; Environment env = environment; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } answer = ((Record)ev0).Ref(this.offset); return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.arg2); rand2TypeHistogram.Note(this.rand2Type); SCode.location = "PrimitiveStringSetA0Q"; #endif object ev2; Environment env = environment; Control unev = this.arg2; while (unev.EvalStep(out ev2, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveStringSetA0Q"; #endif if (ev2 == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new PrimitiveCombination3Frame0(this, environment)); answer = Interpreter.UnwindStack; environment = env; return(false); } object ev0 = environment.Argument0Value; object ev1 = this.rand1Value; answer = ((char [])ev0) [(int)ev1]; ((char [])ev0) [(int)ev1] = (char)ev2; return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("PrimitiveIsIntEqQ.EvalStep"); noteCalls(this.rand1); #endif // Eval argument1 object ev1; Control unev = this.rand1; Environment env = environment; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } answer = (this.rand0Value == (int)ev1) ? Constant.sharpT : Constant.sharpF; return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("PrimitiveVector8BRefA0.EvalStep"); NoteCalls(this.rand1); #endif // Eval argument1 object ev1; Control unev = this.rand1; Environment env = environment; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } // Vector-8b-ref answer = (int)((char [])environment.Argument0Value) [(int)ev1]; return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rator); SCode.location = "Let1Q"; #endif object evop = null; Control unevop = this.rator; Environment env = environment; while (unevop.EvalStep(out evop, ref unevop, ref env)) { } ; #if DEBUG SCode.location = "Let1Q"; #endif if (evop == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new Combination1Frame1 (this, environment, evarg)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } return(((IApplicable)evop).Call(out answer, ref expression, ref environment, this.randValue)); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { int oldMask = 0; object returnValue = null; Control expr = null; Environment env = null; if (this.receiver.Call(out returnValue, ref expr, ref env, oldMask)) { while (expr.EvalStep(out returnValue, ref expr, ref env)) { } ; } if (returnValue == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new InterruptMaskFrame(this, oldMask)); answer = Interpreter.UnwindStack; environment = env; return(false); } // restore mask here answer = returnValue; return(false); }
public static bool Force(out object answer, object arg) { Promise p = (Promise)arg; if (p.IsForced) { answer = p.bodyOrValue; } else { object value = null; Control expression = (SCode)p.bodyOrValue; Environment env = (Environment)p.environmentOrTrue; while (expression.EvalStep(out value, ref expression, ref env)) { } ; if (value == Interpreter.UnwindStack) { throw new NotImplementedException(); } p.bodyOrValue = value; p.environmentOrTrue = true; answer = value; } return(false); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.lambda.Body); NoteCalls(this.rand); randTypeHistogram.Note(this.randType); bodyTypeHistogram.Note(this.bodyType); SCode.location = "SimpleLet1"; #endif object evarg = null; Control unev = this.rand; Environment env = environment; while (unev.EvalStep(out evarg, ref unev, ref env)) { } ; #if DEBUG SCode.location = "SimpleLet1"; #endif if (evarg == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new Let1Frame0(this, environment)); answer = Interpreter.UnwindStack; environment = env; return(false); } // this.closeCount += 1; // Use the base environment for lookup. object [] cells = environment.GetValueCells(this.lambda.StaticMapping); #if DEBUG SCode.location = "SimpleLet1"; #endif SimpleClosure cl = new SimpleClosure(this.lambda, environment.BaseEnvironment, cells); // object evop = null; // Control unevop = this.rator; // env = environment; // while (unevop.EvalStep (out evop, ref unevop, ref env)) { }; //#if DEBUG // SCode.location = "SimpleLet1"; //#endif // if (evop == Interpreter.UnwindStack) { // throw new NotImplementedException (); // //((UnwinderState) env).AddFrame (new Combination1Frame1 (this, environment, evarg)); // //answer = Interpreter.UnwindStack; // //environment = env; // //return false; // } expression = this.lambda.Body; environment = new SmallEnvironment1(cl, evarg); answer = null; // keep the compiler happy return(true); // return cl.Call (out answer, ref expression, ref environment, evarg); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand1); rand1TypeHistogram.Note(this.rand1Type); SCode.location = "PCondRecordRefS"; #endif Control unev = this.rand1; Environment env = environment; object ev1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PCondRecordRefS"; #endif if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); } object ev0; if (environment.StaticValue(out ev0, this.rand0Name, this.rand0Offset)) { throw new NotImplementedException(); } object result = ((Record)ev0).Ref((int)ev1); if (result is Boolean && (((bool)result) == false)) { #if DEBUG SCode.location = "-"; NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); SCode.location = "PCondRecordRefS"; #endif expression = this.alternative; answer = null; return(true); } else { #if DEBUG SCode.location = "-"; NoteCalls(this.consequent); consequentTypeHistogram.Note(this.consequentType); SCode.location = "PCondRecordRefS"; #endif expression = this.consequent; answer = null; return(true); } }
static public object Initial(SCode expression, Environment environment) { object answer; Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; #if DEBUG Timer tosProbe = new Timer(SCode.TopOfStackProbe, null, 5, 3); SCode.topOfStackTimer = tosProbe; #endif Control residual = expression.PartialEval(PartialEnvironment.Make((ITopLevelEnvironment)environment)).Residual; while (true) { answer = null; while (residual.EvalStep(out answer, ref residual, ref environment)) { } ; if (answer == Interpreter.UnwindStack) { // What are we doing here? Someone unwound the stack! // There are three possibilities to consider: // 1) A cwcc has just performed a destructive read of the stack. // In this case, we convert the newly captured frame list // into a control point and reload it. // // 2) A within-continuation has blown away the stack in order // to install a different control point. In this case we // reload the control point that was stored in the UnwinderState. // // 3) The stack was unwound in order to exit the interpreter. // In this case, we return from the initial continuation. if (((UnwinderState)environment).IsExit) { answer = ((UnwinderState)environment).ExitValue; break; } else { ControlPoint stateToRestore = ((UnwinderState)environment).ToControlPoint(); // the receiver gets control when the stack is put back. Control receiver = ((UnwinderState)environment).Receiver; // the rewind state goes in the closureEnvironment environment = new RewindState(stateToRestore, receiver); // Start reloading by returning control to the lowest // frame. residual = ((RewindState)environment).PopFrame(); } } } Debug.WriteLine("Interpreter exited with value " + answer.ToString()); return(answer); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); rand0TypeHistogram.Note(this.rand0Type); SCode.location = "PCondRecordRefXQ"; #endif Control unev = this.rand0; Environment env = environment; object ev0; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PCondRecordRefXQ"; #endif if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination1Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } object result = ((Record)ev0).Ref(this.rand1Value); if (result is Boolean && (((bool)result) == false)) { #if DEBUG SCode.location = "-"; NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); SCode.location = "PCondRecordRefXQ"; #endif expression = this.alternative; answer = null; return(true); } else { #if DEBUG SCode.location = "-"; NoteCalls(this.consequent); consequentTypeHistogram.Note(this.consequentType); SCode.location = "PCondRecordRefXQ"; #endif expression = this.consequent; answer = null; return(true); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); rand0TypeHistogram.Note(this.rand0Type); SCode.location = "POrIsEqXS.EvalStep"; #endif object ev1; if (environment.StaticValue(out ev1, this.rand1Name, this.rand1Offset)) { throw new NotImplementedException(); } Control unev = this.rand0; Environment env = environment; object ev0; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; #if DEBUG SCode.location = "POrXS.EvalStep"; #endif if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); //((UnwinderState) env).AddFrame (new PrimitiveCombination1Frame0 (this, environment)); //answer = Interpreter.UnwindStack; //environment = env; //return false; } if (!ObjectModel.SchemeEq(ev0, ev1)) { #if DEBUG SCode.location = "-"; NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); SCode.location = "POrIsEqXS.EvalStep"; #endif expression = this.alternative; answer = null; //happy compiler return(true); } else { answer = Constant.sharpT; return(false); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); procedureHistogram.Note(this.procedure); SCode.location = "POr1S"; #endif object ev0; if (environment.StaticValue(out ev0, this.arg0Name, this.arg0Offset)) { throw new NotImplementedException(); } #if DEBUG SCode.location = this.procedure.Name.ToString(); Primitive.hotPrimitives.Note(this.procedure); #endif // It is expensive to bounce down to invoke the procedure // we invoke it directly and pass along the ref args. if (this.method(out answer, ev0)) { TailCallInterpreter tci = answer as TailCallInterpreter; if (tci != null) { answer = null; // dispose of the evidence // set up the interpreter for a tail call Control cExpression = tci.Expression; Environment cEnvironment = tci.Environment; while (cExpression.EvalStep(out answer, ref cExpression, ref cEnvironment)) { } ; } } #if DEBUG SCode.location = "POr1S"; #endif if ((answer is bool) && (bool)answer == false) { #if DEBUG NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); #endif expression = this.alternative; return(true); } else { return(false); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand0); rand0TypeHistogram.Note(this.rand0Type); SCode.location = "PCondGreaterThanFixnumXQ"; #endif Control unev = this.rand0; Environment env = environment; object ev0; while (unev.EvalStep(out ev0, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PCondGreaterThanFixnumXQ"; #endif if (ev0 == Interpreter.UnwindStack) { throw new NotImplementedException(); } if ((int)ev0 > this.rand1Value) { #if DEBUG SCode.location = "-"; NoteCalls(this.consequent); consequentTypeHistogram.Note(this.consequentType); SCode.location = "PCondGreaterThanFixnumXQ"; #endif expression = this.consequent; answer = null; return(true); } else { #if DEBUG SCode.location = "-"; NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); SCode.location = "PCondGreaterThanFixnumXQ"; #endif expression = this.alternative; answer = null; return(true); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.rand1); rand1TypeHistogram.Note(this.rand1Type); SCode.location = "PCondIsEqCarA0"; #endif Control unev = this.rand1; Environment env = environment; object ev1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PCondIsEqCarA0"; #endif if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); } object ev0 = environment.Argument0Value; #if DEBUG SCode.location = "PCondIsEqCarA0"; #endif if (!ObjectModel.SchemeEq(((Cons)ev0).Car, ev1)) { #if DEBUG NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); #endif expression = this.alternative; answer = null; // happy compiler return(true); } else { #if DEBUG NoteCalls(this.consequent); consequentTypeHistogram.Note(this.consequentType); #endif expression = this.consequent; answer = null; // happy compiler return(true); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); noteCalls(this.rand1); rand1TypeHistogram.Note(this.rand1Type); SCode.location = "PCondIsCharEqL"; #endif Control unev = this.rand1; Environment env = environment; object ev1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); } object ev0; if (environment.FastLexicalRef(out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset)) { throw new NotImplementedException(); } if (ev0 is char && ev1 is char && (char)ev0 == (char)ev1) { #if DEBUG noteCalls(this.consequent); consequentTypeHistogram.Note(this.consequentType); #endif expression = this.consequent; answer = null; return(true); } else { #if DEBUG noteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); #endif expression = this.alternative; answer = null; return(true); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.predicate); predicateTypeHistogram.Note(this.predicateType); SCode.location = "Disjunction"; #endif Environment env = environment; Control pred = this.predicate; object ev; while (pred.EvalStep(out ev, ref pred, ref env)) { } ; #if DEBUG SCode.location = "Disjunction"; #endif if (ev == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new DisjunctionFrame(this, environment)); environment = env; answer = Interpreter.UnwindStack; return(false); } if (ev is bool && (bool)ev == false) { #if DEBUG SCode.location = "-"; NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); SCode.location = "Disjunction"; #endif // tail call alternative expression = this.alternative; answer = null; return(true); } else { // return answer answer = ev; return(false); } }
public override bool Continue(out object answer, ref Control expression, ref Environment environment, object value) { object evop = null; Control unevop = this.expression.Operator; Environment env = this.environment; while (unevop.EvalStep(out evop, ref unevop, ref env)) { } ; if (evop == Interpreter.UnwindStack) { throw new NotImplementedException(); } return(Interpreter.Call(out answer, ref expression, ref environment, evop, value)); }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); SCode.location = "PCondLessThanFixnumSXQ"; #endif Control unev = this.rand1; Environment env = environment; object ev1; while (unev.EvalStep(out ev1, ref unev, ref env)) { } ; #if DEBUG SCode.location = "PCondLessThanFixnumSXQ"; #endif if (ev1 == Interpreter.UnwindStack) { throw new NotImplementedException(); } object ev0; if (environment.StaticValue(out ev0, this.rand0Name, this.rand0Offset)) { throw new NotImplementedException(); } if ((int)ev0 < (int)ev1) { answer = this.consequentValue; return(false); } else { #if DEBUG SCode.location = "-"; NoteCalls(this.alternative); alternativeTypeHistogram.Note(this.alternativeType); SCode.location = "PCondLessThanFixnumSXQ"; #endif expression = this.alternative; answer = null; return(true); } }
public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("PrimitiveIsObjectEqSQ.EvalStep"); #endif object ev0; Control expr = this.rand0; Environment env = environment; while (expr.EvalStep(out ev0, ref expr, ref env)) { } ; #if DEBUG SCode.location = "PrimitiveIsObjectEqSQ.EvalStep.1"; #endif answer = (ev0 == this.rand1Value) ? Constant.sharpT : Constant.sharpF; return(false); }
private static void TakLoop(Control tak, Microcode.Environment initial) { object answer = null; while (tak.EvalStep (out answer, ref tak, ref initial)) { }; if ((int) answer != 7) throw new NotImplementedException (); return; }