-
Notifications
You must be signed in to change notification settings - Fork 84
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
Extend no_std support #280
base: master
Are you sure you want to change the base?
Conversation
Resolves (Ralith#106)
Once_cell has better no_std support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need spin
and atomic-polyfill
. IMHO, it would be most reasonable to require either support for atomics via core
or via atomic-polyfill
. Usage of spin::Mutex
should then be replaced by an atomic counter.
This seems preferable as World::new_with_id
would have to unsafe as providing duplicate ID would break memory safety.
Makes perfect sense, I've adjusted accordingly. I also got rid of the |
But do we need to Or conversely, could we use only I think having both present is a significant increase in complexity that should be avoid if at all possible. |
Thanks for working on this (and thanks @adamreichold for helping with the review)! If you like, you could split out the more straightforward parts of this into a separate PR that we can merge right away.
This is completely fine. It will rarely occur in practice and do no harm when it does. |
I don't think so. Any architectures not listed in the README will just forward to the core::atomic implementation.
Another option would be to optionally outsource the ID generation using a macro (to set a global ID generator), but that doesn't sound much better to me. |
Maybe we should approach this differently: The world ID are used only to match up prepared queries. So maybe we should make the ID field and all types related to prepared queries dependent on the presence of atomics or (either atomic-polyfill or spin but not both)? That would mean that platforms not supporting the atomics fallback of our choice do not have access to prepared queries, but that appears to be a rather graceful degradation of functionality to me since everything else should continue to work. |
Seeing as MIPS/PPC support using But ultimately it's up to you, if that's the way you want to go I could try implementing it. |
Restricting prepared query availability makes sense to me. It prevents limitations on one platform from affecting everyone else, I'm not sure anyone's even using those APIs, and we can always restore them in the future without breaking anything. |
As atomics are used elsewhere in If you're happy with the outline I can tidy up the |
If atomics are used elsewhere and hence Sorry for leading you down the wrong path here. I completely forgot that borrow checking is thread safe and uses atomics as well. |
Just to double check, do you then want me to rip out the |
I was suggesting to remove |
Hi @Jinxit. I'm a maintainer of
I would love to add thumbv4t support to
FWIW, |
Gonna revisit this with the new changes to |
Any progress on this PR? I'd love to see the macro crate can actually support no_std. |
I don't think this work is active right now. If you're interested in working on this yourself, the portion that fixes #106 could probably be split out and merged pretty quickly, independent of the more difficult stuff. Maybe now that |
Yeah I'd love to take over the job and at least fix #106 |
Oh, you already did; great! |
Feedback very much welcome as I haven't studied this library in close enough detail to see the full consequences of this PR.
I've changed a few things:
atomic
which enables creating worlds with the atomically increasing ID that is currently used inWorld::new()
andWorld::default()
. When disabled the functionWorld::new_with_id(id: u64)
must be used instead.1 and 2 feel pretty natural, but 3 and 4 definitely requires some scrutiny to ensure I didn't mess something up. The tests run green and the Bundle derive macro seems to work as well.