Commit 5ff8b80d
5ff8b80dbb02Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
Merge pull request #231 from mame/pr/gc-scan-skip-inherited
fix(codegen): gc_scan skips ivars inherited from parent class
Details
- Commit
- 5ff8b80dbb02
- Parent
- 1ea24b3bdc46
- Merge parent
- 592a33addfcb
spinel_codegen.rbmodifiedView file
@@ -13113,7 +13113,23 @@
1311313113
j = 01311413114
while j < names.length1311513115
if j < types.length13116-
if ivar_is_gc_ptr(types[j]) == 113116+
# Skip ivars inherited from parent — emit_class_struct13117+
# also skips them on the child, so the struct field type13118+
# comes from the parent's recorded type, and re-emitting13119+
# here under the child's type info can produce a wrong13120+
# mark (e.g. parent says int_array, child has widened to13121+
# poly, struct field is sp_RbVal). The parent walk below13122+
# marks them via the parent's type.13123+
skip_inherited = 013124+
if @cls_parents[i] != ""13125+
parent_idx = find_class_idx(@cls_parents[i])13126+
if parent_idx >= 013127+
if ivar_in_chain(parent_idx, names[j]) == 113128+
skip_inherited = 113129+
end13130+
end13131+
end13132+
if skip_inherited == 0 && ivar_is_gc_ptr(types[j]) == 11311713133
emit_gc_mark_ivar("self->" + sanitize_ivar(names[j]), types[j])1311813134
end1311913135
endtest/gc_scan_skip_inherited_ivar.rbaddedView file
Loading diff…
test/gc_scan_skip_inherited_ivar.rb.expectedaddedView file
Loading diff…