Hojun-Cho
2fb594748c
cstage+selfhost+test: principled identity-cast skip (#33)
Generalizes b5632b1's single-site dst_is_enum gate. Skip the narrow-
clamp MOVL when src.width == dst.width && src.signed == dst.signed.
Closes #25's followup.
Both stages need symmetric source-type derivation for byte-id. cstage
deliberately throws away the checker's richer typed-AST and uses a
structural walker (castsrcprim) that mirrors wwstage's exprprimresolved
case-for-case. Otherwise cstage's `.len: i32` resolves to i32 (skip)
while wwstage's misses the pseudo-field (clamp) — bootstrap diverges.
Pseudo-fields, N_BIN, N_INDEX, N_CALL, match-bindings all yield sz=0
→ clamp emits defensively on both.
The N_TENUM walker now follows enum aliases in wwstage's
typenodeprimresolved (was the original lacuna behind #25), and bool
is excluded early in the same helper (mirrors cstage's
type_isint(TY_BOOL)=false). bool→bool keeps its dedicated is_bool
ANDQ $255 emit; bool→i8 / bool→u8 etc. fall through to the clamp on
both stages.
Walker shape (cstage castsrcprim / wwstage exprprimresolved):
N_INTLIT → tsuffix gated, untyped excluded
N_IDENT → trust local's resolved tnode
N_CAST → recurse on declared dst
N_UN → recurse on operand
N_DOT → real-struct only (TY_STRUCT or TY_PTR→TY_STRUCT)
others → sz=0 → identity false → clamp emits
Test 710 grew from 5 → 16 rows: 6 identity-width pins (u32/i32/u8/
i8/u16/i16 self), 1 sign-change pin (u32→i32 clamp MUST fire), 2
silent-miscompile exit-validating rows (truncate via divide), 1
pseudo-field defensive pin (`s.len: i32`), 1 bool-source pin
(`b: i8`). Asm byte-id asserted on every row.
Out of scope: redundant clamps remain for patterns wwstage can't
structurally derive (N_BIN, N_CALL, N_INDEX, pseudo-fields). A
sibling task extending wwstage's type inference closes those.
2026-05-16 12:20:56 +09:00
..
2026-05-16 10:47:50 +09:00
2026-05-11 13:49:27 +09:00
2026-05-11 13:49:27 +09:00
2026-05-12 04:15:31 +09:00
2026-05-16 11:17:20 +09:00
2026-05-11 13:49:27 +09:00
2026-05-11 13:49:27 +09:00
2026-05-12 11:35:50 +09:00
2026-05-12 12:45:11 +09:00
2026-05-11 13:49:27 +09:00
2026-05-11 13:49:27 +09:00
2026-05-12 13:44:27 +09:00
2026-05-12 13:37:31 +09:00
2026-05-16 03:00:34 +09:00
2026-05-13 20:06:24 +09:00
2026-05-14 02:44:57 +09:00
2026-05-14 01:58:52 +09:00
2026-05-14 00:36:34 +09:00
2026-05-13 23:45:35 +09:00
2026-05-14 19:12:20 +09:00
2026-05-14 00:21:53 +09:00
2026-05-14 23:45:14 +09:00
2026-05-14 23:26:49 +09:00
2026-05-15 01:08:52 +09:00
2026-05-15 01:39:37 +09:00
2026-05-15 02:14:00 +09:00
2026-05-15 14:16:53 +09:00
2026-05-15 11:24:33 +09:00
2026-05-15 15:19:38 +09:00
2026-05-15 15:06:37 +09:00
2026-05-15 11:34:47 +09:00
2026-05-15 16:43:07 +09:00
2026-05-15 18:13:02 +09:00
2026-05-15 18:14:33 +09:00
2026-05-15 18:45:21 +09:00
2026-05-15 19:07:29 +09:00
2026-05-16 00:07:00 +09:00
2026-05-16 01:37:15 +09:00
2026-05-16 10:47:50 +09:00
2026-05-16 11:17:20 +09:00
2026-05-16 12:20:56 +09:00
2026-05-16 11:37:17 +09:00
2026-05-16 11:17:20 +09:00
2026-05-11 13:49:27 +09:00
2026-05-12 13:50:09 +09:00
2026-05-15 11:34:47 +09:00
2026-05-12 03:14:20 +09:00
2026-05-12 03:49:09 +09:00
2026-05-15 11:34:47 +09:00
2026-05-15 14:05:55 +09:00
2026-05-15 15:11:59 +09:00
2026-05-15 15:48:13 +09:00
2026-05-15 17:13:32 +09:00
2026-05-15 17:14:49 +09:00
2026-05-16 02:42:41 +09:00
2026-05-15 00:26:10 +09:00
2026-05-15 00:27:38 +09:00
2026-05-15 00:28:59 +09:00
2026-05-15 09:00:34 +09:00
2026-05-15 09:00:34 +09:00
2026-05-15 09:00:34 +09:00
2026-05-15 09:00:34 +09:00
2026-05-15 09:00:34 +09:00
2026-05-15 09:00:34 +09:00
2026-05-15 09:00:34 +09:00
2026-05-13 16:07:18 +09:00
2026-05-11 13:49:27 +09:00
2026-05-11 13:49:27 +09:00
2026-05-11 16:48:58 +09:00
2026-05-12 16:21:13 +09:00
2026-05-11 16:48:58 +09:00
2026-05-11 17:52:29 +09:00
2026-05-12 03:58:55 +09:00
2026-05-14 02:51:49 +09:00
2026-05-15 09:00:34 +09:00