Commit Graph

34988 Commits

Author SHA1 Message Date
fa3232cc1d astgen: use plain expr instead of comptimeExpr for @setRuntimeSafety operand
Enables 326 files from compiler/, compiler_rt/, and more.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 23:39:04 +00:00
eba04d91cc astgen.c: fix forExpr to use nodeIsTriviallyZero for range start check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:47:52 +00:00
7d52ad5e97 parser: fix extra_data write ordering in parseSwitchProng for multi-item switch cases
Enables 39 files from compiler/aro/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:36:07 +00:00
945caa475c stages_test: enable time_report.zig, common.zig, inttypes.zig, and 6 files from compiler/aro/
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:11:17 +00:00
d509c0a8c6 astgen.c: port @trap builtin handler from upstream AstGen.zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:01:36 +00:00
363f54df64 astgen: port lib_name handling for extern fn declarations from upstream Zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 21:52:29 +00:00
67774255ed add skill 2026-02-16 21:28:50 +00:00
be6348de8f stages_test.zig 2026-02-16 21:25:28 +00:00
9d35ef90f7 astgen.c: replace UINT32_MAX sentinels with NULL_TOKEN/NULL_NODE/NULL_INST
Define named constants for the three categories of optional sentinel
values, matching their Zig counterparts (?TokenIndex null,
?Node.Index null, Zir.Inst.OptionalIndex .none). This makes intent
explicit and prevents sentinel/zero confusion bugs like the one
fixed in 921a7021.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 20:32:51 +00:00
921a70210e fix break label check in rlExpr: use UINT32_MAX sentinel instead of 0 for optional token
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:37:50 +00:00
1377fae4cd astgen: fix InternPool.zig — parser fallthrough for struct/enum/union, add @compileLog, fix @"..." escape scanning
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:18:20 +00:00
58702f9648 astgen_test: enable Compilation.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:27:32 +00:00
5857ea2f6a astgen.c: port @errorReturnTrace, nosuspend expr, and remaining zero-arg builtins
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:24:25 +00:00
539e5244b6 Fix identAsString for @"..." identifiers with escape sequences
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:05:35 +00:00
07d8045a3f astgen.c: port @wasmMemorySize and @wasmMemoryGrow builtins
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:54:02 +00:00
53f4ef2f98 astgen_test: enable print_value, target, link, Air, print_zir, Value, Type, translate_c corpus tests (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:44:44 +00:00
91d81ad688 astgen_test: enable while.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:41:28 +00:00
a86bec7160 astgen.c: port @cVaArg, @cVaCopy, @cVaEnd, @cVaStart builtins from AstGen.zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:37:43 +00:00
665b89d4f2 astgen.c: call identAsString before underscore check in whileExpr to match upstream string table ordering
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:29:14 +00:00
ec1e056e34 astgen_test: enable type_info.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:14:05 +00:00
381ae80d73 astgen.c: add rvalue call to callExpr, matching upstream AstGen.zig:10169
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:11:42 +00:00
010a7109ca fix labeled switch: parser passes is_labeled flag, init GenZir continue_block/label_token to UINT32_MAX
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:01:25 +00:00
7d92160d73 astgen.c: port @src builtin (ZIR_EXT_BUILTIN_SRC), enable src.zig and string_literals.zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:38:11 +00:00
907812056e astgen_test: enable sizeof_and_typeof.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:29:52 +00:00
66940c2911 astgen.c: port @select builtin (ZIR_EXT_SELECT)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:27:58 +00:00
b2cdf27048 astgen.c: port @returnAddress builtin (ZIR_EXT_RET_ADDR)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:14:55 +00:00
7ea605e63d astgen_test: enable prefetch.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:08:55 +00:00
fde6c03d2a astgen_test: enable multiple_externs_with_conflicting_types.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:07:03 +00:00
ee19503d4d astgen.c: implement @mulAdd builtin handler
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:05:14 +00:00
2707757d9c astgen.c: port multi-arg @min/@max builtins (minMax, AstGen.zig:9149-9189)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:55:41 +00:00
b27bbd3a38 astgen_test: enable import_c_keywords.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:45:04 +00:00
d67fdf168c astgen_test: enable generics.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:43:15 +00:00
67db9e03fd astgen_test: enable fn.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:41:25 +00:00
0a9a982c2c astgen.c: port @extern builtin handler (AstGen.zig:9331-9341)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:39:37 +00:00
7f5394e468 astgen_test: enable export_keyword.zig corpus test (already passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:30:29 +00:00
cf7b0a0493 astgen: fix gzUnstack/gzAppendInstruction ordering in comptime destructure assignments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:28:40 +00:00
bbe6c34191 astgen.c: implement errdefer payload capture and genDefersBoth for defer.zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:59:27 +00:00
3620dc3957 astgen.c: port @breakpoint and @prefetch builtins to enable builtin_functions_returning_void_or_noreturn corpus test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:28:56 +00:00
7ef45efd53 astgen.c: boolBinOp: pass coerced_bool_ri and use fullBodyExpr for RHS, matching upstream AstGen.zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:14:11 +00:00
7795bcd363 update port-astgen skill: full test in Phase 0, fix corpus search pattern
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:50:43 +00:00
d497346208 astgen: fix hex float f64-fits check to use pure integer test, fixing math.zig under valgrind
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:50:22 +00:00
dcffc8f831 astgen_test: simplify corpus_files to plain path strings
Refactor corpus_files from .{ "name", @embedFile("path") } tuples to
just "path" strings. The @embedFile is now called inline in the test
loop. Port from zig1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:15:23 +00:00
1fd2451007 port @atomicLoad, @atomicRmw, @atomicStore, @cmpxchgStrong, @cmpxchgWeak builtins to astgen.c
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:12:29 +00:00
84a9758a49 add zig3 wrapper 2026-02-16 09:56:04 +00:00
ef619fdec8 x86_64: fix RoundMode immediate encoding for vroundss/vcvtps2ph
The RoundMode packed struct had Direction as enum(u4) occupying bits 3:0,
which pushed the precision exception suppress field to bit 4. Per Intel
SDM, the ROUNDSS/VROUNDSS/VCVTPS2PH immediate layout is:

  bits 1:0 = rounding mode
  bit 2    = rounding source (MXCSR.RC vs immediate)
  bit 3    = precision exception suppress
  bits 7:4 = reserved (must be 0)

The old encoding emitted e.g. vroundss $0x12 for ceil-suppress (bit 4
set, reserved), which CPUs silently ignore but valgrind 3.26.0 correctly
rejects with SIGILL. Fix by changing Direction to enum(u3) so precision
lands at bit 3, producing the correct $0x0a encoding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 20:41:19 +00:00
d2c301cc95 astgen: fix cppcheck warnings for err_scope_used and param_insts
Use memset initialization to satisfy cppcheck's data flow analysis:
- err_scope_used: cppcheck can't track writes through is_used_or_discarded pointer
- param_insts: cppcheck warns about potentially uninitialized array elements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:50:05 +00:00
500bc6a791 astgen: replace __float128/__uint128_t with portable C11 float handling
Replace GCC/glibc extensions (__float128, strtof128, __uint128_t) with
portable C11 code so astgen.c compiles with TCC and other C11 compilers.

The f64 vs f128 decision uses an exact algebraic round-trip test: a decimal
value m*10^e round-trips through f64 iff the odd part of m*5^e fits in 53
binary bits. This requires only integer arithmetic, no floating-point.

For f128 encoding, strtold parses the value at 80-bit extended precision,
then bit manipulation converts to IEEE 754 binary128 layout (both formats
share 15-bit exponent; bottom 49 of 112 fraction bits are zero-padded).

The big integer multiply-add path uses a portable mul64() helper instead
of __uint128_t.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:36:44 +00:00
760b03fd29 update skill 2026-02-15 18:55:22 +00:00
9b0020fe40 astgen: port inline assembly support and fix extern fn handling
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:23:33 +00:00
f809b08c8b update skills 2026-02-15 17:46:24 +00:00