Commit 498becd7

498becd773a9Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified

Description

fix: achieve bootstrap fixpoint by extracting GC_ROOT emission into helper method

The v1 compiler cannot compile a while loop nested inside two if statements at the end of declare_method_locals, generating "unsupported: WhileNode". Extract the loop into emit_gc_roots() so v1 can compile it, making gen2.c == gen3.c (0 diff lines).

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Details

Commit
498becd773a9
Parent
8734ddc5b7c1

spinel_codegen.rbmodifiedView file

@@ -7158,14 +7158,18 @@
71587158 end
71597159 if has_gc_locals == 1
71607160 if @needs_gc == 1
7161- j = 0
7162- while j < lnames.length
7163- if type_is_pointer(ltypes[j]) == 1
7164- emit(" SP_GC_ROOT(lv_" + lnames[j] + ");")
7165- end
7166- j = j + 1
7167- end
7161+ emit_gc_roots(lnames, ltypes)
7162+ end
7163+ end
7164+ end
7165+
7166+ def emit_gc_roots(lnames, ltypes)
7167+ j = 0
7168+ while j < lnames.length
7169+ if type_is_pointer(ltypes[j]) == 1
7170+ emit(" SP_GC_ROOT(lv_" + lnames[j] + ");")
71687171 end
7172+ j = j + 1
71697173 end
71707174 end
71717175