(&mut self, builder: &mut FunctionBuilder)
| 1576 | } |
| 1577 | |
| 1578 | fn generate_funcrefs(&mut self, builder: &mut FunctionBuilder) -> Result<()> { |
| 1579 | let usercalls: Vec<_> = self |
| 1580 | .resources |
| 1581 | .usercalls |
| 1582 | .iter() |
| 1583 | .map(|(name, signature)| { |
| 1584 | let user_func_ref = builder.func.declare_imported_user_function(name.clone()); |
| 1585 | let name = ExternalName::User(user_func_ref); |
| 1586 | (name, signature.clone()) |
| 1587 | }) |
| 1588 | .collect(); |
| 1589 | |
| 1590 | let lib_callconv = self.system_callconv(); |
| 1591 | let libcalls: Vec<_> = self |
| 1592 | .resources |
| 1593 | .libcalls |
| 1594 | .iter() |
| 1595 | .map(|libcall| { |
| 1596 | let pointer_type = Type::int_with_byte_size( |
| 1597 | self.isa.triple().pointer_width().unwrap().bytes().into(), |
| 1598 | ) |
| 1599 | .unwrap(); |
| 1600 | let signature = libcall.signature(lib_callconv, pointer_type); |
| 1601 | let name = ExternalName::LibCall(*libcall); |
| 1602 | (name, signature) |
| 1603 | }) |
| 1604 | .collect(); |
| 1605 | |
| 1606 | for (name, signature) in usercalls.into_iter().chain(libcalls) { |
| 1607 | let sig_ref = builder.import_signature(signature.clone()); |
| 1608 | let func_ref = builder.import_function(ExtFuncData { |
| 1609 | name, |
| 1610 | signature: sig_ref, |
| 1611 | |
| 1612 | // Libcalls can't be colocated because they can be very far away |
| 1613 | // from allocated memory at runtime, and additionally at this |
| 1614 | // time cranelift-jit puts all functions in their own mmap so |
| 1615 | // they also cannot be colocated. |
| 1616 | colocated: false, |
| 1617 | patchable: false, |
| 1618 | }); |
| 1619 | |
| 1620 | self.resources |
| 1621 | .func_refs |
| 1622 | .push((signature, sig_ref, func_ref)); |
| 1623 | } |
| 1624 | |
| 1625 | Ok(()) |
| 1626 | } |
| 1627 | |
| 1628 | fn generate_stack_slots(&mut self, builder: &mut FunctionBuilder) -> Result<()> { |
| 1629 | for _ in 0..self.param(&self.config.static_stack_slots_per_function)? { |
no test coverage detected