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

Method block_call_arg_ty

cranelift/codegen/src/verifier/mod.rs:1548–1630  ·  view source on GitHub ↗
(
        &self,
        arg: BlockArg,
        inst: Inst,
        target_type: BlockCallTargetType,
        errors: &mut VerifierErrors,
    )

Source from the content-addressed store, hash-verified

1546 }
1547
1548 fn block_call_arg_ty(
1549 &self,
1550 arg: BlockArg,
1551 inst: Inst,
1552 target_type: BlockCallTargetType,
1553 errors: &mut VerifierErrors,
1554 ) -> Result<Option<Type>, ()> {
1555 match arg {
1556 BlockArg::Value(v) => Ok(Some(self.func.dfg.value_type(v))),
1557 BlockArg::TryCallRet(_) | BlockArg::TryCallExn(_) => {
1558 // Get the invoked signature.
1559 let et = match self.func.dfg.insts[inst].exception_table() {
1560 Some(et) => et,
1561 None => {
1562 errors.fatal((
1563 inst,
1564 self.context(inst),
1565 format!(
1566 "`retN` block argument in block-call not on `try_call` instruction"
1567 ),
1568 ))?;
1569 unreachable!()
1570 }
1571 };
1572 let exdata = &self.func.dfg.exception_tables[et];
1573 let sig = &self.func.dfg.signatures[exdata.signature()];
1574
1575 match (arg, target_type) {
1576 (BlockArg::TryCallRet(i), BlockCallTargetType::ExNormalRet)
1577 if (i as usize) < sig.returns.len() =>
1578 {
1579 Ok(Some(sig.returns[i as usize].value_type))
1580 }
1581 (BlockArg::TryCallRet(_), BlockCallTargetType::ExNormalRet) => {
1582 errors.fatal((
1583 inst,
1584 self.context(inst),
1585 format!("out-of-bounds `retN` block argument"),
1586 ))?;
1587 unreachable!()
1588 }
1589 (BlockArg::TryCallRet(_), _) => {
1590 errors.fatal((
1591 inst,
1592 self.context(inst),
1593 format!("`retN` block argument used outside normal-return target of `try_call`"),
1594 ))?;
1595 unreachable!()
1596 }
1597 (BlockArg::TryCallExn(i), BlockCallTargetType::Exception) => {
1598 if let Some(isa) = self.isa {
1599 match sig
1600 .call_conv
1601 .exception_payload_types(isa.pointer_type())
1602 .get(i as usize)
1603 {
1604 Some(ty) => Ok(Some(*ty)),
1605 None => {

Callers 1

typecheck_block_callMethod · 0.80

Calls 10

OkFunction · 0.85
fatalMethod · 0.80
value_typeMethod · 0.45
exception_tableMethod · 0.45
contextMethod · 0.45
signatureMethod · 0.45
lenMethod · 0.45
getMethod · 0.45
pointer_typeMethod · 0.45

Tested by

no test coverage detected