-
Notifications
You must be signed in to change notification settings - Fork 329
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
One engine to rule them all #1753
Conversation
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.
Looks good to me.
This looks much simpler than the current version. Looks like the right approach: Funny how we migrated from a cached Store
to a cached Engine
to nothing cached but Module
.
pub fn make_engine(middlewares: &[Arc<dyn ModuleMiddleware>]) -> Engine { | ||
/// Creates an engine without a compiler. | ||
/// This is used to run modules compiled before. | ||
pub fn make_runtime_engine(memory_limit: Option<Size>) -> Engine { |
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.
Nice.
Nit: These can better live in their own engine.rs
for consistency.
@@ -35,14 +34,15 @@ pub fn main() { | |||
println!("wasm size: {wasm_size} bytes"); | |||
|
|||
// Compile module | |||
let module = module_compile(&wasm); | |||
let engine = make_compiling_engine(None, &[]); | |||
let module = compile(&engine, &wasm).unwrap(); |
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.
This compile
helper is now a little redundant / useless. I would say, let's either remove it, or use it everywhere instead of the explicit Module
creation.
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 kept it to hide some internals in one of the examples. Not sure anymore. I use it now in all places.
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.
Looks good 👍
Co-authored-by: Mauro Lacy <maurolacy@users.noreply.github.com>
Co-authored-by: Christoph Otter <chris@confio.gmbh>
This PR follows the recommendation of the Wasmer team to avoid using more engines than necessary.
We now have two main types of engines:
A few cool things happen here: