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

Method call_raw

cranelift/filetests/src/function_runner.rs:436–469  ·  view source on GitHub ↗
(
        &self,
        trampoline_ptr: *const u8,
        function_ptr: *const u8,
        arguments_address: *mut u128,
    )

Source from the content-addressed store, hash-verified

434 }
435
436 unsafe fn call_raw(
437 &self,
438 trampoline_ptr: *const u8,
439 function_ptr: *const u8,
440 arguments_address: *mut u128,
441 ) {
442 match self.module.isa().triple().architecture {
443 // For the pulley target this is pulley bytecode, not machine code,
444 // so run the interpreter.
445 Architecture::Pulley32
446 | Architecture::Pulley64
447 | Architecture::Pulley32be
448 | Architecture::Pulley64be => {
449 let mut state = pulley::Vm::new().unwrap();
450 unsafe {
451 state.call(
452 NonNull::new(trampoline_ptr.cast_mut()).unwrap(),
453 &[
454 pulley::XRegVal::new_ptr(function_ptr.cast_mut()).into(),
455 pulley::XRegVal::new_ptr(arguments_address).into(),
456 ],
457 [],
458 );
459 }
460 }
461
462 // Other targets natively execute this machine code.
463 _ => {
464 let callable_trampoline: fn(*const u8, *mut u128) -> () =
465 unsafe { mem::transmute(trampoline_ptr) };
466 callable_trampoline(function_ptr, arguments_address);
467 }
468 }
469 }
470}
471
472/// Compilation Error when compiling a function.

Callers 1

callMethod · 0.45

Calls 5

newFunction · 0.50
tripleMethod · 0.45
isaMethod · 0.45
unwrapMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected