WrappedObject/Object/NativeMethod aren't genuinely Sync
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- rust
- Domain
- operating-systems
Research direction
Start by reading the linked comment on #324 and tracing the relationships among NativeMethod, Object, WrappedObject, and NoSendInterpreter. Compare the three approaches described in the issue, including how interpreter-specific closures and object transfer should work. Done means the chosen design makes the Send and Sync guarantees accurate without losing support for non-Send native methods.
Written by the indexing model from the issue text.
Description
This issue is born out of my comment on #324 about NativeMethod.
NativeMethod does not have type bounds enforcing that its contained closure is Send. Therefore Object and WrappedObject can't be Send either.
To avoid cluttering #324 - there's actually a reasonably straightforward fix for FixedRegisters, I'm going to continue the NativeMethod discussion here.
Firstly, should we allow non-Send NativeMethods for NoSendInterpreter? My feeling is yes, we should. It stands to reason that if you're using a non-Send interpreter you have a good reason for that, so we should accept closures that work with the types you're using.
Secondly, how?
The fact that WrappedObject can contain a NativeMethod (via Object), and NativeMethod refers to WrappedObject means there's effectively a cycle in type references.
I can think of three ways:
- Deal with horrendous generic types and bounds - I don't think there's a straightforward way of limiting the generic types, they'll touch pretty much every other type in the crate. I'm still not entirely sure it actually is even possible, because of the cycle in type references.
- Remove
NativeMethodfromObjectcompletely. ThenObjectis effectivelyAmlObject, we'd need aNonAmlObjectto holdNativeMethodand anything else we think of in future. Plus wrapper types that could hold either.- This would allow objects to be passed between two different interpreters, as they could be now.
- Turn
NativeMethodinto a kind of index - perhaps an AmlName, or even just an integer - then store the actual closures in a map in the namespace.- In this case, objects are less easily passed between two interpreters, as the NativeMethods would be different.
- I haven't fully worked out how any reference counting would work to ensure the closures are freed when needed, but it seems tractable.
I'd probably go for option 3, since it reduces the distinction between NativeMethod and other object types. This hopefully makes it less likely we'd introduce bugs related to it in future.
But thoughts from @IsaacWoods and anyone else interested are most welcome.
- Dominant language
- Rust
- Stars
- 249
- Forks
- 102
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 6
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-osdev/acpi
-
Difficulty 3/5 1-2 days Newbie friendliness 57/100
rust-osdev/acpi#383 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
rust-osdev/acpi#371 · 3 comments ·
-
Incorrect pkglength can cause panicMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
rust-osdev/acpi#362 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
rust-osdev/acpi#354 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
rust-osdev/acpi#353 ·
Similar issues
-
claim
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Nixitov/Riptide-Native#946 ·
Maintainers usually reply within 1 day
-
area: ai-assistants documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BetaBots-LLC/latticegate#17 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
storytold/craft-libs#5594 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
听歌识曲历史跳转后对应音源界面无法返回Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
LingyunStudio/RustMusic#16 ·