wasmer icon indicating copy to clipboard operation
wasmer copied to clipboard

wasmer::EngineBuilder::engine returns a wasmer_compiler::Engine instead of wasmer::Engine

Open dsherret opened this issue 2 years ago • 2 comments

I've been trying to upgrade wasmer, but have been unable to because 3.x is very slow dropping instances of modules. In order to do this fast, I apparently need to share an engine across all the instances (https://github.com/wasmerio/wasmer/pull/3378#issuecomment-1327679422).

I just tried out wasmer 3.3 and was unable to upgrade because wasmer::EngineBuilder::engine returns a wasmer_compiler::Engine instead of wasmer::Engine and is therefore incompatible with EngineRef. For example, the following code does not work:

let compiler = Cranelift::default();
let engine = EngineBuilder::new(compiler).engine();
let engineref = EngineRef::new(&engine);
//                             ^^^^^^^ expected struct `Engine`, found struct `wasmer_compiler::engine::inner::Engine`
let module = Module::new(&engineref, &wasm_bytes)?;

dsherret avatar Jun 02 '23 21:06 dsherret

I've discovered a way to do this is to do:

let engine: wasmer::Engine = engine.into();
let engine_ref = EngineRef::new(&engine);

That said, this is not very discoverable. I feel like .engine() in EngineBuilder should still return a wasmer::Engine?

dsherret avatar Jun 04 '23 17:06 dsherret

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 16 '24 22:08 stale[bot]

Feel free to reopen the issue if it has been closed by mistake.

stale[bot] avatar Sep 17 '24 02:09 stale[bot]