Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a0faf93
environ: track per-table mutability bit during translation
matthargett May 22, 2026
5bd401f
cranelift: lower constant-index call_indirect to direct call
matthargett May 22, 2026
8f83121
cranelift: elide indirect-call sig check on uniform-typed immutable t…
matthargett May 22, 2026
de0c5ab
cranelift: elide funcref-null check when no precomputed slot is null
matthargett May 22, 2026
bb6563d
cranelift: skip per-dispatch table-bound load when table cannot grow
matthargett May 22, 2026
7b2110f
environ: integration tests for analyze_table_mutability
matthargett May 22, 2026
683f14a
soundness fixes for the call_indirect optimizations
matthargett May 22, 2026
8ca462d
port call_indirect elisions to upstream table_initialization model
matthargett May 28, 2026
937c4e7
tests: runtime coverage for call_indirect on immutable tables
matthargett Jun 10, 2026
3352ca4
pulley: add xband_s8 + br_if fused dispatch ops
matthargett May 22, 2026
5b6e1bf
cranelift: Lower::sink_pure_inst — absorb pure ALU ops into terminators
matthargett May 22, 2026
4019400
cranelift/pulley: fuse band+brif at call_indirect lazy-init site
matthargett May 22, 2026
e7e7a6d
pulley: add xfuncref_dispatch fused dispatch ops
matthargett May 22, 2026
a26cd28
cranelift: LowerBackend::pre_lower hook + sink_pure_inst loads
matthargett May 22, 2026
aff4f82
cranelift/pulley: fuse brif + 2 xloads at call_indirect dispatch tail
matthargett May 22, 2026
8d106a9
cranelift/pulley: fix phase-2 fusion missing on pulley32
matthargett May 22, 2026
f132ce3
tests: corner-case coverage for Pulley call_indirect fusion
matthargett May 22, 2026
b0b15b8
pulley/cranelift: phase-3 fusion (xband + funcref dispatch in one op)
matthargett May 22, 2026
69201c2
pulley: add call_indirect{1,2,3,4} fused indirect-call ops
matthargett May 22, 2026
c08ada9
cranelift/pulley: pass first 4 indirect-call args via call_indirectN
matthargett May 22, 2026
c800891
pulley: trap on null in 8 fused funcref-dispatch handlers
matthargett May 22, 2026
45c7f7e
adapt to the split table-mutability base
matthargett Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cranelift/codegen/meta/src/pulley.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ impl Inst<'_> {
// Skip special instructions not used in Cranelift.
"XPush32Many" | "XPush64Many" | "XPop32Many" | "XPop64Many" => true,

// Phase-3 fused dispatch op: 3 writable results would
// require extending the auto-codegen `results[..]` match
// arms below. The op is emitted only via the hand-written
// `MInst::BandFuncrefDispatch` path, so no auto-generated
// ISLE rule is needed — skip here.
n if n.starts_with("XbandFuncrefDispatch") => true,

// Skip more branching-related instructions.
n => n.starts_with("Br"),
}
Expand Down
42 changes: 42 additions & 0 deletions cranelift/codegen/src/isa/pulley_shared/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,48 @@
;; Jump to `then` if `c` is true, otherwise to `else`.
(BrIf (cond Cond) (taken MachLabel) (not_taken MachLabel))

;; Fused `band src, mask` + `brif src` emitted at the call_indirect
;; lazy-init brif site. `dst = src & sign_extend(mask)` is
;; unconditional; the branch test is on `src`'s low-32 or full-64 bits
;; per `size`. Pulley-side: `xband*_s8_br_if_*`.
(BandBrIf
(dst WritableXReg)
(src XReg)
(mask i8)
(size OperandSize)
(taken MachLabel)
(not_taken MachLabel))

;; Funcref-dispatch fusion: `brif (band v -2) + load code + load vmctx`
;; across the brif and its continuation block. Emitted at the
;; call_indirect lazy-init site under
;; `is_eagerly_initialized_funcref_table`. Pulley-side:
;; `xfuncref_dispatch_{x64,not_x64,x32,not_x32}`.
(FuncrefDispatch
(dst_code WritableXReg)
(dst_vmctx WritableXReg)
(src XReg)
(offset_code i8)
(offset_vmctx i8)
(size OperandSize)
(taken MachLabel)
(not_taken MachLabel))

;; FuncrefDispatch + the preceding `xband_s8 -2` absorbed. `src` is
;; the unmasked funcref; the fused op writes `dst_masked = src & -2`
;; so the brif's block-call-arg copy still has a producer.
;; Pulley-side: `xband_funcref_dispatch_{x64,not_x64,x32,not_x32}`.
(BandFuncrefDispatch
(dst_masked WritableXReg)
(dst_code WritableXReg)
(dst_vmctx WritableXReg)
(src XReg)
(offset_code i8)
(offset_vmctx i8)
(size OperandSize)
(taken MachLabel)
(not_taken MachLabel))

;; Load the memory address referenced by `mem` into `dst`.
(LoadAddr (dst WritableXReg) (mem Amode))

Expand Down
13 changes: 13 additions & 0 deletions cranelift/codegen/src/isa/pulley_shared/inst/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,19 @@ pub struct PulleyCall {
pub args: SmallVec<[XReg; 4]>,
}

/// Payload of `CallInfo` for `Inst::IndirectCall`. Mirror of `PulleyCall`:
/// the first 0–4 integer ABI args are tracked here so the emitted
/// `call_indirect{1,2,3,4}` opcode moves them into `x0..x3` itself
/// instead of regalloc synthesising `xmov`s. Remaining args use the
/// fixed-preg path in `CallInfo::uses`.
#[derive(Clone, Debug)]
pub struct PulleyCallIndirect {
/// The register holding the call target.
pub target: XReg,
/// Up to 4 integer args destined for `x0..x3`.
pub args: SmallVec<[XReg; 4]>,
}

pub use super::super::lower::isle::generated_code::AddrO32;

impl Copy for AddrO32 {}
Expand Down
Loading
Loading