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

Method get_global

crates/fuzzing/src/oracles/diff_v8.rs:229–244  ·  view source on GitHub ↗
(&mut self, global_name: &str, ty: DiffValueType)

Source from the content-addressed store, hash-verified

227 }
228
229 fn get_global(&mut self, global_name: &str, ty: DiffValueType) -> Option<DiffValue> {
230 if let DiffValueType::V128 = ty {
231 return None;
232 }
233 let mut isolate = self.isolate.borrow_mut();
234 let mut scope = v8::HandleScope::new(&mut *isolate);
235 let context = v8::Local::new(&mut scope, &self.context);
236 let global = context.global(&mut scope);
237 let mut scope = v8::ContextScope::new(&mut scope, context);
238
239 let name = v8::String::new(&mut scope, "GLOBAL_NAME").unwrap();
240 let memory_name = v8::String::new(&mut scope, global_name).unwrap();
241 global.set(&mut scope, name.into(), memory_name.into());
242 let val = eval(&mut scope, "WASM_INSTANCE.exports[GLOBAL_NAME].value").unwrap();
243 Some(get_diff_value(&val, ty, &mut scope))
244 }
245
246 fn get_memory(&mut self, memory_name: &str, shared: bool) -> Option<Vec<u8>> {
247 let mut isolate = self.isolate.borrow_mut();

Callers 4

differentialFunction · 0.45
smoke_test_engineFunction · 0.45
instance_get_globalFunction · 0.45

Calls 6

evalFunction · 0.85
get_diff_valueFunction · 0.85
globalMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45
setMethod · 0.45

Tested by 2

instance_get_globalFunction · 0.36