Commit c56ea1f7

c56ea1f7442bMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 7 files · +5 added · ~2 modified

Description

Split the 8.4k-line analyzer into five stage files

analyze.c is now split along its pass structure, sharing former file-statics through analyze_internal.h:

  • analyze_util.c small shared helpers (op classification, proc/yield value typing, method(:sym) resolution shared with codegen)
  • analyze_infer.c infer_call / infer_type (expression type inference)
  • analyze_scope.c walk_scope, registration (structs, attrs, aliases, FFI, includes/extends), inherited-cls-method specialization
  • analyze_pass.c the fixpoint passes (write/ivar/param/default/hash-param/ block-param/return inference)
  • analyze.c reachability, proc captures, ie-map, alpha-rename and constant-qualification pre-passes, analyze_program driver

analyze's two file-statics whose names collide with symbols the codegen split exported (g_ie_class_id, re_has_captures) are renamed with an an_ prefix; the method(:sym) helpers that were already shared with codegen moved to analyze_util.c with declarations in the internal header.

No behavior change: 845 pass / 0 fail / 0 error before and after.

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

Details

Commit
c56ea1f7442b
Parent
b764f192c6f8

MakefilemodifiedView file

@@ -127,9 +127,10 @@
127127 # The binary emits C; the test harness invokes cc to link libspinel_rt.a.
128128
129129 SPINELC = build/spinelc$(EXE)
130-SPINELC_HDRS = src/node_table.h src/codegen.h src/codegen_internal.h src/types.h src/compiler.h src/analyze.h
130+SPINELC_HDRS = src/node_table.h src/codegen.h src/codegen_internal.h src/types.h src/compiler.h src/analyze.h src/analyze_internal.h
131131 SPINELC_OBJ = build/csrc/node_table.o build/csrc/types.o build/csrc/compiler.o \
132- build/csrc/analyze.o build/csrc/codegen.o build/csrc/codegen_util.o \
132+ build/csrc/analyze.o build/csrc/analyze_util.o build/csrc/analyze_infer.o \
133+ build/csrc/analyze_scope.o build/csrc/analyze_pass.o build/csrc/codegen.o build/csrc/codegen_util.o \
133134 build/csrc/codegen_fold.o build/csrc/codegen_call.o \
134135 build/csrc/codegen_expr.o build/csrc/codegen_stmt.o build/csrc/main.o
135136