Commit Graph

19049 Commits

Author SHA1 Message Date
gingerBill
d0c3b78ece Allow (parent scope) constants within asm templates 2026-08-17 18:56:47 +01:00
Jeroen van Rijn
ad17496e4a Merge pull request #7363 from PavLL/fix-wrong-bounds-check-directive
core/slice/slice.odin: fix slice.get doing unnecessary bounds check
2026-08-17 19:04:01 +02:00
pav
2c7b3e6780 fix slice.get doing unnecessary bounds check 2026-08-17 18:40:12 +02:00
gingerBill
645b57be9f Merge pull request #7327 from kalsprite/abi_conformance
ABI Conformance Harness + Fixes
2026-08-17 16:28:01 +02:00
gingerBill
d71c25dd9b asm: add #skip N and #nop N 2026-08-17 13:36:59 +01:00
gingerBill
bd95d2ae66 Add asm directive #align N 2026-08-17 13:32:28 +01:00
gingerBill
55377f71ef Support #byte directive for asm templates 2026-08-17 13:21:40 +01:00
gingerBill
c2dfcb3c28 Remove debug printing 2026-08-17 13:10:28 +01:00
gingerBill
dd5c2f98fd Always require the results of asm templates 2026-08-17 13:05:33 +01:00
gingerBill
5fe724bff3 Remove f suffix e.g. %flags.z rather than %flags.zf 2026-08-17 13:00:18 +01:00
gingerBill
d1f561ec88 Correct instruction_size_suffix so that the correct suffix can be selected for the instruction to adhere to AT&T syntax 2026-08-17 12:59:23 +01:00
gingerBill
db94c5a6cb Begin work in %flags.zf et al 2026-08-17 12:25:17 +01:00
Jeroen van Rijn
a0b475eef9 Merge pull request #7361 from ssenthilnathan3/fix/recursive-soa-sigbus
Fix: SIGBUS/segfault when compiling recursive #soa slice/dynamic array types
2026-08-17 13:16:18 +02:00
gingerBill
344e8afa36 #clobber cc -> #clobber flags 2026-08-17 12:10:08 +01:00
Jeroen van Rijn
e2f1638d4d Merge pull request #7353 from corleypc/modmod-fix
Fixes the %% operator
2026-08-17 13:06:53 +02:00
gingerBill
1f2234a4b2 Merge branch 'master' into bill/inline-asm 2026-08-17 11:44:14 +01:00
gingerBill
8eaa640c02 Merge pull request #7358 from kalsprite/eol_diagnostic_line
fix eol diagnostic
2026-08-17 12:41:41 +02:00
Jeroen van Rijn
ee89002c24 Add more %% tests 2026-08-17 12:40:49 +02:00
gingerBill
a03d5addfa Merge pull request #7334 from kalsprite/riscv64_arg_coerce
riscv64: read a flattened aggregate's members from their real offsets
2026-08-17 12:40:36 +02:00
gingerBill
bfc945f991 Merge pull request #7355 from samuelgozi/dynamic-arena-reused-block-alignment
mem: Keep Dynamic_Arena allocations aligned after reset
2026-08-17 12:40:14 +02:00
gingerBill
b5a746b9b6 Merge pull request #7359 from kalsprite/min_dep_fixed_capacity_break
checker: add the missing `break` in `add_min_dep_type_info`
2026-08-17 12:39:27 +02:00
gingerBill
2791257e28 Merge pull request #7360 from kalsprite/any_int_range_check
check_expr: range-check a constant passed to an `#any_int` parameter
2026-08-17 12:39:16 +02:00
gingerBill
d3f4d477e5 Merge pull request #7348 from Kelimion/ci-flakiness
Disable Wycheproof on Windows CI
2026-08-17 12:35:19 +02:00
gingerBill
307604381a Merge pull request #7333 from corleypc/constmerge-fix
Reenables LLVMSetUnnamedAddress for global constants merging
2026-08-17 12:33:39 +02:00
Senthilnathan
f6f686392a Merge branch 'master' into fix/recursive-soa-sigbus 2026-08-17 12:53:33 +05:30
Senthilnathan
4fe5719007 Fix SIGBUS/segfault when compiling recursive #soa slice/dynamic array types 2026-08-17 12:48:41 +05:30
kalsprite
72d1829fec #any_int range check constants 2026-08-16 22:08:52 -07:00
kalsprite
55d0aecd92 add missing break on fix dyn 2026-08-16 19:51:27 -07:00
kalsprite
35061af11b fix eol diagnostic 2026-08-16 17:31:59 -07:00
Samuel Elgozi
4a08f5c48a mem: Preserve alignment when reusing Dynamic_Arena blocks 2026-08-17 00:21:50 +03:00
Mihail Moskov
e92c04eb73 Fixes the %% operator 2026-08-16 23:08:24 +03:00
Jeroen van Rijn
35779c6fa7 Merge pull request #7352 from Kelimion/fix-#7350
Fix #7350
2026-08-16 18:24:39 +02:00
Jeroen van Rijn
a9b7d3dfc6 Fix #7350 2026-08-16 18:08:17 +02:00
Jeroen van Rijn
ca8b7c16b8 Merge pull request #7351 from Kelimion/compiler-utf8-codepage
Set console codepage to utf-8 (on Windows), and restore old one on exit
2026-08-16 18:06:39 +02:00
Flāvius
b54c60b76a rexcode: the x86 test suite could fail and the build said PASS
Found by accident, and worse than the bug that found it. Five deliberately
broken decode cases came back green through `build.lua --test --isa x86`, while
running the same suite directly reported "253/258 PASSED, 5 FAILED".

Two independent holes, both open, so neither backstopped the other:

  - the x86 test binary ended at `print_summary()` and never called `os.exit`,
    so it exited 0 no matter how many cases failed;
  - `do_test` looked for the words "N failed" in the output, and the x86
    harness prints "N FAILED" — a lowercase-only Lua pattern, so the largest
    suite in the tree was exempt from its own gate.

The exit code is the check that should have been load-bearing, so the harness
sets it. The output match stays as a backstop for a suite that forgets to, and
is now case-insensitive.

How long this has been true is not knowable from here — every x86 regression
since the pattern was written would have been reported as PASS.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Riok9vMpkLmo78wsVKJHhz
2026-08-16 12:05:52 -04:00
Flāvius
3e3eec090d x86: +r decoding was legacy-only, so BSWAP could not be read back
`bswap` is `0F C8+rd` — the register rides in the opcode's low three bits, like
`push`/`pop`/`xchg`/`mov`, but behind an escape byte. The decoder's retry at the
+r base opcode was gated on `esc == .NONE`, so only the register-0 forms
(`0F C8` = bswap eax, `48 0F C8` = bswap rax) landed on a table entry directly;
the other seven registers came back INVALID_OPCODE. Emission was always correct
— every `bswap` this compiler has ever produced runs — but a disassembly
containing one stopped dead, which is how it surfaced: three functions in
sigil's JIT corpus disassembled to a header with no instructions under it.

The table was never the problem. BSWAP is in `tablegen/encoding_table.odin` and
in the generated decode table, exactly where it should be.

Fixing the gate meant looking at why the retry existed twice. There is a correct
+r handler further down, carrying comments that describe two bugs already found
and fixed in it — "scan ALL entries, not just the first", "scan for the sized
register rather than assuming op0" — and the copy inside the retry had received
neither, plus a third of its own. So the retry now re-runs only the LOOKUP and
falls through to the single handler, which fixes two more instruction families
that were equally undecodable:

  - `xchg rAX, r` (90+rd): 0x90's run sorts NOP ahead of XCHG, and the copy
    tested only the first entry for a +r form, so every `xchg rAX, r` was
    rejected.
  - `push bx` / `pop bx` / `mov cx, imm` (any +r under 0x66): the copy passed
    `prefix` where the legacy row wants 0, since for legacy opcodes 0x66 is
    operand size rather than part of the opcode's identity.

