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

internal: remove mark function from XML::Document #2926

Closed
wants to merge 1 commit into from

Conversation

flavorjones
Copy link
Member

What problem is this PR intended to solve?

remove mark function from XML::Document. originally introduced in dd07ce8, I don't think we need it anymore since cb1557d introduced TypedData conventions to support compaction.

cc @tenderlove and @byroot for a gut check

Have you included adequate test coverage?

existing coverage should be sufficient to detect if there's an issue with compaction.

Does this change affect the behavior of either the C or the Java implementations?

No behavior changes.

originally introduced in dd07ce8, I don't think we need it anymore
since cb1557d introduced TypedData conventions to support compaction.
Comment on lines -59 to -60
rb_gc_mark(tuple->doc);
rb_gc_mark(tuple->node_cache);
Copy link
Contributor

Choose a reason for hiding this comment

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

So if I understand correctly, these marks aren't necessary to prevent the objects being GCed, because one is a reference to self, and another is held some other way.

However they were added so the objects would be pinned.

Up until this point it checks out, but AFAIK we didn't add any dcompact functions, did we? At least not in the commit you linked. So we either need to add a compaction callback to update the references, or we need to keep them pined.

Copy link
Member Author

Choose a reason for hiding this comment

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

@byroot That's correct, they were being marked so that they wouldn't get relocated.

🤔 Ahh, you're right, we do need to implement dcompact, my bad.

Copy link
Member Author

Choose a reason for hiding this comment

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

Although: the reason this doesn't segfault now is, I think, because a Node calls rb_gc_mark on its Document owner, essentially keeping it pinned anyway.

@flavorjones flavorjones marked this pull request as draft July 10, 2023 16:32
@flavorjones flavorjones deleted the flavorjones-remove-xml-document-marking branch July 10, 2023 17:01
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

Successfully merging this pull request may close these issues.

None yet

2 participants