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

Support native Rust applets #31

Closed
ia0 opened this issue Mar 22, 2023 · 1 comment · Fixed by #288
Closed

Support native Rust applets #31

ia0 opened this issue Mar 22, 2023 · 1 comment · Fixed by #288
Assignees
Labels
for:footprint Reduces firmware footprint for:performance Improves firmware performance lang:rust Modifies the Rust prelude needs:design Needs design to make progress prio:high Helps an important use case

Comments

@ia0
Copy link
Member

ia0 commented Mar 22, 2023

When the applet is written in Rust and it is not a security problem for the applet to be compiled as a native static library and linked with the platform (for example if the applet doesn't use unsafe and is cooperative), then users should be able to do so for performance, footprint, or other reasons.

A possible idea to do so would be to require the applet to be async. When a host function is called, the following would happen:

  • The host function would store some information for the scheduler and yield.
  • The scheduler would execute the function, store the result for the applet, and resume the applet.
  • The host function would then see the result and return it.

Scheduling between applets and threads can only be done when applets call a host function. But given that this feature should be used when the applet is somehow trusted, it seems reasonable that it is also well-behaving and yielding regularly enough.

@ia0 ia0 added enhancement needs:design Needs design to make progress lang:rust Modifies the Rust prelude for:performance Improves firmware performance for:footprint Reduces firmware footprint and removed enhancement labels Mar 22, 2023
@ia0
Copy link
Member Author

ia0 commented Mar 23, 2023

A simpler approach for a single applet would be to execute host functions without unwinding the stack. This means that the stack will grow proportionally to the WebAssembly threads stack (which shouldn't grow more than 5 threads for reasonable applets).

@ia0 ia0 self-assigned this Sep 19, 2023
@ia0 ia0 added the prio:high Helps an important use case label Sep 29, 2023
ia0 added a commit to ia0/wasefire that referenced this issue Nov 9, 2023
@ia0 ia0 closed this as completed in #288 Nov 9, 2023
ia0 added a commit that referenced this issue Nov 9, 2023
kofls pushed a commit to kofls/wasefire that referenced this issue Nov 27, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
for:footprint Reduces firmware footprint for:performance Improves firmware performance lang:rust Modifies the Rust prelude needs:design Needs design to make progress prio:high Helps an important use case
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant