Commit Graph

19197 Commits

Author SHA1 Message Date
Jeroen van Rijn
80fc2e5107 Fix mojibake for error output as well. 2026-09-02 16:11:58 +02:00
Jeroen van Rijn
16ba9e964c Apply mojibake magic to test runner, too. 2026-09-02 15:25:40 +02:00
gingerBill
b969878bdf Fix needed calculation in arena_alloc_unguarded 2026-09-02 13:03:06 +01:00
gingerBill
b245c44036 Fix total_size calculation for memory_block_alloc 2026-09-02 13:02:38 +01:00
gingerBill
2f3baf40c0 Fix alignment issues with Small_Stack 2026-09-02 13:01:58 +01:00
gingerBill
085af86dac Remove ' from __odin_entry_point 2026-09-02 12:49:40 +01:00
gingerBill
780d59cce6 Keep -vet happy 2026-09-02 11:50:01 +01:00
gingerBill
dc5403e508 Merge branch 'master' of https://github.com/odin-lang/Odin 2026-09-02 11:48:36 +01:00
gingerBill
4b9ca012d2 Fix misaligned runtime.Memory_Block base for 32-byte alignments 2026-09-02 11:48:23 +01:00
gingerBill
80fde853f1 Merge pull request #7500 from mocompute/chained-offset-of-disallow
Detect and error on chained offset_of expressions.
2026-09-02 11:42:19 +01:00
gingerBill
f04f867b28 Fix local struct literals losing fields set through using 2026-09-02 11:37:17 +01:00
mo
278c7dd751 Detect and error on chained offset_of expressions.
Fixes #5851.

This disallows expressions like `offset_of(a.b.c)`.
2026-09-02 13:04:10 +12:00
Jeroen van Rijn
2c81576cf9 Merge pull request #7496 from StanislavNikolov/master
Add win32 structs and functions for advanced mouse/pointer/pen manipulation.
2026-09-01 14:30:40 -07:00
Stanislav Ch. Nikolov
426b015e3c sys/windows: Add missing optional comma in PointerFlag enum 2026-09-02 00:13:43 +03:00
Stanislav Ch. Nikolov
81742df9be core:sys/windows fix in_rage typo and spaces instead of tabs 2026-09-02 00:06:17 +03:00
Jeroen van Rijn
f073bec606 Merge pull request #7497 from Kelimion/fix-#7488
Fix #7488
2026-09-01 14:04:17 -07:00
Jeroen van Rijn
b96693446e Also fix the single elem branch to actually increase footer.len for size_of(E) == 0 2026-09-01 22:56:12 +02:00
Jeroen van Rijn
06c145c220 Fix #7488
Fixes #7488
2026-09-01 22:27:46 +02:00
Stanislav Ch. Nikolov
9a5beb0164 Merge branch 'win32-pen' 2026-09-01 22:44:41 +03:00
Stanislav Ch. Nikolov
ce37a83df3 Add support for advanced pen & pointer win32 functions 2026-09-01 22:42:25 +03:00
Jeroen van Rijn
916615a895 Merge pull request #7495 from Kelimion/macos-intel-removal
Remove macOS Intel from CI tests + releases.
2026-09-01 12:19:50 -07:00
Jeroen van Rijn
75d06fc6db Remove macOS Intel 2026-09-01 21:12:00 +02:00
Jeroen van Rijn
a2fb372b76 Merge pull request #7485 from Yawning/fix/linker-system
src: Use `posix_spawnp` instead of `system()` when invoking the linker
dev-2026-09
2026-09-01 03:02:46 -07:00
gingerBill
9a425de2ae Merge pull request #7465 from odin-lang/bill/arm64-clobber
asm: arm64 support
2026-09-01 10:22:08 +01:00
gingerBill
b209782eb2 Correct build.bat 2026-09-01 09:35:24 +01:00
gingerBill
3c46e132e0 Keep -vet happy 2026-09-01 09:33:08 +01:00
Jeroen van Rijn
05c1de4b70 Merge pull request #7487 from i-api/fix/json-parser-leaks-partial-object
bugfix: core/encoding/json leaks the key and value of a malformed object
2026-08-31 12:08:38 -07:00
user.name
6ccde7f80b bugfix: core/encoding/json leaks the key and value of a malformed object
parse_object_body allocates an object key, then may fail in parse_colon or
parse_value before that key is ever inserted into the object. Its cleanup defer
only walks `obj`, so a key that never got there is unreachable to it. The caller
cannot free it either -- a failed parse returns a nil Value -- so it leaks.

The same applies to the parsed element on the duplicate-key path, and to both on
the out-of-memory path.

JSON5 makes this reachable from ordinary malformed input, because an unquoted
ident is a legal key and anything other than a colon after it fails. Plain JSON
leaks it too, via a quoted key.

before, measured with a tracking allocator over 8 inputs x 2 specs:

	LEAK JSON5  colon fails after unquoted key   1 alloc / 7 bytes
	LEAK JSON   colon fails after quoted key     1 alloc / 2 bytes
	LEAK JSON5  colon fails after quoted key     1 alloc / 2 bytes
	LEAK JSON   value fails after key            1 alloc / 2 bytes
	LEAK JSON5  value fails after key            1 alloc / 2 bytes
	LEAK JSON   nested value fails               2 alloc / 4 bytes
	LEAK JSON5  nested value fails               2 alloc / 4 bytes
	LEAK JSON   deep nesting fails               3 alloc / 6 bytes
	LEAK JSON5  deep nesting fails               3 alloc / 6 bytes
	LEAK JSON   array element fails              1 alloc / 2 bytes
	LEAK JSON5  array element fails              1 alloc / 2 bytes
	total leaked allocations: 17

after, same probe:

	total leaked allocations: 0

The leak scales with nesting depth -- one orphaned key per enclosing object -- so
a service parsing untrusted JSON leaks a little on every malformed request.

The fix marks the key and the element as owned by the loop iteration until they
are stored, and frees them otherwise. The duplicate-key path loses its explicit
delete, which the same mechanism now covers.

Found via odinfmt, which reported a 7-byte leak in a downstream test that parses
`{ broken not json` to check that invalid input is rejected.

Regression test added to tests/core/encoding/json: it reports
`17 leaks and 0 bad frees` without this change and passes with it. The existing
11 tests pass unchanged under -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true.
2026-08-31 11:39:42 -07:00
gingerBill
8181e3564f Add asm syntax to core:odin/parser 2026-08-31 19:17:21 +01:00
gingerBill
7dd33b5e48 Implement #pre/#post` memory operand forms 2026-08-31 18:31:37 +01:00
gingerBill
4f8a91092b Add more MOV forms; fix liveness check for lanes 2026-08-31 17:51:24 +01:00
gingerBill
07b5c2ee0f Support enable_target_feature and require_target_feature for asm templates 2026-08-31 16:39:17 +01:00
gingerBill
df3b988db8 asm: add new operand kind for lanes (arm64) 2026-08-31 15:45:44 +01:00
gingerBill
7954321b78 Update instruction_table.odin with missing MOV forms 2026-08-31 15:19:27 +01:00
gingerBill
c789811597 Add a form transfer bytes check for memory operands 2026-08-31 15:15:46 +01:00
Jeroen van Rijn
de2b46961a Merge pull request #7468 from mac119/fix-7421-tagless-switch-duplicate-cases
checker: Do not deduplicate cases in tagless switches
2026-08-31 04:06:08 -07:00
gingerBill
af0842343d Work on trying to get the arm64 asm backend working 2026-08-31 11:02:06 +01:00
gingerBill
3d8437d152 Get the ARM64 frontend working 2026-08-31 10:23:09 +01:00
gingerBill
210defa21b Handle system registers and conditional branching instructions correctly. 2026-08-31 09:55:01 +01:00
Flāvius
344b0dd049 rexcode/arm64: FP/SIMD pre/post-indexed loads and stores
The other half of the FP/SIMD addressing gap: LDR/STR B/H/S/D/Q had
unsigned-offset and (since the last commit) register-offset forms, but
no writeback. Twenty new table rows -- pre-indexed and post-indexed
across the five widths, V=1 with the same imm9 encodings the integer
forms use, base opcodes confirmed against llvm-mc. Blobs regenerated;
builders unchanged.

Pipeline tests: all twenty llvm-mc golden words, with a decode -> print
round-trip matching llvm's canonical spelling.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFeLCDKi5kRMtHrskUaRfw
2026-08-30 19:11:20 -04:00
Flāvius
299eb160bf rexcode/arm64: FP/SIMD register-offset loads and stores
LDR/STR B/H/S/D/Q had unsigned-offset forms but nothing for
[Xn, Xm{, LSL #s}] -- ten new MEM_REG table rows (V=1, base opcodes
confirmed against llvm-mc), which also get the extended-register modes
for free now that one MEM_REG form serves both. Blobs and generated
tables regenerated; the builders are unchanged, since the new forms
share inst_ldr_r_m / inst_str_r_m signatures.

Pipeline tests: thirteen llvm-mc golden words across the five widths,
LSL and extended, with a decode -> print round-trip matching llvm's
canonical spelling.

Also: build.lua's structural check still demanded
tablegen/encoding_table.odin, which arm64/riscv/x86 renamed to
instruction_table.odin -- it now accepts either name, and --check
passes for all eleven ISAs again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFeLCDKi5kRMtHrskUaRfw
2026-08-30 19:05:55 -04:00
Flāvius
e59cf23275 rexcode/arm64: extended-register addressing, and the shift that printed its S bit
Register offset and extended-register offset are one instruction word --
the option field at 15:13 picks LSL / UXTW / SXTW / SXTX -- but only LSL
was reachable: no encode form used MEM_EXT, so [Xn, Wm, SXTW #s] had a
matcher, a packer, and no way to be asked for. Worse, decoding such a word
produced mode REG_OFFSET with a stray extend, which re-encoded as LSL --
a silent corruption round-trip.

The one MEM_REG form now serves both modes, the way the RM slot takes
plain and shifted registers: the matcher accepts EXT_REG_OFFSET and checks
the index width against the extend (UXTW/SXTW take Wm, UXTX/SXTX take Xm,
the byte/half extends match nothing -- and a REG_OFFSET index must now be
an X register), the OFFSET_REG packer writes option from the operand's
mode, and the decoder derives the mode from option rather than from which
form matched. MEM_EXT/OFFSET_EXT stay in their enums -- the values are
baked into the table blobs -- marked subsumed.

Also fixed while there: the decoder stored the raw S bit as the shift
amount, so LDR X0, [X1, X2, LSL #3] decoded -- and printed -- as LSL #1.
The amount is log2 of the transfer size, recovered from size(31:30) and,
for SIMD, opc<1>(23). The one thing Memory cannot represent is a byte
access with an explicit #0 (S=1, amount 0); it decodes as no amount.

New pipeline tests: ten llvm-mc golden words across the extends and
widths, decode/print round-trips matching llvm's canonical spelling, the
LSL amount, and four malformed-operand rejections.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFeLCDKi5kRMtHrskUaRfw
2026-08-30 18:36:34 -04:00
Flāvius
fc1be3902d rexcode/arm64: merge system registers into Register
Register widens to a u32: hw number in bits 0-4, class byte in bits 8-15 --
bit-identical to the old u16 layout -- and, for the new REG_SYS class only,
the 15-bit MRS/MSR field in bits 16-30. System_Register, its Operand_Kind,
and the union's sysreg member are gone; a system register is now a plain
.REGISTER operand distinguished by class, so it flows through matching,
packing, and printing like any other register.

Memory is untouched: every class legal in an address still lives entirely in
the low 16 bits of the u32, so its 16-bit register slots stay lossless and
NONE round-trips (verified: Odin bit_fields zero-extend on read and reject
overflowing constants at compile time). Operand stays 11 bytes -- the union's
largest member is still 8 -- and Instruction stays exactly 64.

op_sysreg survives as an op_reg alias so MRS/MSR call sites read as what
they are, and the sysreg constants keep their field value in their name:
NZCV is now Register(0x5A10_1000) where it was System_Register(0x5A10).

New pipeline test: every SYSREG_NAMES entry round-trips encode -> decode ->
print byte-exactly, with the expected word derived from the table value.
All 330 table + 134 pipeline checks pass; benchmarks show encode ~3% faster,
decode and print at parity.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFeLCDKi5kRMtHrskUaRfw
2026-08-30 18:23:06 -04:00
Flāvius
c9d7b0fbd9 rexcode/arm64: encode/decode/print throughput benchmarks
A bench mode for the test binary (run with `-- bench`) that times encode,
decode, and print over a representative instruction mix at three working-set
sizes (L1 / L2 / RAM), with a correctness gate so the numbers can't come from
a mix that silently fails to match. Baseline for the sysreg/register-merge
A/B comparison.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFeLCDKi5kRMtHrskUaRfw
2026-08-30 18:23:06 -04:00
Yawning Angel
9aa84b5e3a src: Use posix_spawnp instead of system() when invoking the linker
Thanks to Matteo on discord for pointing this out.
2026-08-31 04:40:04 +09:00
gingerBill
a0bfd7da55 Mock out llvm_backend_asm.cpp for arm64 2026-08-30 18:16:04 +01:00
gingerBill
7773596beb Handle status snapshot style instructions 2026-08-30 18:03:26 +01:00
Jeroen van Rijn
54b680a167 Merge pull request #7480 from FourteenBrush/patch-8
`core:net`: use explicitly passed allocators
2026-08-29 13:49:04 -07:00
Jeroen van Rijn
efc7db8619 Merge pull request #7481 from thetarnav/fix-parsing-same-line-comments
Improve `core:odin/parser` parsing field docs and comments
2026-08-29 13:47:10 -07:00
FourteenBrush
a635f0ef91 net.split_url: fix length on query values 2026-08-29 22:39:15 +02:00