Commit d937bea1
d937bea11938Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(analyze): post-annotate CallNode resweep for obj-recv bigint returns
@nd_inferred_type sweep at the end of annotate_all_node_types
already promoted SuperNode "int" entries to bigint; extend the
same shape to a CallNode whose receiver resolves to a concrete
user-class instance and whose resolved method returns bigint
post-promotion.
Narrow scope — only re-resolves when there's a definite obj recv and the method exists. Avoids the global rewrite that previously regressed self-host (when applied unconditionally, "int" defaults for unresolved CallNodes flipped to bigint).
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- d937bea11938
- Parent
- ea5c9399602b
spinel_analyze.rbmodifiedView file
@@ -21560,7 +21560,8 @@
2156021560
# Promote-mode safety: annotate may have produced stale "int"2156121561
# entries for nodes whose inferred type derived from cached2156221562
# state captured before promote_int_to_bigint_globally landed21563-
# (SuperNode reading cls_method_return's pre-promotion result).21563+
# (SuperNode reading cls_method_return's pre-promotion result,21564+
# CallNode chains whose mid-tree return type was cached).2156421565
# Sweep `@nd_inferred_type` again and rewrite "int" -> "bigint"2156521566
# for node kinds whose concrete C emit is always bigint when the2156621567
# underlying slot is promoted.@@ -21572,6 +21573,25 @@
2157221573
ntp = @nd_type[ni_p]2157321574
if ntp == "SuperNode" || ntp == "ForwardingSuperNode"2157421575
@nd_inferred_type[ni_p] = "bigint"21576+
elsif ntp == "CallNode"21577+
# Only re-resolve when there's a concrete recv class to consult21578+
# and the resolved method's return slot is bigint. Avoids the21579+
# global rewrite that previously regressed self-host (which used21580+
# `int` defaults for unresolved CallNodes).21581+
rcv_pn = @nd_receiver[ni_p]21582+
if rcv_pn >= 021583+
rcv_t_pn = base_type(@nd_inferred_type[rcv_pn])21584+
if is_obj_type(rcv_t_pn) == 121585+
cn_pn = rcv_t_pn[4, rcv_t_pn.length - 4]21586+
ci_pn = find_class_idx(cn_pn)21587+
if ci_pn >= 021588+
mr_pn = cls_method_return(ci_pn, @nd_name[ni_p])21589+
if base_type(mr_pn) == "bigint"21590+
@nd_inferred_type[ni_p] = "bigint"21591+
end21592+
end21593+
end21594+
end2157521595
end2157621596
end2157721597
ni_p = ni_p + 1