MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / compile

Method compile

crates/bench-api/src/lib.rs:553–576  ·  view source on GitHub ↗
(&mut self, bytes: &[u8])

Source from the content-addressed store, hash-verified

551 }
552
553 fn compile(&mut self, bytes: &[u8]) -> Result<()> {
554 self.module = None;
555 self.component = None;
556
557 let mut builder = CodeBuilder::new(self.linker.engine());
558 builder.wasm_binary(bytes, None)?;
559
560 match builder.hint() {
561 Some(CodeHint::Component) => {
562 (self.compilation_start)(self.compilation_timer);
563 let component = builder.compile_component()?;
564 (self.compilation_end)(self.compilation_timer);
565 self.component = Some(component);
566 }
567 Some(CodeHint::Module) | None => {
568 (self.compilation_start)(self.compilation_timer);
569 let module = builder.compile_module()?;
570 (self.compilation_end)(self.compilation_timer);
571 self.module = Some(module);
572 }
573 }
574
575 Ok(())
576 }
577
578 fn instantiate(&mut self) -> Result<()> {
579 self.store_and_instance = None;

Callers 1

wasm_bench_compileFunction · 0.45

Calls 7

OkFunction · 0.85
wasm_binaryMethod · 0.80
hintMethod · 0.80
compile_moduleMethod · 0.80
newFunction · 0.50
engineMethod · 0.45
compile_componentMethod · 0.45

Tested by

no test coverage detected