Skip to content

Fix issues with Ractor#send with move option for Array/Hash/Struct #9475

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

Closed
wants to merge 1 commit into from

Conversation

luke-gru
Copy link
Contributor

Array/Hash/Struct were not being moved properly. If arrays were embedded they weren't being moved. Hashes were not being updated properly and write barriers were not being fired on newly moved object. Structs fields were not being set properly.

Also fix issue where moved object_id was different from original object's object id.

Fixes [Bug #20165]

@luke-gru
Copy link
Contributor Author

luke-gru commented Jan 10, 2024

WIP for now, I'm exporting some weird symbols in internal/hash.h for instance.
Also, I'm not firing write barriers on newly moved Array objects right now, I'll fix that soon.

Edit: fixed the issues mentioned in this comment. Also, now hides rec_hash from objectspace.

@luke-gru luke-gru force-pushed the ractor_move_fix_issues branch from e940870 to cb82923 Compare January 11, 2024 15:46
Array/Hash/Struct were not being moved properly. If arrays were embedded
they weren't being moved. Hashes were not being updated properly and
write barriers were not being fired on newly moved object. Structs
fields were not being set properly.

Also fix issue where moved object_id was different from original
object's object id.

Fixes [Bug #20165]
@luke-gru luke-gru force-pushed the ractor_move_fix_issues branch from cb82923 to eff9423 Compare January 11, 2024 16:14
@nobu nobu requested a review from ko1 January 18, 2024 14:37
@tenderlove
Copy link
Member

If arrays were embedded they weren't being moved.

Why is this? Just from reading the patch I don't understand why they need to be unembedded to move. It seems like we'd want to keep embedded arrays embedded (since its a nice optimization)

@luke-gru
Copy link
Contributor Author

luke-gru commented Feb 9, 2024

Yeah I agree about keeping arrays embedded. I was just creating a first pass at getting things correct, then I wanted to look into keeping the optimizations. With the way that objects are moved now, this seemed like the easy way to get it to work. For embedded arrays, I still need to look into how to copy them as I'm unfamiliar with how they work exactly (for example, if all arrays have the same embedded size, or if different objects in different size pools have different capacities). In reviewing this PR though, there are other issues other than the arrays (memory leak issues), so I think I'll close this PR and put the object_id stuff in a separate pull request. Then when I have time I'll look into doing these fixes properly.

@luke-gru luke-gru closed this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants