Commit 02a294ee

02a294eeffcfMerged

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

Description

feat(analyze,codegen): regexp type scaffolding

First step of the #609 fix: introduces a regexp static type representing mrb_regexp_pattern *. No call site consumes it yet — the analyzer still infers Regexp.new(...) as int and the existing single-write side-channel (@local_regex_idx) is intact.

Pieces:

  • c_type("regexp") -> "mrb_regexp_pattern *"
  • c_default_val("regexp") -> "NULL" (so a regexp? slot inits to nil)
  • is_nullable_pointer_type("regexp") -> 1 (NULL is the sentinel)

The follow-up commits will (a) infer Regexp.new as the new type and migrate the single-write path off the side-channel, (b) extend if/else union to keep regexp + regexp as regexp instead of collapsing to int, and (c) plumb the dyn-cache form.

Refs #609.

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

Details

Commit
02a294eeffcf
Parent
6eecc46a0840

spinel_analyze.rbmodifiedView file

@@ -6406,6 +6406,9 @@
64066406 if bt == "ptr"
64076407 return 1
64086408 end
6409+ if bt == "regexp"
6410+ return 1
6411+ end
64096412 if bt == "string" || bt == "mutable_str"
64106413 return 1
64116414 end