-
Notifications
You must be signed in to change notification settings - Fork 8
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
WIP: Implement reference counting #60
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit is rather large and contains unrelated changes that were necessary to retain sanity when refactoring this: * Move to using 'spago'. * (For now) Maintain an in-repo package-set of pure-c compatible packages. * Remove old examples, and replace by new "bottom" up tests. Eventually this folder will be renamed to "tests" or similar. * Add a "ctests" folder, for testing the runtime library directly.
The 'target' assignment would be overriden by subsequent calls and thus change the make rules. Holding onto and using $(1), however, circumvents that issue.
TODO: * Apply pass to PURS_ANY_THUNK_DEF bodies * Ensure not to release return value!
felixSchl
pushed a commit
to pure-c/purescript-prelude
that referenced
this pull request
Jul 23, 2019
The previous macros would not yield useful addresses when debugging memory leaks or other issues, as the line number would always be that of the macro itself. By removing the BODY from the macro, we recover more precise line numbers.
Since the actual package has no tests...
felixSchl
pushed a commit
to pure-c/purescript-console
that referenced
this pull request
Nov 11, 2019
felixSchl
pushed a commit
to pure-c/purescript-assert
that referenced
this pull request
Nov 13, 2019
felixSchl
pushed a commit
to pure-c/purescript-refs
that referenced
this pull request
Nov 13, 2019
felixSchl
pushed a commit
to pure-c/purescript-control
that referenced
this pull request
Nov 15, 2019
This comment has been minimized.
This comment has been minimized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #59
Introduce reference counting in order to avoid having to rely on a tracing GC.
Checklist, in order of priority:
purs_cons_t
reference counted and implement a free function on itpurs_cons_t
foreign
member in thepurs_any_t
structurepurs_str_new
struct purs_scope
purs_cons_t
usagepurs_foreign_t
usage*_new
callspurs_any_unthunk
- release intermediate resultsAllow for opt-in tracing GC (or drop support for tracing GC?)— out of scope for this PRreleaseResources
transform.The current implementation requires a ton of variables on the stack to ensure variables are not freed to early. Since dependencies between the variables is clearly visible, we should be able to re-use variables on the stack by releasing resources sooner (as soon as we know it's been retained by whatever ast node it was created for.)
Clang/GCC compiler extension looks interesting: https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization#Clang_and_GCC_%22cleanup%22_extension_for_C
Make AST transforms tail-recursive. This has been a problem prior to this PR, but is amplified by the large AST we produce.out of scopeImplement Write a transform that turns expressions into statements #48. This PR currently heavily relies on statement expressions, which makes it easy to run into this clang error:out of scope, seefatal error: bracket nesting level exceeded maximum of 256
-fbracket-depth=