-
-
Notifications
You must be signed in to change notification settings - Fork 669
GC/RT: Deferred Reference Counting? #1534
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
Comments
That's great idea! Totally agree we could use Deferred RC. Also interesting Lazy RC approach based on pure RC: #89 (comment) |
Little update from my side: Teared the compiler apart meanwhile, removed the previous mechanism and added enough of the new one to do some basic tests. Turned out that more intrinsics are necessary to handle all possible cases, leading to
Currently contemplating, as this is becoming more complicated as I go and I can't quite imagine how documentation for all this stuff would not be half a book. Once more considering to sledgehammer our way out of this entirely with stop-the-world mark-sweep for the time being. |
I don't think all that methods should be documented. As I understand only |
So I followed the rabbit hole I dug in my last comment to see where that leads and sledgehammered reference counting out of existence in a new branch, and wow, did I like that.
I then went a step further and burned the Going to think about this for a bit since a radical change like this is certainly, well, spicy. |
Spicy, difficult to deal with, and exciting. My guess is pulling the band aid off now is easier rather than later. Just leave us all some time to test it out first so we can make migration instructions (and develop our testing frameworks more properly if that's okay!) Change isn't always better. But if it make assemblyscript better in the long run, then we should accept the burden of migration sooner rather than later. |
So this just happened: Using the new tracing runtime, I managed to get the bootstrap test to work and decided to attach Rtrace to it expecting to make myself sad but this actually looks legit. Manually calling
indicating that there are 41 objects still alive in globals somewhere, about in the ballpark of what I'd expect. As one can see, the compiler needs something in between 16 and 32mb of memory to perform the bootstrap test when collecting at the end. The way this works now is that the loader itself implements Also added an experimental Open question remain how practical all this will be in the wild for long running or complex programs. |
Investigating the remaining 41 live objects, these are:
So that's working as intended :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Superseded by #1559 |
With the changes introduced in #1503, in particular having one more header word to work with, the following deferred mechanism akin to autorelease pools may be possible to improve our ARC implementation:
gcInfo2
(originally introduced for tracing) to maintain a per-function autorelease pool as a linked list-1
, so it can be distinguished fromnull
pool_track
in a code path, insert apool_create
incl. the necessary additional local at the start of a function, and apool_release
when exiting the function.Giving us:
Constraints.WILL_RETAIN
,LocalFlags.RETAINED
,Compiler#performAutoreleases
,finishAutoreleases
,skippedAutoreleases
,tryUndoAutorelease
,delayAutorelease
etc. from the compiler itself.release
, in that redundantretain
/release
pairs are implicitly deduplicated by means of adding objects to one pool max.I'm likely missing something, but seems promising, so pinning it here. @MaxGraey Thoughts?
The text was updated successfully, but these errors were encountered: