Commit Graph
5097 Commits
Author SHA1 Message Date
Alex Alejandre 246951c809 Add cffi support to x32 (#1911) 2026-10-08 08:07:21 -05:00
Arthur Chan 8357f71519 OSS-Fuzz: Add new fuzzer targets assembly process (#1913)
Signed-off-by: Arthur SC Chan <arthur.chan@adalogics.com>
2026-10-08 08:01:48 -05:00
Arthur Chan f73474eb2f OSS-Fuzz: Update fuzz_fiber for breakpoint calls (#1912)
Signed-off-by: Arthur SC Chan <arthur.chan@adalogics.com>
2026-10-08 08:01:30 -05:00
Alex Alejandre 78f5996fcf Protect against different vector widths (#1909)
GCC aligns alloca to the widest enabled vector type (16 bytes, 32 with avx,
64 with avx-512). With AVX the block address is `lea 0x1f(%rsp)` rounded down
to the nearest 32-divisible, but half the time the block starts 16 bytes higher
so the function reads the stack arguments 2 slots away from where it should.
Without AVX the address is `lea 0xf(%rsp)` which is the stack pointer.
2026-10-07 21:55:15 -05:00
Arthur Chan 3bc551a29d OSS-Fuzz: Add new fuzzer targets fiber functions (#1908)
Signed-off-by: Arthur SC Chan <arthur.chan@adalogics.com>
2026-10-07 07:50:34 -05:00
veqqq d7052410f1 Add x32 Support (#1907) 2026-10-07 06:58:13 -05:00
Calvin Rose c495f11f15 Prefer janet_buffer_extra over janet_buffer_ensure. 2026-10-05 22:02:49 -05:00
sogaiuandsogaiu 809355fcf7 Support inttypes in JDN (#1905)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-10-05 21:46:28 -05:00
veqqqandAlex Alejandre 820ad0780c Decide once per lookup if janet_equals needed (#1903)
As key types can't change during lookup, we only need to check them once. The check is now
inlined in util.h, so structs and tables can use the same implementation. (Structs had a simpler
copy of the table implementation before, now they just ignore the table specific parts as they
lack deleted buckets)

Co-authored-by: Alex Alejandre <alex@alexalejandre.com>
2026-10-05 21:34:41 -05:00
Calvin Rose 0809778b41 Don't use eval for doing hooks.
Instead, require -> module/value -> normal function call
2026-10-05 09:03:40 -05:00
Calvin Rose 0e5fdd5309 Update CHANGELOG.md 2026-10-04 19:58:30 -05:00
Calvin Rose 9c6e68d52c Add shorthand for running hooks from the bundle module.
Useful for local testing and development from the command line.
2026-10-04 19:53:51 -05:00
sogaiuandsogaiu f63cc1df29 More suite inttypes work (#1900)
* Split assert-error into pieces and remove a piece

* Add helpful reminder in comment

* Format hack

* Use underscores to help readability

---------

Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-10-04 08:39:06 -05:00
sogaiuandsogaiu 6e8bb2df15 Modify suite inttypes (#1898)
* Stop using abbreviations

* Put parser tests first

* Fix incorrect code

* Deal with linting

* Change some comments and labels

* Improve test

* Use syntax literals for int/u64 and int/s64

---------

Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-10-03 13:39:30 -05:00
Calvin Rose fe0e19804e Remove out of date gnome builder link. 2026-10-01 06:34:00 -05:00
Calvin Rose 0d018921ca Format. 2026-09-30 21:11:32 -05:00
veqqqandAlex Alejandre 1d917e6813 Add bitwise key check to skip janet_equals calls (#1894)
* Add bitwise key check to skip janet_equals calls

* Skip janet_equals for identity-comparing keys

Since symbols, keywords, non-0 numbers, bools, tables, buffers, arrays, funcs and fibers are only equal by identity, we now fail them all if the bitwise check fails instead of passing them to `janet_equals`, so lookups only call `janet_equals` for strings, tuples, structs, abstract values and 0

* Skip traversal in janet_equals for non tuples and structs

---------

Co-authored-by: Alex Alejandre <alex@alexalejandre.com>
2026-09-30 21:10:12 -05:00
David Marker 28f35518ea workaround longstanding bug in FreeBSD mkdir(1) (#1891) 2026-09-29 18:41:34 -05:00
sogaiuandsogaiu d19dae6781 Align some parameter names (#1889)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-29 08:19:45 -05:00
Arthur Chan 3ca0253c10 OSS-Fuzz: Add new fuzzer targets peg processing (#1890)
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
2026-09-29 08:13:29 -05:00
Calvin Rose 65a64a3b72 Add threaded channel memory leak test.
Found by @pepe with Claude. This makes some changes to the initial AI
suggested fix but is mostly verbatim. The memory leak was of the form of
ever increase GC roots with threaded channels.
2026-09-28 18:03:50 -05:00
Calvin Rose cd946c4541 Apply fix for threaded channels "eating" values.
Reported by @pepe with help from Claude.
2026-09-28 17:35:18 -05:00
Calvin Rose 38ef5b53ba Make implementation match intention in comment.
We were doing forward instead of a backward search. This is slower, and
for the unrootall case was also incorrect. unrootall was not commonly
used but should still work as expected.

Bug found by @pepe with help from Claude.
2026-09-28 17:15:26 -05:00
Calvin Rose b437ae3feb Apply fix for #1888 from Paolo Marrone
Just mark janet_vm.top_dyns during mark phase of collection. It was
skipped as it is not part of the usual interpreter flow and was missed
in testing. Also add a test case for it.
2026-09-28 16:56:36 -05:00
Calvin Rose ffebf2c497 Add test cases for missing programs with os/spawn and os/execute. 2026-09-28 16:53:09 -05:00
Calvin Rose ec73cf884f Better prose 2026-09-28 16:10:42 -05:00
sogaiuandsogaiu 86ca958eeb Make italics use italic ANSI escape codes (#1886)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-24 06:23:45 -05:00
Calvin Rose d2560d538b Add bytecode slot compaction pass.
Codegen may allocate and then never use slots. Free up those slots
and rewrite bytecode to be smaller. The resulting bytecode will be
slightly faster, result in better inlining, and be somewhat normalized
for further optimizations.
2026-09-24 06:19:53 -05:00
Calvin Rose b0acda4fa5 Add bytecode inlining at optimization >= 2.
Currently very simple hueristic, and not supported
on many functions that instatiate closures or load/set upvalues.

We also now, more than ever, need a slot-compaction routine to reduce
the number of slots used by functions.
2026-09-24 06:19:38 -05:00
sogaiuandsogaiu 6dadb83570 Align slice-related docstrings (#1887)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-24 06:19:31 -05:00
Calvin Rose d763d0d51a Move optimiize out of pop_funcdef. 2026-09-19 16:28:41 -05:00
Calvin Rose f442b310ef Add comments dicussing requirements for optimize=0
The goal of optimize=0 is both fast compilation and perfect debug info.
We would like to do some simple optimizations but the possibility of
breaking symbol mappings prevents it.
2026-09-19 14:53:32 -05:00
Calvin Rose 95bc5742e0 Add passes to remove unused constants and closures.
Dead code elimination and value numbering may remove
closures and constants from a function def - remove these from our
constant and defs buffers to avoid keeping phantom references and
bloating marshalled function size.
2026-09-19 12:59:04 -05:00
Calvin Rose 6e79ac9f62 Expose optimization level
This exposes the optimization level for a few reasons.

First, Local value numbering exposed some bad codegen. Playing with
optimiaztion level exposes this more easily.

When compiling dead code in a known unused scope, we
would generate code that tried to load invalid slots.

Make sure that unused code will still pass `janet_verify()` as
invalid code could trigger bad behavior in our optimizer or garbage
collector.

Since the code was proven dead, this would not trigger any runtime
behavior issues though.

Second, even trivial optimizations tend to break debug information. For
example, constant propogation will eliminated symbol mappings which can
be useful for debugging. By default, don't eliminate any symbol map
debug info.
2026-09-19 11:22:33 -05:00
Calvin Rose 0432110572 Improve the constant propogation.
However, we will likely need to gate some of these optimizations
behind a switch as they are beginning to destruct debug info. For
example, local value number maybe should be off by default or at the
very least turned off for named loads.
2026-09-19 11:22:33 -05:00
Calvin Rose 02f0718460 Expose bytecode optimization in the assembler.
Also fix value numbering missing some cases due to bad encoding
routines.
2026-09-19 11:22:32 -05:00
sogaiuandsogaiu d64918010a Use square brackets for data tuples in docstrings (#1881)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-19 11:22:26 -05:00
Calvin Rose 4fc4c8c351 Improve compilation with local value numbering and better
analysis for removing dead writes. Removes the old implementation
of janet_bytecode_movopt.
2026-09-17 17:54:52 -05:00
sogaiuandsogaiu ce3b532c9d Tweak some docstrings (#1880)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-17 17:28:39 -05:00
sogaiuandsogaiu c29050eeda Modify some buffer docstrings (#1858)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-17 17:28:23 -05:00
sogaiuandsogaiu 832159a677 Modify some marshal docstrings (#1873)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-14 07:53:02 -05:00
sogaiuandsogaiu edf0981223 Use ffi-native as parameter name (#1878)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-14 07:52:16 -05:00
sogaiuandsogaiu d6870d4435 Use ksvs as parameter name (#1879)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-14 07:52:05 -05:00
sogaiuandsogaiu 6d986543d2 Tweak docstrings for os/sleep, os/posix-chroot (#1877)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-14 07:51:32 -05:00
Calvin Rose a6470a4271 If def->slotcount was greater than INT32_MAX - 31, there would be an
overflow.

Reorder calculations for bitmap coverage to avoid any undefined behavior
for all values from 0 to INT32_MAX.
2026-09-13 10:53:16 -05:00
Calvin Rose 5dba33f09f Typo: i -> 1 2026-09-13 09:01:21 -05:00
Calvin Rose 01a8eb883d Always use unsigned 1 literal for bit shifts. 2026-09-13 08:59:27 -05:00
Pietro Cerutti d8be849671 Don't hardcode 127.0.0.1 in tests (#1849)
How about we resolve through the special host name "localhost." instead of assuming that the loopback interface is bound to 127.0.0.1 (which might not be the case, especially in FreeBSD jails)?

See RFC6761 for how "localhost." is treated, especially:

Name resolution APIs and libraries SHOULD recognize localhost
names as special and SHOULD always return the IP loopback address
for address queries and negative responses for all other query
types.  Name resolution APIs SHOULD NOT send queries for
localhost names to their configured caching DNS server(s).
2026-09-13 07:53:42 -05:00
sogaiuandsogaiu a7b6c04fdf Rename fiber parameter as fib (#1867)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 22:32:12 -05:00
sogaiuandsogaiu 4dfd0d5ce5 Modify some ffi/ docstrings (#1872)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 18:40:30 -05:00