Commit cb1a53cc
cb1a53ccb854Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · ~2 modified
Description
fix: address Gemini review high-priority issues from PRs #193/#194/#195
-
Range#map: when receiver is a non-literal range (e.g.
r = 1..3; r.map {...}), don't read @nd_left/@nd_right on a non-RangeNode (LocalVariableReadNode etc) — fall back to the runtime sp_Range's .first/.last fields. Bug produced wrong output (3 vs 1 in the reduced repro). [PR #193 high] -
sp_file_binread_bytes: drive the push loop by fread's actual byte count (not ftell's raw size) to avoid pushing uninitialized memory on a partial read; null-check the malloc result before use. [PR #194 high]
-
compile_array_literal SplatNode branch:
- SP_GC_ROOT the accumulator (sp_IntArray_push can grow → trigger GC, sweeping the half-built array).
- Hoist the range upper bound and the source-array expr to a temp so side effects don't re-fire each iteration.
- Add sym_array support (shares sp_IntArray representation with int_array). [PR #195 high]
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- cb1a53ccb854
- Parent
- c73573c268b2
lib/sp_runtime.hmodifiedView file
long sz = ftell(f); fseek(f, 0, SEEK_SET); unsigned char *buf = (unsigned char *)malloc(sz > 0 ? (size_t)sz : 1); if (sz > 0) { size_t r = fread(buf, 1, sz, f); (void)r; for (long i = 0; i < sz; i++) sp_IntArray_push(a, (mrb_int)buf[i]); if (buf && sz > 0) { /* Use fread's actual byte count, not the raw file size — a partial read otherwise pushes uninitialized memory. */ size_t r = fread(buf, 1, (size_t)sz, f); for (size_t i = 0; i < r; i++) sp_IntArray_push(a, (mrb_int)buf[i]); } free(buf); fclose(f);spinel_codegen.rbmodifiedView file
Loading diff…