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

Method get_context

crates/winch/src/compiler.rs:48–61  ·  view source on GitHub ↗

Get a compilation context or create a new one if none available.

(&self, translation: &ModuleTranslation)

Source from the content-addressed store, hash-verified

46
47 /// Get a compilation context or create a new one if none available.
48 fn get_context(&self, translation: &ModuleTranslation) -> CompilationContext {
49 self.contexts.lock().unwrap().pop().unwrap_or_else(|| {
50 let pointer_size = self.isa.pointer_bytes();
51 let vmoffsets = VMOffsets::new(pointer_size, &translation.module);
52 CompilationContext {
53 allocations: Default::default(),
54 builtins: BuiltinFunctions::new(
55 &vmoffsets,
56 self.isa.wasmtime_call_conv(),
57 CallingConvention::Default,
58 ),
59 }
60 })
61 }
62
63 /// Save a compilation context.
64 fn save_context(&self, mut context: CompilationContext, allocs: FuncValidatorAllocations) {

Callers 1

compile_functionMethod · 0.80

Calls 6

wasmtime_call_convMethod · 0.80
newFunction · 0.50
popMethod · 0.45
unwrapMethod · 0.45
lockMethod · 0.45
pointer_bytesMethod · 0.45

Tested by

no test coverage detected