Open rachitnigam opened 6 years ago
Will there be a way to reference those comments from this issue?
Annotations might have abitrary non-flat functions.
@jpolitz yeah, I'm adding the comments here.
PostloadHooks can also capture: https://github.com/brownplt/pyret-lang/blob/75f1fca9e4de3be1a582462bd4a112cda73783ee/src/js/base/handalone.js#L88
Not sure why this one happens: https://github.com/brownplt/pyret-lang/blob/75f1fca9e4de3be1a582462bd4a112cda73783ee/src/js/base/handalone.js#L160
@jpolitz mentioned to me that a student in Shriram's class also found the non-flat annotation bug. As note to whoever is trying to fix it on master: adding a safeCall here: https://github.com/brownplt/pyret-lang/blob/75f1fca9e4de3be1a582462bd4a112cda73783ee/src/js/base/runtime.js#L5233
will also force you to put a safeCall here: https://github.com/brownplt/pyret-lang/blob/75f1fca9e4de3be1a582462bd4a112cda73783ee/src/js/base/runtime.js#L5296
doing so will break other things because funToReturn
(the function containing call to makeConstructor
) is often called from contexts that can't capture the stack (I think there is particular one that fails from makeFailureResult
).
I don't have a complete solution right now since for the stopify branch, I just disable capturing when calling makeConstructor
.
While working on Stopify, I found some calls in the runtime that try to capture the stack but are in a context that can't capture the stack leading to either code being skipped or runtime errors. I'll add them as comments. For each call, we have to either wrap it in a safeCall or make sure we never call a function that tries to capture.