| 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. |