Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Clarified GC.addRoot/addRange behavior. #322

Merged
merged 2 commits into from
Nov 1, 2012

Conversation

dnadlinger
Copy link
Member

This pull request is the result of the »RFC: Pinning interface for the GC« discussion on digitalmars.D and a resulting rather long IRC discussion between Alex and me.

It updates the core.memory docs to reflect my understanding of the GC.addRoot resp. addRange functions, which as far as I can see matches the actual implementation. Still, it might be a good idea for somebody else to have a second look at the changes.

@dnadlinger dnadlinger closed this Oct 13, 2012
@dnadlinger dnadlinger reopened this Oct 13, 2012
@alexrp
Copy link
Member

alexrp commented Oct 19, 2012

Maybe also update removeRoot's docs just for good measure?

@dnadlinger
Copy link
Member Author

Yes, this would certainly be a good idea, and I already did that yesterday (as mentioned on IRC). Unfortunately, GitHub was offline when I had the changes ready, so I couldn't update the pull request. Will push the changes later today when I'm at home.

@alexrp
Copy link
Member

alexrp commented Oct 19, 2012

OK, thanks!

This commit merely swaps the two function definitions. addRoot and
addRange are really quite different semantically, there is no point
in mixing them.
@dnadlinger
Copy link
Member Author

@alexrp: The promised updates.

@dsimcha, @complexmath: You might want to have a look at this.

* extern(C) void addCallback(void function(void*), void*);
*
* // Allocate an object on the GC heap (this would usually be
* // some application-specific context data.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing closing paren.

@dnadlinger
Copy link
Member Author

@alexrp: The »Notes to implementors« section should probably also be updated as it uses addRoot and addRange in one breath – is it really required that the whole GC memory block added by addRoot is scanned conservatively, or did you merely include it because you assumed that the common definition of »root« also applies here?

@alexrp
Copy link
Member

alexrp commented Oct 20, 2012

From what I understand, addRoot currently scans the pointed-to object, too (in addition to considering it live), if it is a GC-managed block, yes?

@dnadlinger
Copy link
Member Author

Yes, it scans the whole block. But should we require conservative scanning? It might make sense for addRange, but I'm not so sure if it does here.

@alexrp
Copy link
Member

alexrp commented Oct 20, 2012

Right, let's require that the GC scan the pointed-to block if it's managed by the GC, but remove the requirement that it has to be conservative.

@dnadlinger
Copy link
Member Author

The block pointed to by addRoot always has to be managed by the GC, otherwise addRoot is effectively a no-op. Does this need further clarification?

@alexrp
Copy link
Member

alexrp commented Oct 20, 2012

Argh, no, the docs are clear enough about it. I'm just being silly.

@alexrp
Copy link
Member

alexrp commented Oct 24, 2012

@klickverbot ping; waiting for your changes to the notes to implementors list.

@dnadlinger
Copy link
Member Author

As discussed with Alex on IRC, I will submit the changes to the documentation comment as a separate pull request as further, only tangentially related discussion might be needed on that.

alexrp pushed a commit that referenced this pull request Nov 1, 2012
Clarified GC.addRoot/addRange behavior.
@alexrp alexrp merged commit c7383ee into dlang:master Nov 1, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants