Commit Graph

18346 Commits

Author SHA1 Message Date
gingerBill
910ddb4626 Check for nullptr when none of the options match in a proc group 2026-06-26 15:09:18 +01:00
gingerBill
7aff98a150 Fix procedure_of(x) 2026-06-26 15:07:54 +01:00
Brendan Punsky
ded7a2dea0 rexcode/ir/spirv: codec round-trip test suite
A tests/ package (the ISA test convention) that, per module shape, does
encode -> decode -> re-encode and asserts byte-identical output -- exercising the
encoder, decoder, <id> side tables, and the generic operation codec together:

  void_main      header + preamble + a void function (116 B)
  int_constants  i32 type + two scalar OpConstants incl. 0xDEADBEEF (88 B)
  iadd_function  %r = OpIAdd %i32 %a %b ; OpReturn -- generic operand codec
                 with a result + value operands (164 B)

3 passed. Run: odin run core/rexcode/ir/spirv/tests. (build.lua is ISA-centric;
wiring the ir/ packages into the gen/check/test pipeline is a follow-up.)
2026-06-26 09:43:59 -04:00
Brendan Punsky
be65df38c1 rexcode/ir/spirv: decoder + byte-exact round-trip
The inverse of the encoder: read the header (detecting endianness from the
magic word), walk the instruction stream, and lower each instruction by opcode
back into the structured Module -- the ir core (types/constants/globals/
functions, the generic table-driven operation decode), the SPIR-V sections
(preamble / debug / annotations), and the flat <id> space into the side id
tables (with an id->Type_Ref map so type-naming operands recover TYPE operands).

