Commit Graph
5077 Commits
Author SHA1 Message Date
Calvin Rose 09b75c3a54 Avoid using monkey-patched assert for this failure case. 2026-09-28 16:49:43 -05:00
Calvin Rose 62dc34d602 Arm cross compilation CI fix attempt.
Perhaps initial process launch succeeds?
2026-09-28 16:40:38 -05:00
Calvin Rose 8aad393c4f Bad format string. 2026-09-28 16:29:14 -05:00
Calvin Rose 7389aca55c Move to FormatMessageA instead of the generic macro. 2026-09-28 16:23:49 -05:00
Calvin Rose aff7f7314b Add test cases for missing programs with os/spawn and os/execute. 2026-09-28 16:14:59 -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
sogaiuandsogaiu ecadc17e2a Modify debug/unbreak and tuple/setmap docstrings (#1864)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 18:40:01 -05:00
sogaiuandsogaiu 71f9535509 Modify string/find* docstrings (#1863)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 18:39:54 -05:00
sogaiuandsogaiu 2851d26802 Modify os/clock and string/format docstrings (#1860)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 18:39:44 -05:00
McSinyx d89d2910d5 Remove dangling janet_getfloat declaration (#1874)
It was not removed along with the function definition.

Fixes: ec48673f7c ("Revert float interface")
References: 23e4ad4bd3 ("Add ... float getters for consistency")
2026-09-12 18:39:10 -05:00
Calvin Rose 053d6084b8 Fix bug for PR #1849 - IPV6+windows+getlocalname
Use AF_INET6 for creating windows sockets by default. AF_INET6 on
windows will by default create dual-mode sockets that will support both
address families.

Use old behavior if IPV6 support is disabled, though.

Thanks to Pietro Cerutti for the investigation here.
2026-09-12 18:09:58 -05:00
Calvin Rose c8c8afedd2 Reduce spurious error messages in test suite.
Prevent the possibility of closing the server socket
before calling net/accept-loop in net/server by adding
a call to (ev/sleep 0).
2026-09-12 14:11:05 -05:00
sogaiuandsogaiu 716d9f7b5b Tweak some buffer parameter docstrings (#1859)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 11:02:10 -05:00
sogaiuandsogaiu 8650fad90c Change os/stat and os/lstat docstrings (#1870)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 11:01:49 -05:00
sogaiuandsogaiu 14b990f123 Choose parameter names that don't shadow builtins (#1871)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:55:06 -05:00
sogaiuandsogaiu 0d89db6967 Modify bit manipulation function doctrings (#1868)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:54:54 -05:00
sogaiuandsogaiu 48c72abf37 Rename channel parameter as chan (#1865)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:06:25 -05:00
sogaiuandsogaiu e112113069 Rename some parameters (#1869)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:04:00 -05:00
Calvin Rose 9ed76f42fb Bytecode improvements. Add jump threading and better dead code
elimination to our bytecode compiler. Also iterate it to a fixpoint.

Last, add a total instruction counter during bootstrap so we can easily
see how many instructions are in the core library.

These simple passes were factored out of some more involved bytecode
optimization work as easy wins without much code.
2026-09-11 21:00:45 -05:00
sogaiuandsogaiu a9625276be Unify assignment operator docstrings (#1857)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:56:06 -05:00
sogaiuandsogaiu 9f53b90dea Tweak ffi/defbind-alias docstring (#1853)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:55:41 -05:00
sogaiuandsogaiu 5deff0f13c Modify array/ docstrings (#1866)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:55:28 -05:00
sogaiuandsogaiu 6bbdfd0e0c Surround more things with backticks (#1862)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:50:08 -05:00
sogaiuandsogaiu e6194a8188 Improve docstring for doc (#1852)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 19:32:48 -05:00
sogaiuandsogaiu 9bc56342a8 Improve docstring for zipcoll (#1854)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 17:14:08 -05:00
sogaiuandsogaiu 112f5aef7d Use backticks for nicer site rendering (#1856)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 17:13:47 -05:00