Commit 7b14b0a6
7b14b0a63c06Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · +1 added · ~1 modified
Description
Merge pull request #179 from mame/pr/unify-call-site-param-poly
fix(codegen): unify disagreeing call-site param types to poly + box
Conflicts:
spinel_codegen.rb
Details
- Commit
- 7b14b0a63c06
- Parent
- dd03d810b5e0
- Merge parent
- 19f0f007c216
spinel_codegen.rbmodifiedView file
@@ -6888,6 +6888,14 @@
68886888
while kk < arg_ids.length68896889
at = infer_type(arg_ids[kk])68906890
if kk < ptypes.length6891+
# Unify against the existing param type rather6892+
# than only widening from "int". The previous6893+
# rule let the FIRST non-int call site freeze6894+
# the param type; subsequent disagreeing calls6895+
# (e.g. addr arg seen as Range from one site6896+
# and as Integer from another) compiled to a6897+
# signature mismatch. unify_call_types collapses6898+
# incompatible types to "poly".68916899
ptypes[kk] = unify_call_types(ptypes[kk], at, arg_ids[kk])68926900
end68936901
kk = kk + 1@@ -10008,6 +10016,13 @@
1000810016
while kk < arg_ids.length1000910017
at = infer_type(arg_ids[kk])1001010018
if kk < ptypes.length10019+
# Same unify-instead-of-only-widen-from-int change as10020+
# the obj-recv path in scan_new_calls. A no-recv self10021+
# call inside the same class is the path that, e.g.,10022+
# `def boot; add_mappings(0x..0x, ...); end` inside10023+
# CPU#boot lands on, and disagreeing arg types from10024+
# different self-calls need to widen to poly rather10025+
# than freezing on the first non-int call site.1001110026
ptypes[kk] = unify_call_types(ptypes[kk], at, arg_ids[kk])1001210027
end1001310028
kk = kk + 1test/method_param_unify_to_poly.rbaddedView file
Loading diff…