Single allocator pass (context.allocator), one reused per-instruction word
scratch buffer. Validated: encode -> decode -> re-encode is byte-exact on the
void compute main module (116 bytes; caps/types/functions/blocks/ops/ids/bound
all recovered). Same gaps as the encoder (OpFunctionParameter, ARRAY/bool,
enum-parameter operands); big-endian sources a later refinement.
2026-06-26 09:41:27 -04:00
Brendan Punsky
737db89ad0 rexcode/ir/spirv: complete the encoder -- types, constants, globals, function bodies
The second half of encode(): the <id> side tables (Module.type_ids /
global_ids / function_ids -- SPIR-V's flat id space, which ir.Type/Global/
Function don't carry) plus the lowering:

  emit_types       ir.Type -> OpTypeXxx (void/int/float/vector/pointer/struct/
                   function; INT signedness + POINTER storage class ride in aux)
  emit_constants   OpConstant / OpConstantComposite / true/false/null
  emit_globals     OpVariable (storage class from the pointer type)
  emit_operation   generic table-driven op emit: INSTRUCTION_INDEX gives the
                   result-type/result-id prefix, the rest stream from op.operands
  emit_functions   OpFunction / OpLabel / body / OpFunctionEnd

Validated: a complete void compute main module encodes to byte-exact-correct
SPIR-V (29 words, all checked). Known gaps: OpFunctionParameter, ARRAY/bool
types, explicit enum-parameter operands, computed bound. Decoder next.
2026-06-26 09:24:52 -04:00
blob1807
19dc9ae773 Remove non-exported joystick_lock
As per the header, `SDL_joystick_lock` isn't an exported symbol. https://github.com/libsdl-org/SDL/blob/release-3.4.2/include/SDL3/SDL_joystick.h#L78-L85
2026-06-26 21:48:24 +10:00
Brendan Punsky
18f9f141e4 rexcode/ir/spirv: encoder foundation -- header + preamble/debug/annotation sections
The Module -> word-stream encoder's first half: a fast single-pass word writer
(one host-endian store per word; instruction headers written as a placeholder
and backpatched, so variable-length instructions need no measure pass) plus the
header and the preamble / debug / annotation sections in spec layout order
(capabilities, extensions, ext-inst imports, memory model, entry points,
execution modes, OpString/OpSource/OpName, decorations).

Validated: a minimal module encodes to byte-exact-correct SPIR-V (magic, v1.5,
OpCapability Shader, OpMemoryModel Logical GLSL450, OpEntryPoint GLCompute %main,
NUL-terminated 'main' string, correct backpatched word counts).

Types/constants/globals/function bodies (the <id> + type lowering) are next.
2026-06-26 07:33:01 -04:00
Brendan Punsky
d027fbf938 rexcode/ir/spirv: generate the operand-layout table (codec dispatch data)
Extend the tablegen to emit encoding_table.odin from the grammar -- the
per-opcode operand layout that drives the codec:

  INSTRUCTION_SPECS   flat []Operand_Spec {Spec_Kind, Quantifier}
  INSTRUCTION_INDEX   [max_opcode+1]Spec_Run -- O(1) opcode -> its operand run
  ENUM_PARAMS         enumerant -> trailing-parameter operands, so the codec
  PARAM_SPECS         reads MemoryAccess.Aligned / OpExecutionMode LocalSize /
                      Decoration.SpecId etc. correctly

873 opcodes, 3693 operand specs. Package compiles.
2026-06-26 07:08:50 -04:00
Brendan Punsky
7a8684f541 rexcode/ir/spirv: scaffold the SPIR-V IR package (foundation + generated tables)
Start the SPIR-V intermediate representation under core/rexcode/ir/spirv,
following the ir API (docs/ir_design.md) and the ISA package conventions. SPIR-V
is table-driven on encoding and SSA on dataflow, so it re-exports the shared ir
vocabulary and is laid out like an arch package.

  spirv.odin          package + ir re-exports + physical format (MAGIC, version,
                      Header, wordCount<<16|opcode framing)
  module.odin         Module :: struct { using base: ir.Module, ...sections... } --
                      capabilities, ext-imports, entry points, exec modes, constant
                      pool, decorations, debug; SPIR-V's module metadata has no
                      ir.Module slot, so it is carried alongside the core
  reloc.odin          Relocation (linkage import/export)
  opcodes.odin        GENERATED: the Opcode enum (873 opcodes)
  operand_kinds.odin  GENERATED: ValueEnum/BitEnum operand kinds + Spec_Kind
  tablegen/gen.odin   the generator (core:encoding/json)
  tablegen/spirv.core.grammar.json  vendored authoritative grammar (Khronos
                      SPIRV-Headers unified1) -- single source of truth

Generating from the authoritative grammar avoids hand-transcription errors
(hand-authoring had Quads/Aliased/... wrong). Package compiles. Codec
(encode/decode + flat<->structured lowering), printer, and tests are next.
2026-06-26 06:53:46 -04:00
Brendan Punsky
3d852158bc rexcode/x86: generate the encode-recipe table (drop the @init interim)
Move ENCODE_RECIPES from a startup-built (@init) static table in the library to
a generated, #loaded table like every other one. The tablegen runs
form_to_recipe over every form, serializes to x86.encode_recipes.bin, and the
loader #loads it -- no @init, no allocation; the forms remain the single source
of truth and the recipe is derived from them.

- tablegen/gen.odin: ENCODE_RECIPES added to the BLOBS manifest (which drives
  both the Stage B serializer and the loader's #load); emit the generated-package
  global plus an @init that fills it from ENCODE_FORMS via lib.form_to_recipe.
- encoder_recipe.odin: drop the @init, the static storage, and the ENCODE_RECIPES
  declaration. form_to_recipe stays -- now solely the tablegen-time derivation.
- tables.odin, generated/{encode_tables,writer}.odin: regenerated.
- tables/x86.encode_recipes.bin: the generated blob (28260 bytes = 2355 x 12).

No behavior change: the recipes are identical to the @init ones. gen / builders /
check / test / idempotent green (2282 cases, 22 byte-stable artifacts); encode
perf unchanged.
2026-06-26 05:08:39 -04:00
gingerBill
3cad23341a Merge pull request #6886 from korvahkh/fix-6885
Fix #6885
2026-06-25 14:33:05 +01:00
Jeroen van Rijn
946feb3c54 Merge pull request #6887 from Yawning/update/wycheproof
test/core/crypto/wycheproof: Update the tests to match recent changes
2026-06-25 11:47:49 +02:00
Yawning Angel
83940eadfe test/core/crypto/wycheproof: Update the tests to match recent changes
This needs to be merged before I can bump the wycheproof assets.
2026-06-25 14:01:10 +09:00
korvahkh
0aa6d8f318 Fix #6885
Broadcasting `field = value` compound literals
would assert.
This is because we were checking for a
`field = value` compound before checking
if the types matched, and thus could broadcast.
2026-06-24 16:28:02 -05:00
gingerBill
6fdaedf182 Fix indentation 2026-06-24 14:05:35 +01:00
gingerBill
5c48d91f8e And missing command line flag information 2026-06-24 13:44:49 +01:00
gingerBill
859290a9de Support where clauses for proc groups 2026-06-24 13:31:11 +01:00
gingerBill
ead2b9a6e2 Merge pull request #6654 from odin-lang/bill/bedrock
`-bedrock`
2026-06-24 13:28:10 +01:00
gingerBill
3e3fc1c906 Remove duplicated code 2026-06-24 11:11:16 +01:00
gingerBill
51b13abb37 Merge branch 'master' into bill/bedrock 2026-06-24 11:10:10 +01:00
gingerBill
9be5790dbe Fix -> (#simd[N]T) like types in signature returns 2026-06-24 11:09:53 +01:00
gingerBill
40e54a97ed Merge branch 'master' into bill/bedrock 2026-06-24 11:07:02 +01:00
gingerBill
ade003e128 Allow for -> (#simd[N]T) style return types 2026-06-24 10:51:28 +01:00
gingerBill
078664a5c2 Merge branch 'master' of https://github.com/odin-lang/Odin 2026-06-24 10:38:31 +01:00
gingerBill
f602a6acd7 Fix #6725 #6798 #4943 2026-06-24 10:38:21 +01:00
gingerBill
b1e9d83ea2 Merge pull request #6880 from RoBaertschi/master
Fix #6874
2026-06-24 10:36:20 +01:00
gingerBill
55b63099a8 Fix constant x %% y evaluation 2026-06-24 10:35:36 +01:00
gingerBill
58aac9065a Merge pull request #6878 from Barinzaya/dynamic-arena-alignment
Fix mem.Dynamic_Arena alignment
2026-06-24 10:31:35 +01:00
Bärtschi Robin
212004b3ad test_issue_6874: fix formatting 2026-06-24 08:41:29 +02:00
Bärtschi Robin
640a0f2ef4 add test for #6874 2026-06-24 08:35:43 +02:00
Bärtschi Robin
3883d079c8 Fix #6874 2026-06-24 08:04:17 +02:00
Barinzaya
583a397e1d Fixed alignment handling in mem.Dynamic_Arena. 2026-06-24 00:58:45 -04:00
gingerBill
5647a1b2fc Merge pull request #6873 from bennyyip/regex/inject
core:text/regex: improve compiler performance
2026-06-23 22:34:26 +01:00
MauriceElliott
954f988d2b feat(build_settings): Added a section to init_build_context to target the thumbv7em-non-eabihf when the cortex-m7 processor is selected 2026-06-23 22:03:22 +01:00
gingerBill
07fee34419 Allow for both odin command path -flags and odin command -flags path
To do this, if the first argument after the command and last argument is NOT a flag, then put that last parameter first.
2026-06-23 17:27:17 +01:00
bennyyip
f58d7edb39 pack consecutive inject 2026-06-23 22:19:59 +08:00
bennyyip
55e513fbd7 align struct fields 2026-06-23 22:19:26 +08:00
gingerBill
19bb9070e1 Add @(require_results) where missing 2026-06-23 13:24:25 +01:00
gingerBill
f3a275c4dc Merge branch 'master' into bill/rexcode 2026-06-23 13:21:46 +01:00
gingerBill
c7d313b524 Merge pull request #6875 from 0cch0/patch-1
Update Xlib documentation link to current PDF
2026-06-23 13:16:29 +01:00
gingerBill
8c63a70aad Fix identation 2026-06-23 13:14:56 +01:00
gingerBill
87297950c1 Merge pull request #6435 from mtarik34b/improve-flags-bitset-support
Improve `bit_set` support in the `flags` package
2026-06-23 12:50:21 +01:00
gingerBill
2b684ed1ec Add json.unparse allowing for json.Value to io.Writer without the need for RTTI 2026-06-23 12:47:38 +01:00
gingerBill
6698ebacb1 Integrate docs from PR #5119 2026-06-23 12:35:58 +01:00
gingerBill
a1fe7222bb Remove using fmt for example docs 2026-06-23 12:28:27 +01:00
gingerBill
28df949279 Fix typo 2026-06-23 12:25:36 +01:00
gingerBill
ebcf85a1fd Merge branch 'master' of https://github.com/odin-lang/Odin 2026-06-23 12:21:39 +01:00
gingerBill
7d36866fe9 pool -> arena 2026-06-23 12:21:29 +01:00
gingerBill
dc7cfbf443 Merge pull request #6671 from MaierN/master
fix memory leak and inconsistency in os.read_entire_file_from_file
2026-06-23 12:20:36 +01:00
gingerBill
82b2b293e9 Merge pull request #6515 from Peter0x44/master
Add missing rlgl bindings for raylib 5.5
2026-06-23 12:19:08 +01:00