knocked out the painful bug with call-with-continuation-prompt: I was incorrectly computing environment size when constructing the prompt frame.
This commit is contained in:
parent
3c0d491705
commit
744356b3a3
|
@ -583,7 +583,7 @@ EOF
|
||||||
(assemble-label (make-Label (LinkedLabel-label label)))])))]
|
(assemble-label (make-Label (LinkedLabel-label label)))])))]
|
||||||
|
|
||||||
[(PushControlFrame/Prompt? stmt)
|
[(PushControlFrame/Prompt? stmt)
|
||||||
(format "M.c.push(new RT.CallFrame(~a,M.p)); M.addPrompt(~a,false);"
|
(format "M.c.push(new RT.CallFrame(~a,M.p)); M.addPrompt(~a,false,M.e.length);"
|
||||||
(let: ([label : (U Symbol LinkedLabel) (PushControlFrame/Prompt-label stmt)])
|
(let: ([label : (U Symbol LinkedLabel) (PushControlFrame/Prompt-label stmt)])
|
||||||
(cond
|
(cond
|
||||||
[(symbol? label)
|
[(symbol? label)
|
||||||
|
|
|
@ -3177,7 +3177,7 @@
|
||||||
M.e.pop();
|
M.e.pop();
|
||||||
M.p = proc;
|
M.p = proc;
|
||||||
M.a = 0;
|
M.a = 0;
|
||||||
M.addPrompt(promptTag, false);
|
M.addPrompt(promptTag, false, M.e.length);
|
||||||
baselib.functions.rawApply(M);
|
baselib.functions.rawApply(M);
|
||||||
},
|
},
|
||||||
[]);
|
[]);
|
||||||
|
@ -3272,13 +3272,17 @@
|
||||||
handler = makeDefaultPromptHandler(promptTag);
|
handler = makeDefaultPromptHandler(promptTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
M.p = proc;
|
M.p = proc;
|
||||||
if (M.a >= 1) { M.e.pop(); } // the test is redundant, but I want the parallelism.
|
if (M.a >= 1) { M.e.pop(); } // the test is redundant, but I want the parallelism.
|
||||||
if (M.a >= 2) { M.e.pop(); }
|
if (M.a >= 2) { M.e.pop(); }
|
||||||
if (M.a >= 3) { M.e.pop(); }
|
if (M.a >= 3) { M.e.pop(); }
|
||||||
M.a = Math.max(M.a - 3, 0);
|
M.a = Math.max(M.a - 3, 0);
|
||||||
M.addPrompt(promptTag, handler);
|
|
||||||
|
// subtle: the prompt's environment is the one _after_ the current call!
|
||||||
|
// That's why we need to do M.e.length - M.a: the environment currently
|
||||||
|
// has extra values due to us calling the prompt handler here.
|
||||||
|
M.addPrompt(promptTag, handler, M.e.length - M.a);
|
||||||
|
|
||||||
baselib.functions.rawApply(M);
|
baselib.functions.rawApply(M);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -499,10 +499,11 @@
|
||||||
M.c.pop();
|
M.c.pop();
|
||||||
return(M.p.mvr)(M);
|
return(M.p.mvr)(M);
|
||||||
};
|
};
|
||||||
Machine.prototype.addPrompt = function(promptTag, abortHandlerClosure) {
|
|
||||||
|
Machine.prototype.addPrompt = function(promptTag, abortHandlerClosure, envLength) {
|
||||||
this.c.push(new PromptFrame(justReturn,
|
this.c.push(new PromptFrame(justReturn,
|
||||||
promptTag,
|
promptTag,
|
||||||
this.e.length,
|
envLength,
|
||||||
abortHandlerClosure));
|
abortHandlerClosure));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user