5067 Commits
Author SHA1 Message Date
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
sogaiuandsogaiu cae73db4af Fix misc docstring typos (#1855)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 17:13:30 -05:00
Pietro Cerutti 0bfcc9fc97 Fix a couple of imprecisions in the file/ docs (#1848)
* Fix a couple of imprecisions in the file/ docs

The `+` flag to `(file/open)` was incorrectly documented as being for
appending. Instead, this allows to read to files opened with `:w` or
`:a`, and to write to files opened with `:r`. This is the same as the
`+` flag in `fopen(3)`.

The `(file/seek)` function was documented as having both `whence` and
`n` as optional arguments. It also didn't say what the default for `n`
was. Anyway, this doesn't make sense, as a default of `:cur` and `0`
would effectively make `(file/seek f)` a no-op. I also amended a test so
both `(file/seek f :set 0)` and `(file/seek f :set)` are covered and
checked to move to the beginning of the file.

* Remove useless check for argc >= 2

We already determined it is between 2 and 3 with `janet_arity(argc, 2, 3)`.

* Dump args in assertion

* Unroll loop in test

* Differentiate failure messages
2026-09-10 17:12:54 -05:00
Calvin Rose e1963cdfe0 Prepare for version 1.42.1 v1.42.1 2026-09-10 16:45:02 -05:00
sogaiuandsogaiu 359d9f9d49 Improve docstring for run-context (#1846)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-07 18:09:44 -05:00
sogaiuandsogaiu d1d7170304 Improve docstring for getproto (#1847)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-07 18:08:30 -05:00
tranzystorekk 587468d3f4 add long options to shell completion scripts (#1842) 2026-09-04 09:43:37 -05:00
Calvin Rose aa157d9375 Update SONAME to 1.42 2026-09-02 18:15:48 -05:00
Jacob Mealey 94eba7a808 Fix typo for in docstring (#1840) 2026-09-02 18:15:37 -05:00
Calvin Rose 7fd75f34ea 1.42.0 Changelog update v1.42.0 2026-08-31 18:24:25 -05:00
Calvin Rose fa617d84c1 Fix warning in pp.c for msvc 2026-08-31 18:15:47 -05:00