Linking: recursion through a source callee (ListStack.push) gives an empty summary; push/pop depth; list of lists ends in ∩

未关闭
#235 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java, kotlin

调研方向

Start with the analyzer test in CommonTest and the reduced H4–H6 examples, then trace how recursive summaries and LS.push/pop links are composed. Reproduce the reported results with setMaxIterations(10) and inspect the mem composition-table cell for gap 3. Done means all four gaps are addressed, including dependence reaching the caller’s result in the fernflower 2c target.

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

描述

Found while reducing fernflower's Statement.getPostReversePostOrderList (dynamic modification check, 2c: the returned list holds the receiver's statements, maddi says @Independent). The real code builds a StrongConnectivityHelper from this; its recursive visit pushes nodes on a ListStack (a subclass of ArrayList with a pointer field) and pops them into lists of components.

Reduced shapes (analyzer test, CommonTest, setMaxIterations(10)), with today's results:

static class LS<T> extends ArrayList<T> {
    private int pointer;
    public void push(T item) { this.add(item); pointer++; }
    public T pop() { pointer--; T o = this.get(pointer); this.remove(pointer); return o; }
}
static class H5 {                       // recursion + push
    private final LS<S> comp = new LS<>();
    void visit(S s) { comp.push(s); for (S t : s.succ) visit(t); }
}
static class H6 {                       // recursion + add: fine
    private final List<S> comp = new ArrayList<>();
    void visit(S s) { comp.add(s); for (S t : s.succ) visit(t); }
}
static class H4 {                       // push, then pop into a list of lists, no recursion
    private final LS<S> comp = new LS<>();
    private final List<List<S>> comps = new ArrayList<>();
    void visit(S s) {
        comp.push(s);
        List<S> c = new ArrayList<>(); S in;
        do { in = comp.pop(); c.add(in); } while (in != s);
        comps.add(c);
    }
}
method links param 0
LS.push 0:item∈∈this*.§tss @Independent(hc=true)
LS.pop pop∈∈this*.§tss
H6.visit 0:s∈this.comp*.§$s, … @Dependent
H4.visit 0:s∈∈this.comp*.§$ss, 0:s∩this.comps*.§$ss @Dependent
H5.visit [-] (empty) @Independent

Three gaps:

  1. Recursion with a source callee loses everything. H5.visit gets an empty summary, while H6.visit (same recursion, List.add instead of push) is fine and H4.visit (push without recursion) keeps s in comp. In the recursive call cycle, push's link seems not to be applied to the first-pass summary.
  2. LS.push/pop link at the wrong depth. LS<T> extends ArrayList<T>; item should be ∈ this.§ts, not ∈∈ this*.§tss. That depth carries over to H4 (∈∈ this.comp*.§$ss).
  3. Popping into a list of lists ends in ∩: 0:s ∩ this.comps*.§$ss instead of a membership two levels down, and ∩ does not count for independence.

Separately, at the caller none of the helper variants carry dependence back: List<S> pN() { return new HN(this).exits(); } is @Independent for all of them, including H0, which has none of the three gaps (a plain List<S> comp, the constructor calls visit(start.getFirst()) which does comp.add(s), exits() returns new ArrayList<>(comp); H0.<init> and H0.visit param 0 are @Dependent). So the step from a helper object built from this back to the caller's result is a fourth gap, not yet reduced further.

The fernflower 2c target needs all four. Gap 3 is related to the mem cell of the composition table (⊆∘∋ = ∋?, gate MONOTABLE=mem), not default yet.

主要语言
Java
星标
1
派生
1
平均合并
48 分钟
30 天内合并 PR
2

环境准备

从这里开始

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

CodeLaser/maddi 的其他 Issue

查看 CodeLaser/maddi 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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