Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Cranelift: inliner remaps dynamic types with the dynamic-stack-slot offset

已关闭 适合新手
#14,569 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
compilers

调研方向

从 cranelift/codegen/src/inline.rs 中的 create_dynamic_types 开始,这里的偏移量是从 func.dynamic_stack_slots.len() 而不是 func.dfg.dynamic_types.len() 推导出来的;阅读内联槽位与动态类型是如何配对的,以确认正确的索引。通过 clif-util test(cargo run -p clif-util)复现 .clif 用例。当 ; check: 行匹配且 Context::compile 不再因 Undeclared dynamic vector type 而 panic 时即为完成;cranelift/filetests 下的 filetests 覆盖 test inline。

由索引模型根据 Issue 内容生成。

描述

bug cranelift

create_dynamic_types in cranelift/codegen/src/inline.rs computes its
offset from func.dynamic_stack_slots.len(), but it should use
func.dfg.dynamic_types.len(). Whenever the caller has a different number
of dynamic stack slots than dynamic types, inlined slots name the wrong
dynamic type. The verifier accepts the result, and then:

  • Context::compile panics with Undeclared dynamic vector type, if the
    index is out of range; or
  • the inlined slot silently gets one of the caller's unrelated types.
.clif Test Case
test inline
target aarch64

function %callee(i32) {
    gv0 = dyn_scale_target_const.i32x4
    dt0 = i32x4*gv0
    dss0 = explicit_dynamic_slot dt0
block0(v0: i32):
    v1 = splat.dt0 v0
    v2 = dynamic_stack_addr.i64 dss0
    store.dt0 notrap aligned v1, v2
    return
}

function %caller() {
    gv0 = dyn_scale_target_const.i64x2
    dt0 = i64x2*gv0
    dss0 = explicit_dynamic_slot dt0
    dss1 = explicit_dynamic_slot dt0
    fn0 = %callee(i32)
block0:
    v0 = iconst.i32 1
    call fn0(v0)
    return
}
; check: dss2 = explicit_dynamic_slot dt1
Steps to Reproduce
clif-util test test.clif
Expected Results

The inlined slot uses the copied callee type:
dss2 = explicit_dynamic_slot dt1.

Actual Results
    Missed #0: \bdss2 = explicit_dynamic_slot dt1\b
    >     dss2 = explicit_dynamic_slot dt2

The caller has no dt2. Compiling the inlined function panics with
Undeclared dynamic vector type: dt2.

Versions and Environment

Cranelift version or commit: 73b04cff33

Operating system: macOS 15.8.1

Architecture: aarch64

主要语言
Rust
星标
18.7k
派生
1.9k
平均合并
22 小时 23 分钟
30 天内合并 PR
311

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bytecodealliance/wasmtime 的其他 Issue

查看 bytecodealliance/wasmtime 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。