Calvin Rose
ca9ffaa5bb
Avoid memory leak when canceling fibers with threaded channels.
...
Objects in channels are sent as messages that need to be freed by the
consumer. However, in certain cases, no consumer is available and the
messages were being discarded without properly being freed. This should
also fix `-fsanitize=address` on GCC and CLANG with the default test
suite.
2026-02-20 14:47:00 -06:00
Calvin Rose
e61194a8d9
Remove older extra channel unlocks.
2026-02-20 08:17:25 -06:00
Calvin Rose
56b5998553
Suspicious locking behavior with select.
...
This looks like it could cause deadlocks with threaded channels
(normal channels are unaffected, locking/unlocking is a no-op).
2026-02-20 07:35:18 -06:00
R Fisher
ea997d585b
fix multicast on illumos ( #1717 )
...
illumos, like BSD, expects IP_MULTICAST_TTL to be
an unsigned char
2026-02-20 07:30:30 -06:00
Calvin Rose
68850a0a05
Update for 1.41.2 patch.
2026-02-18 08:19:13 -06:00
Calvin Rose
b2c9fc123c
Generate JOP_PUT_INDEX in the compiler when possible.
2026-02-17 09:07:01 -06:00
Evan Shaw
78ef9d1733
Initialize memory allocated by put ( #1715 )
2026-02-17 07:50:50 -06:00
sogaiu
b6676f350c
Use snprintf instead of sprintf - sequel ( #1713 )
...
Co-authored-by: sogaiu <983021772@users.noreply.github.com >
2026-02-16 09:12:02 -06:00
Calvin Rose
0299620a2d
Code defensively with regard to stack resizes from custom get and put
...
for abstract types.
Abstract types whose get/put/length/etc. implementations allocated fiber
slots could break the VM by invalidating the stack pointer in the
interpreter. This is admittedly a bit unusual but is something most
users would probably expect to work. Debugging this would be a real pain.
2026-02-16 09:02:07 -06:00
Calvin Rose
1557f9da78
Don't reference argv after fiber may have been resized.
2026-02-15 21:54:42 -06:00
Calvin Rose
2df16e5a48
Allow garbage collection to be called inside the module entry.
...
This usually shouldn't be needed, but in the case that it is, or if
garbage collection is triggered manually, we can prevent use-after-free.
2026-02-15 18:46:21 -06:00
Calvin Rose
a2a7e9f01e
Add explicit include of inttypes.h
2026-02-15 10:24:56 -06:00
Calvin Rose
4b078e7a45
Use correct format specifier on windows if missing message.
2026-02-15 10:17:16 -06:00
Calvin Rose
2aaa7dfa10
Sort keys when compiling struct and table literals.
...
Order of evaluation becomes more clear in some cases.
2026-02-15 09:42:55 -06:00
Calvin Rose
0aa7dfeb9a
Work on windows for WSAConnect not working.
...
For remote connections, if you did not manually wait for the connection
to settle, the programmer would see unspecified network errors. This is
is because the underlying TCP Connection had not been established yet.
The correct way to deal with this is to use ConnectEx if available
instead of WSAConnect.
2026-02-14 21:11:28 -06:00
Calvin Rose
8f7c32e5cb
Update for msvc build.
2026-02-14 18:31:57 -06:00
sogaiu
abd7bb1110
Use snprintf instead of sprintf ( #1711 )
...
Co-authored-by: sogaiu <983021772@users.noreply.github.com >
2026-02-14 09:04:33 -06:00
Calvin Rose
d81512723b
When pretty printing, don't sort keys for huge tables.
...
This was exposed when printing `(invert (range 200000))`, which
isn't so large that we shouldn't be able to sort it, but was taking
far too long to compute.
2026-02-14 08:57:27 -06:00
Calvin Rose
c7c3821aa6
Remove extra output from peg test.
2026-02-06 00:23:45 -06:00
Calvin Rose
d2685594f9
VERBOSE=1 caused tests to fail as we did more asserts inside the assert.
...
Thenc checked stderr for messages. Since the helper makes assert write
to stderr, this caused extra cruft in our test output.
2026-02-06 00:17:11 -06:00
Calvin Rose
ca5c617fba
More tweaks to peg suite for arm32 failures.
2026-02-06 00:04:18 -06:00
Calvin Rose
16b449a137
Print "actual" output on verbose mode for suite-peg
2026-02-05 23:52:28 -06:00
Calvin Rose
f33697d6a0
Show accumulation buffer and tagged capture in peg debug rule.
2026-02-04 21:17:08 -06:00
Calvin Rose
b2bf70eace
Move peg debug output to stderr in line with other internal debug tools.
...
Also allow disabling color in the debug output.
2026-02-04 18:52:20 -06:00
0xbec163
416bba9bd9
Add ??/debug PEG rule ( #1710 )
...
* Add debug (short-form ??) PEG rule
* Display capture stack to debug PEG rule
* Revise spec_debug to emit just the rule
* Update to proper indentation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* Add a marshal/unmarshal test for ??/debug
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2026-02-04 18:44:46 -06:00
Calvin Rose
517e40a17b
Speed up symbol resolution.
...
In my testing of `janet -l spork -e '(os/exit)'`, this speeds up
compilation by ~5%. Allocating and interning symbols from C is often
slow, so avoid it.
Add utility function for looking up keywords in tables more quickly.
More measurement on compiling spork for compilation speed, win
over original code closer to between 1-2% improvement
2026-02-02 21:19:48 -06:00
Calvin Rose
4f9a2af357
Add unmarshal sandbox.
2026-02-02 18:28:08 -06:00
Calvin Rose
a37752708e
Add :compile, :asm, and :threads to sandbox flags.
...
These can be used to limit programs in a very expansive way.
2026-02-02 18:13:46 -06:00
Calvin Rose
ecb72c9c9a
Revert changes to peg grammar.
2026-02-01 08:08:50 -06:00
Calvin Rose
a95546ff16
Merge pull request #1703 from amano-kenji/peg
...
Make peg-grammar available in all threads for peg/compile
2026-02-01 07:42:28 -06:00
Calvin Rose
d47f82713b
More tweaks for named arity linting.
...
Handle more edge cases where &named is combined with &opt
2026-01-31 23:57:08 -06:00
Calvin Rose
497e363401
Make sure named argumnets are compiled before destructured params.
...
This handles an edge-case when combing destructured and named
parameters that produced spurious and confusing compiler lints.
2026-01-31 19:34:26 -06:00
Calvin Rose
8481da18d0
Add another bounds check for updating labels. Related to #1700
2026-01-31 13:20:45 -06:00
Calvin Rose
8f8382eead
Partially address issue #1654 - better linting for named arguments.
...
While there are still cases that we could improve here, this change will
help in most cases with minimal overhead.
2026-01-31 13:16:02 -06:00
Calvin Rose
a5c4e929e8
Merge pull request #1704 from amano-kenji/os/date
...
Document how to set local timezone for os/date and os/strftime.
2026-01-28 21:37:43 -06:00
sogaiu
d67b462023
Tweak some fiber-related docstrings
2026-01-29 11:39:05 +09:00
Calvin Rose
24ca108288
Add some extra checks for marshalling code.
2026-01-28 10:55:00 -06:00
Calvin Rose
7366fbed1f
Disallow scheduling already modified fibers.
...
While not strictly needed for correctness, this discourages misuse of
fibers and mixing both coroutine, error handling, and scheduling
purposes.
2026-01-28 10:55:00 -06:00
Calvin Rose
797643716b
Address #1707 - do not schedule non-task fibers.
2026-01-28 10:55:00 -06:00
Calvin Rose
ae0afe6198
Add janet_decref_abstract_maybe_free
2026-01-27 13:28:52 -06:00
Calvin Rose
339b0751c8
Address #1705 - ev/close affecting ev/select.
2026-01-24 12:17:02 -06:00
amano.kenji
87b1bf1a66
Document how to set local timezone for os/date and os/strftime
2026-01-24 14:21:33 +00:00
amano.kenji
41354ada96
Make peg-grammar available in all threads for peg/compile
2026-01-24 11:36:49 +00:00
Calvin Rose
ee8d816738
Fix test case.
2026-01-23 08:30:15 -06:00
Calvin Rose
0f285855f0
Address #170 - strchr was not properly checking for 0 byte.
2026-01-23 08:13:15 -06:00
Calvin Rose
c43e06672c
Address #1700 and move test cases to suite-compile.janet
2026-01-23 08:01:22 -06:00
Calvin Rose
2fabc80151
Address #1699 and improve test case for #1702
2026-01-23 07:46:31 -06:00
Calvin Rose
4dd08a4cde
Address #1702 with extra bounds check.
...
The buffer overflow happened because we were creating many upvalue
slots in the compiler without using them, along with some faulty logic
that used the wrong length to check for the bitmap's bounds.
2026-01-23 07:33:05 -06:00
Calvin Rose
6111291ede
Revert a number of minor, unneeded changes for persistent REPL history.
2026-01-22 20:13:49 -06:00
Calvin Rose
0c402cf3d6
Add persistent repl history.
2026-01-22 19:17:16 -06:00