Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

no_std compatible #2368

Closed
Tim-Paik opened this issue Oct 22, 2022 · 9 comments
Closed

no_std compatible #2368

Tim-Paik opened this issue Oct 22, 2022 · 9 comments
Assignees
Labels
blocked Waiting for another code change enhancement New feature or request

Comments

@Tim-Paik
Copy link

I'm trying to run a boa engine on a bare metal environment, is this possible? Are there any current plans to support no_std?

@Tim-Paik Tim-Paik added the enhancement New feature or request label Oct 22, 2022
@jedel1043
Copy link
Member

jedel1043 commented Oct 22, 2022

That's a tough one. I'd have to ask, do you need to avoid all heap allocations or can you target alloc instead of core?

@Tim-Paik
Copy link
Author

That's a tough one. I'd have to ask, do you need to avoid all heap allocations or can you target alloc instead of core?

For this case, I think we can assume that alloc can be used, otherwise it would be too hard

@jedel1043
Copy link
Member

Then it shouldn't be too hard! Boa is self-contained, and doesn't make any file system calls (with the exception on Intl, since we need to get the machine locale of an user, but it should be trivial to skip doing that on no_std builds).

@jedel1043
Copy link
Member

jedel1043 commented Oct 29, 2022

I'll try to patch Boa with the changes on the weekend

@jedel1043 jedel1043 added the blocked Waiting for another code change label Oct 30, 2022
@jedel1043
Copy link
Member

Huh, so apparently the gc crate depends on std (https://github.com/Manishearth/rust-gc/blob/6c5f754682e573e4590b52168dce835bba28beaf/gc_derive/src/lib.rs#L59), but I'm pretty sure that was unintended, since core::ops::Drop exists. This unfortunately blocks this issue, but I'll open a PR on the gc crate to fix this ASAP.

@jedel1043
Copy link
Member

Ah, gc uses thread locals... https://github.com/Manishearth/rust-gc/blob/6c5f754682e573e4590b52168dce835bba28beaf/gc/src/gc.rs#L24

This unfortunately blocks us from having compatibility with no_std. We'll need to design our own garbage collector if we want this.

@Tim-Paik
Copy link
Author

Great work! In fact, I also tried to modify the boa myself, but it didn't work (x
I guess gc should be prepared to use threads for performance (though it's still single-threaded gc for now)

@jedel1043
Copy link
Member

Working on this at the moment.

@jedel1043 jedel1043 self-assigned this Jan 18, 2023
@jedel1043
Copy link
Member

Closing in favour of #2543.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
blocked Waiting for another code change enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants