commit fbb0711ae1
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 12:07:55 2023 -0500
Distinguish between subprocess when testing.
commit 676b233566
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 11:59:17 2023 -0500
Hack for qemu based testing (also should work with valgrind)
commit d7431c7cdb
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 11:54:04 2023 -0500
Revert "Test removing 32bit ptr marshalling."
This reverts commit 566b45ea44.
commit 566b45ea44
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 11:52:22 2023 -0500
Test removing 32bit ptr marshalling.
commit ff2f71d2bc
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 11:42:10 2023 -0500
Conditionally compile marshal_ptr code.
commit bd420aeb0e
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 11:38:34 2023 -0500
Add range checking to bit-shift code to prevent undefined behavior.
commit b738319f8d
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 11:17:30 2023 -0500
Remove range check on 32 bit arch since it will always pass.
commit 7248626235
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 10:56:45 2023 -0500
Quiet some build warnings.
commit 141c1de946
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 10:50:13 2023 -0500
Add marshal utilities for pointers.
commit c2d77d6720
Merge: 677b8a6fff90b81e
Author: Calvin Rose <calsrose@gmail.com>
Date: Sat Jun 24 10:40:35 2023 -0500
Merge branch 'master' into armtest
commit 677b8a6f32
Author: Ico Doornekamp <ico@zevv.nl>
Date: Mon Jun 12 21:01:26 2023 +0200
Added ARM32 test
When suspended in `ev/give` or `ev/take`, closing the channel should
cause the result of `ev/give` or `ev/take` to be `nil`.
When suspended in `ev/select`, closing the channel should cause the
result of `ev/select` to be `[:close ch]`.
The results were flipped before.
By take and releasing locks twice per channel in the case where nothing
is reading, there was an opportunity for ev/select to hang in the
multithreaded case. Also silence valgrind/helgrind errors.
The sandboxing API is meant to make janet a bit more attractive
for certain application embedding use cases. The sandboxing API
puts limits on what system resources the interpreter can access.
Adds extra information to default information from supervisor
channels. For threaded channels as supervisors, we don't get
the source fiber so identifying the source of messages was not
possible. This change allows better multithreading with supervisors.
Should make janet a bit easier to use. Also changes the
header to not expose the size of native mutexes and rwlocks, except
with janet_os_mutex_size and janet_os_rwlock_size.
FFI may be best implemented as an external library
(libffi has incompatible license to Janet) or as code
that takes void * and wraps then into Janet C functions
given a function signature. Either way, we need to some way
to load symbols from arbitrary dynamic libraries.
This is more intuitive and avoids the possibilty of strange code
to resume or cancel a fiber after it was scheduled but before it was
entered for the first time.
handles returned by CreateFileA and FILE_FLAG_OVERLAPPED
support reading from arbitrary offsets.
The offset is passed to ReadFile in through the OVERLAPPED structure.
Since state->overlapped is zeroed ev_machine_read
ReadFile would always read from the start of the file and never finish
This commit changes ev_machine_read to update the offset to
the number of bytes read before calling ReadFile.
Rather than manual reference counting for suspended fibers, we
automate the process by incrementing "extra_listeners" every time
we suspend a fiber in the event loop, and decrement when that fiber
is resumed. In this manner, we keep track of the number of suspending
fibers in a simpler, more correct way.
Priorly we only checked exactly one state when an event was received.
This was incorrect. A state may have a next state, an action to take
after the first in the list of states has been taken. This change
acknowledges that and makes the code work with the state list vs just
the head of the list.
Don't use a timer filter, just set the timeout on each call to kevent.
Should hopefully work around the 1ms minimum on NetBSD and be possibly
more performant.
FreeBSD is the only BSD supporting ABSTIME timers, whereas the rest
demand intervals. Janet operates on timestamps, which are absolute
times, as per ABSTIME. The idea was to use that under FreeBSD but not
the other BSDs. This commit changes that since ABSTIME breaks when the
timeout supplied is for a time prior to whatever the time is
now (invalid argument). We now utilize the same logic we use on the
other BSDs with FreeBSD to effect interval timeouts since intervals are
absolutely sometime beyond now, be it now and less than a millisecond,
or more than a millisecond. This will hopefully unbreak BSD builds when
running the test suite.
Minimum interval for a timer must be 1 or more (or we get EINVAL) and
Janet fails tests and halts events that the programmer may still be
interested in.
A comptime known value of 0 for data in EV_SET with EVFILT_TIMER causes
a complete compilation failure (fails to link). This fixes it by making
it a 1 instead of a 0 for amount of milliseconds in the interval to wait
under NetBSD.
NetBSD and OpenBSD lack NOTE_ABSTIME and NOTE_MSECONDS, so we define
those and create a macro that we use for all timeout values in EV_TIMER
events that will on all BSD excepting FreeBSD change an absolute time
into an interval.
Checking throught NetBSD's man pages, excepting for NetBSD-current,
NetBSD uses `intptr_t` as the type for `.udata`. This change allows for
`.udata` to match whatever type (by cast) the underlying system uses.
Pretty obvious I thought control statements were glued to their opening
parenthesis at first and then I realized not and voila, a bundle of
mixed style. Hopefully this fixes all of it.
From this point things should be bug fixes or code formatting most
likely.
Updated commentary (removed superfluous comments, and commented out
code). Refined commentary where it seemed important and may help whoever
comes behind me keep from making bad assumptions similar to the ones I
made.
All tests ran with `gmake test` now pass. `valgrind` with FreeBSD does
not support forking so `gmake valtest` fails once child processes are
started. Determined not an issue, can't fix valgrind.
Need to guard against errors when reading/writing probably, if there is
an error, forgo those events.
Guard against null state (and the byproduct, a segfault), check if the
state is null before utilizing it.
Note that this is a work in progress and simply a first attempt at
getting some code into place before being able to test it. This code
follows of sorts both the poll and epoll sections of the codebase hoping
to achieve the exact same.
A threaded abstract is an abstract type that can be freely shared
between threads. While no synchronization is provided, refcounting
and transport between threads is. This will let implementers more easily
exploit OS-level parallelism in C library code. The caveat with these
types is that they need to be careful in how they interact with objects
on other heaps.
Some pointer casting with abstract types was incorrect, resulting
in strange behavior when trying to use supervisor channels that were
threaded. This fix also adds the ability to supply a supervisor channel
directly when creating a thread.
Introduces close semtantics to channels as well, but otherwise
threaded channels behave much like non-threaded channels. They have
different marshalling behavior though, and can only send values over by
packing and unpacking them. For now, this means only primitive values
although this will be expanded.
Also missing some implementation for closing threaded channels, and a
whole lot of testing. Achtung!, Caveat emptor, here be dragons and bugs.
This makes certain algorithms simpler as channels
now have an explicit lifetime - multiple readers can coordinate
closing without needing to ensure the same number of reads as writes.