Commit Graph

550 Commits

Author SHA1 Message Date
Ronald Caesar 87923661a0 engine: reorganize error enum values
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-17 01:47:03 -04:00
Ronald Caesar 5b931324c6 engine: add new error for very large buffer capacities
This introduces BAL_ERROR_INVALID_CAPACITY which happens when a
buffer capacity exceeds SIZE_MAX or whatever the type's max value is.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-17 01:40:55 -04:00
Ronald Caesar 8b7b152492 docs: add rules for ai generated code.
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-16 03:28:16 -04:00
Ronald Caesar c45acbf6ad cpu: add explicit padding to bal_cpu_t
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 03:34:17 -04:00
Ronald Caesar 247005edd5 tests/x86/assembler: check for buffer overflows
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 03:18:55 -04:00
Ronald Caesar cb7314dbcc tests/x86/assembler: check for null buffer in emit() functions
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 03:17:39 -04:00
Ronald Caesar 13b0e53597 tests/x86/assembler: fix incorrect function argument
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 03:06:49 -04:00
Ronald Caesar 548b3791e2 test/x86/assembler: add missing function to Public_InvalidRegister_NoEmit
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 03:05:52 -04:00
Ronald Caesar 81f238f646 tests/x86/assembler: add more functions to Public_BadStatus_NoEmit test
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 02:49:44 -04:00
Ronald Caesar d598391055 x86/assembler: remove duplicate if statement
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 02:48:30 -04:00
Ronald Caesar 645fa7d3e5 tests/x86/assembler: add 100% branch coverage to bal_x86_assembler_reset()
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 02:32:01 -04:00
Ronald Caesar 28129be379 dashboard: generate lua ffi bindings for file dialog
I've added `tools/generate_ffi.lua` which generates lua ffi bindings
to C for all structs in a header file and functions in that have the
`BAL_EXPORT` keyword.

Right now only `tools/dashboard/dashboard_file_dialog.h` have ffi
bindings generated for it and saved to
`tools/dashboard/scripts/generated/dashboard_file_dialog_ffi.lua`.

The script only handles one header file at a time. Later on I will need
to add support for recursively scanning all header files in a folder
with options to exclude certain folders.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-14 03:57:39 -04:00
Ronald Caesar 80706ef77b engine: remove outdated docs
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-14 02:45:50 -04:00
mcrib884 50876e7968 tests: add encode and safety tests for bal_x86_emit_sub_r64_r64
Adds Encode_SubRegToReg_LowLow and Encode_SubRegToReg_HighHigh
byte-exact encode tests asserting every emitted byte, plus
NullContext, BadStatus, and InvalidRegister safety tests.

Signed-off-by: mcrib884 <farukkaya229@outlook.com>
2026-06-14 05:56:23 +00:00
mcrib884 40246aa4f0 assembler: add bal_x86_emit_sub_r64_r64
Emits the x86 sub r64, r64 instruction (opcode 0x2B, REX.W + ModRM,
3 bytes). Follows the 5-check guard pattern matching add_r64_r64.

Signed-off-by: mcrib884 <farukkaya229@outlook.com>
2026-06-14 05:56:23 +00:00
Ronald Caesar dd442e8a82 docs: add more immediate goals
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-12 04:57:24 -04:00
Ronald Caesar ac231fc159 dashboard/filedialog: move imgui rendering logic to lua
I want hot-reloading on the file dialog, so a moved
'dashboard_file_dialog_draw()' to Lua and named it
'dashboard_render_file_dialog()'. This requires adding the following
helper functions:

* dashboard_file_dialog_refresh()
* dashboard_file_dialog_append_path()
* dashboard_file_dialog_navigate_home()

Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-12 04:57:24 -04:00
Ronald Caesar 8247ec9fe5 dashboard/filedialog: fix padding violation
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-12 04:57:24 -04:00
mcrib884 94cca0e48f assembler: fix branch encoding and add reset function
The B (unconditional branch) instruction encoding used integer
division (/) instead of bitwise OR (|) to combine the opcode with
the branch offset. This produced incorrect machine code for every
branch target other than zero.

Also add bal_assembler_reset() to match the reset API provided by
every other module in Ballistic (bal_x86_assembler, sliding window,
tier1 compiler). The function zeroes the instruction buffer and
resets offset and status.

Wrap the hot function in BAL_UNLIKELY.

Signed-off-by: mcrib884 <farukkaya229@outlook.com>
2026-06-12 04:25:47 +00:00
Ronald Caesar bf360f9bc8 tests/decoder: skip empty buckets
If a hash bucket is empty, the test still loops 2,097,152 times which
is crazy. An empty bucket means `bal_decode_arm64()` will always
return NULL, so I've added a `continue` statement to skip the massive
loop.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-11 22:44:22 -04:00
Ronald Caesar 661958714c tools/doctest: wrap global statements in a main() function
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-11 22:28:48 -04:00
Ronald Caesar 78107c66bb actions: add macos runner
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-11 22:11:21 -04:00
Ronald Caesar 396249858d actions: add windows runner
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-11 21:46:55 -04:00
Ronald Caesar 7085cefaad build: add precompiled headers and optimizations to msvc build times
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-11 21:46:55 -04:00
Ronald Caesar 43ba3d19bb actions: add ubuntu runner
The current build times for these runners are too slow. I'm changing
that now.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-11 20:25:32 -04:00