Two supporting changes. The shared handler's default answer is now the first +r
entry rather than `idx.start`, so a fall-through at 0x90 cannot answer NOP for
an `xchg`. And a base-opcode retry that does not land on a +r form is now an
error rather than a fall-through: decoding 0x0E as the 0x08 entry (OR) would be
a wrong instruction reported confidently, which is worse than an unknown byte.

Verified three ways. Every opcode in every escape map was decoded before and
after: 154 combinations changed, every one of them INVALID -> valid, and nothing
that already decoded decodes differently. All 24 BSWAP encodings and all 96
legacy +r encodings were diffed against llvm-mc's disassembly and agree
operand-for-operand. Six new decode-only cases pin the three families; five of
them fail without this change.

(Two remaining differences from llvm-mc are deliberate and documented here:
implicit accumulators are left unmaterialized so a short form re-encodes to the
short form, and `48 90` reads as `xchg rax` rather than `nop`.)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Riok9vMpkLmo78wsVKJHhz
2026-08-16 12:05:42 -04:00
Jeroen van Rijn
c63561b700 Also restore codepage on trap. 2026-08-16 17:50:49 +02:00
Jeroen van Rijn
7f532cad14 Add -define:ODIN_CODEPAGE_MAGIC=false opt-out to the runtime 2026-08-16 17:01:41 +02:00
Jeroen van Rijn
0b7b8ba4a2 Set console codepage to utf-8 (on Windows), and restore old one on exit
Avoid mojibake.
2026-08-16 16:16:35 +02:00
Jeroen van Rijn
cc7d6764d3 Merge pull request #7349 from TheRadischen/merge_sort
improved stable sort | from insertion_sort to merge_rotate
2026-08-16 16:03:57 +02:00
TheRadischen
7d9367e3b4 morestyle improvements mybe this is it? 2026-08-16 15:24:55 +02:00
TheRadischen
0b0778f981 morestyle improvements mybe this is it? 2026-08-16 15:24:19 +02:00
TheRadischen
f6b8eafdfd imporved_style 2026-08-16 15:10:01 +02:00
TheRadischen
1a70315797 style_corrections 2026-08-16 15:09:12 +02:00
TheRadischen
9757fed9f9 changed_to_tabs 2026-08-16 14:28:38 +02:00
TheRadischen
d8177f7716 adjusted_smallsort_threshhold 2026-08-16 13:33:32 +02:00
TheRadischen
4c945c995a added_back_where 2026-08-16 12:58:23 +02:00
KBS
e62ed261c5 base/runtime: do not free the original block on a failed heap resize
`base/runtime`: do not free the original block on a failed heap resize

The default heap allocator freed old_ptr when the underlying allocation
failed (allocated_mem == nil). On the realloc path (heap_resize) the original
block is left intact on failure, and on the copy/fresh path old_ptr has not
been copied or freed yet, so freeing it left the caller holding a dangling
pointer. A [dynamic] array whose resize failed therefore double-freed its
data on the next delete (reported as free(): invalid pointer / use-after-free).

Return .Out_Of_Memory without freeing anything; the caller retains ownership
of the original block.

Fixes #7262
2026-08-16 12:54:16 +02:00
Jeroen van Rijn
889ad95c7e Merge pull request #7342 from kalsprite/alpha
quat/cmplx nan cmp & accessors
2026-08-16 12:31:55 +02:00
Jeroen van Rijn
7aa805e22a Merge pull request #7343 from kalsprite/rune_unsigned_mapping
intrinsics.type_integer_to_unsigned(rune) returns f16
2026-08-16 12:28:59 +02:00