Commit a976593b
a976593b14a7Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 3 files · ~3 modified
Description
Multi-assign setter target, poly Range iteration, poly << result
Several runtime/codegen fixes for optcarrot's CPU/PPU to advance:
- MultiWriteNode with a typed-array RHS skipped a CallTargetNode setter target entirely (and returned the RHS instead), so never set the CPU frame clock. Emit the writer method call (or attr-ivar store).
- poly lowered to len_ex+each_elem had no Range arm, so iterating a ternary-typed ran zero times (the CPU memory map was never populated). Add SP_BUILTIN_RANGE to both runtime helpers.
- expression discarded sp_poly_shl's result and returned the receiver, dropping integer shifts (peek16's ).
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- a976593b14a7
- Parent
- 6a5a84942787
lib/sp_runtime.hmodifiedView file
@@ -4080,6 +4080,7 @@
40804080
case SP_BUILTIN_STR_POLY_HASH: return ((sp_StrPolyHash *)a.v.p)->len;40814081
case SP_BUILTIN_SYM_POLY_HASH: return ((sp_SymPolyHash *)a.v.p)->len;40824082
case SP_BUILTIN_POLY_POLY_HASH: return ((sp_PolyPolyHash *)a.v.p)->len;4083+
case SP_BUILTIN_RANGE: { sp_Range *r = (sp_Range *)a.v.p; mrb_int n = r->last - r->first + (r->excl ? 0 : 1); return n > 0 ? n : 0; }40834084
default: return sp_poly_arr_len(a);40844085
}40854086
}@@ -4092,6 +4093,7 @@
40924093
case SP_BUILTIN_INT_ARRAY: case SP_BUILTIN_FLT_ARRAY:40934094
case SP_BUILTIN_STR_ARRAY: case SP_BUILTIN_POLY_ARRAY:40944095
return sp_poly_arr_get(a, i);4096+
case SP_BUILTIN_RANGE: { sp_Range *r = (sp_Range *)a.v.p; return sp_box_int(r->first + i); }40954097
case SP_BUILTIN_STR_INT_HASH: {40964098
sp_StrIntHash *h = (sp_StrIntHash*)a.v.p;40974099
if (!h || i < 0 || i >= h->len) return sp_box_nil();src/codegen_call.cmodifiedView file
Loading diff…
src/codegen_stmt.cmodifiedView file
Loading diff…