Commit 7e88b7b6

7e88b7b64305Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · ~3 modified

Description

refactor: drop @exc_var_* side-channel and strip session-only phase tags

Now that rescue => e binds an sp_Exception * directly, the @exc_var_names / @exc_var_cls_vars side-channel that the previous const-char-message lowering needed is dead. This commit removes:

  • @exc_var_names / @exc_var_cls_vars declarations in both spinel_analyze.rb and spinel_codegen.rb
  • find_exc_var_cls() helpers in both
  • compile_call_expr's find_exc_var_cls-gated rescue-bound LV dispatch arm (sp_Exception * recv_type arm covers it now)
  • infer_call_type's parallel arm in analyze
  • the override-before-cache arm that re-typed <lv>.message / .class / .to_s calls when the LV was side-channel-registered
  • emit_raise_one_arg's fallback sp_raise_cls(<saved_cls>, lv) arm (lv is sp_Exception *, so sp_raise_exc fires above it)

Also strip session-only "Phase 1B / 1C / 2 / 2.3" tags from comments. Algorithmic phase comments (group_by Phase 1 / 2) stay since they label halves of one function. Symbol / Class object "Phase 2" references stay since they point to long-lived plans.

Tests: default 450/0/0, promote 450/0/0, optcarrot checksum 59662.

Co-Authored-By: Claude Opus 4.7 [email protected]

Details

Commit
7e88b7b64305
Parent
e4c4118efb3f

lib/sp_runtime.hmodifiedView file

@@ -288,7 +288,7 @@
288288 a bare C identifier, and `c.to_s` lower to a names-table lookup.
289289 Other Class methods (`.name`, `.inspect`, `.==`, `.!=`,
290290 `.superclass`, `.ancestors`, dynamic `is_a?(c)` against a
291- variable, etc.) are out of scope for Phase 1. */
291+ variable, etc.) are not yet supported. */
292292 typedef struct{mrb_int cls_id;}sp_Class;
293293
294294 /* ---- Complex runtime ---- */
@@ -575,7 +575,7 @@
575575 difference gives the same answer on every libc we target.
576576 Sub-second precision is intentionally omitted: CRuby's iso8601
577577 also drops it unless the caller passes a precision arg, which
578- Phase 1 doesn't support.
578+ we don't support here.
579579 when is_utc is set, format against gmtime and emit the
580580 trailing "Z" suffix CRuby uses for UTC iso8601. */
581581 static const char *sp_time_iso8601(sp_Time t) {
@@ -2180,9 +2180,7 @@
21802180 /* sp_Exception: first-class exception object. cls_name is a pointer
21812181 to the per-class const string literal emitted by codegen
21822182 (sp_class_names[] entry; not GC-managed). msg is GC-managed
2183- (sp_str_alloc'd). Phase 2 of the exception modernization plan --
2184- replaces the side-channel `@exc_var_*` table that Phase 1
2185- relied on. */
2183+ (sp_str_alloc'd). */
21862184 typedef struct sp_Exception_s {
21872185 const char *cls_name;
21882186 const char *msg;