Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing large values is not stack-safe #146

Closed
jpolitz opened this issue Feb 22, 2014 · 1 comment
Closed

Printing large values is not stack-safe #146

jpolitz opened this issue Feb 22, 2014 · 1 comment

Comments

@jpolitz
Copy link
Member

jpolitz commented Feb 22, 2014

When printing large, nested objects, the printing algorithm holds on to state in a while worklist and makes recursive calls that can reach user callbacks, which can trigger stack operations. Pretty-printing a large AST of thousands of nodes in constructor notation can have unexpected results because of this.

The toReprJS function needs to be rewritten to take this into account (I believe @thejakeellis deserves credit for predicting this in early Jan). It currently uses safeCall to guard the callbacks, but the context of the safeCall is not stack-safe (it has a non-empty continuation that isn't made explicit). As a result information can be lost or completely erroneous results (e.g. a JavaScript string instead of a Pyret string) can be returned.

@blerner
Copy link
Member

blerner commented Feb 22, 2014

Most likely closed by 7098cc2. Some more testing is needed to be sure, but I have definitely gotten correct output in stack-overflowing situations using this algorithm that did not succeed with the previous one. The compiler still builds and passes all tests, so no regressions there...

@blerner blerner closed this as completed Feb 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants