Commit e29cda4c
e29cda4cb6beMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 3 files · ~3 modified
Description
Seed hash-param value type from string/symbol-keyed []= writes
The usage-driven hash promotion skips parameters (they are typed from call
sites), so a hash param filled internally by p[s] = v and read back via
p.fetch(s) defaulted to str_poly through a monotonic cycle: the read
yields poly, the poly flows back into the param's stored value type, and
nothing narrows it. infer_param_hash_value narrows such a param to the
concrete hash its own writes establish.
Only string/symbol-keyed []= writes count: an int-keyed p[i] = v is
ambiguous with array element assignment (e.g. an int_array RAM param filled
by ram[i] = b), so int keys must not be read as hash evidence -- doing so
mistyped optcarrot's RAM param and broke it.
Resolves the last self-host inference cycle: local_class (name -> class_idx,
str_int) was str_poly, so recv_class_idx_for_rebind returned poly, so the
class-index ci was poly, so @cls_meth_idx_cache[ci*N+id] keyed on poly and
boxed an int_int_hash literal into poly. With local_class -> str_int the whole
chain is int. spinelc now compiles legacy/spinel_analyze.rb with ZERO
unsupported constructs (remaining work: a few emitted-C type mismatches).
Gates: 845 test, 57 bench, optcarrot checksum 59662 -- all green.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- e29cda4cb6be
- Parent
- 70763b040501
src/analyze.cmodifiedView file
build_ie_map(c); /* refresh instance_exec receiver-class map each pass */ ch |= infer_write_types(c); ch |= infer_param_types(c); ch |= infer_param_hash_value(c); ch |= propagate_prep_params(c); ch |= infer_string_params(c); ch |= infer_default_param_types(c); sp_narrow_memo_bump(); /* invalidate per-iteration narrow-helper memo */ ch |= infer_write_types(c); ch |= infer_param_types(c); ch |= infer_param_hash_value(c); ch |= propagate_prep_params(c); ch |= infer_string_params(c); ch |= infer_default_param_types(c);src/analyze_internal.hmodifiedView file
Loading diff…
src/analyze_pass.cmodifiedView file
Loading diff…