1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-05 16:26:17 +00:00
Commit Graph

4025 Commits

Author SHA1 Message Date
Calvin Rose
9b9f67c371 Merge branch 'master' into compile-opt 2023-09-03 10:18:54 -05:00
Calvin Rose
61791e4a4c Update docstring. 2023-09-03 10:18:37 -05:00
Calvin Rose
51c0cf97bc
Merge pull request #1280 from primo-ppcg/lengthable
Add `lengthable?`
2023-09-01 17:41:25 -05:00
primo-ppcg
4cb1f616c5 allow reverse on non-lengthable 2023-09-01 16:04:21 +07:00
primo-ppcg
645109048b update keys, values, pairs 2023-09-01 13:18:31 +07:00
primo-ppcg
f969fb69e1 add lengthable? 2023-09-01 13:04:53 +07:00
Calvin Rose
bfb60fdb84
Merge pull request #1278 from primo-ppcg/loop-range
Allow one-term `:range` and `:down` forms
2023-08-29 08:23:36 -05:00
primo-ppcg
2f43cb843e Allow one-term :range and :down forms 2023-08-29 10:59:16 +07:00
Calvin Rose
874fd2aba7 don't crash repl if someone sets a bad *pretty-format* 2023-08-27 13:09:22 -05:00
Calvin Rose
33d1371186 Update specials.c for formatting. 2023-08-25 16:28:41 -05:00
Calvin Rose
d2dd241e6b
Merge pull request #1269 from primo-ppcg/check-nil-form
Optimize nil conditions for while and if
2023-08-24 09:30:58 -05:00
Calvin Rose
4ecadfabf4 Fix atomics - warnings on windows 2023-08-24 08:00:50 -05:00
Calvin Rose
ffd79c6097 Allow multiple simultaneous interrupts cleanly for #1262
Instead of setting a flag, each interrupt increments an atomic
counter. When the interrupt is finally handled, either by scheduling
code to run on the event loop or executing some out of band code, the
user must now decrement the interrupt counter with
janet_interpreter_interrupt_handled. While this counter is non-zero, the
event loop will not enter the interpreter. This changes the API a bit but
makes it possible and easy to handle signals without race conditions
or scheduler hacks, as the runtime can ensure that high priority code is
run before re-entering possibly blocking interpreter code again.

Also included is a new function janet_schedule_soon, which prepends to
the task queue instead of appending, allowing interrupt handler to skip
ahead of all other scheduled fibers.

Lastly, also update meson default options to include the
interpreter_interrupt code and raise a runtime error if os/sigaction
is used with interpreter interrupt but that build option is not enabled.
2023-08-24 07:38:53 -05:00
primo-ppcg
35a8d2a519 Optimize nil conditions for while and if 2023-08-24 17:50:31 +07:00
Calvin Rose
21eab7e9cc Update sigaction to help address #1262.
Update example to have 4 cases - case 3 was previously broken but should
now work.
2023-08-23 09:16:59 -05:00
Calvin Rose
d9605c2856 Allow iterating over generators with pairs, keys, and values. 2023-08-22 19:25:05 -05:00
Calvin Rose
70a467d469
Merge pull request #1266 from primo-ppcg/min-max
Speed up `min`, `max`
2023-08-21 22:32:03 -05:00
primo-ppcg
6e8979336d speed up min, max 2023-08-22 00:39:28 +07:00
Calvin Rose
c3a4fb6735 Merge branch 'master' into compile-opt 2023-08-20 18:55:15 -05:00
Calvin Rose
ee01045db5 Update CHANGELOG.md 2023-08-20 15:56:58 -05:00
Calvin Rose
b7f8224588 Address #1263
Fix reference counting when cleaning up unused abstract types
per-thread.
2023-08-20 14:53:25 -05:00
Calvin Rose
e5893d0692 Fix reference counting for threaded abstract types.
Was very borked. The sweep phase should drop references to unused
abstracts but wasn't, resulting in each collection decrementing the
count by one until 0 was hit, even if other threads maintained a
reference.
2023-08-20 14:50:46 -05:00
Calvin Rose
5f5e5cf693 Merge branch 'master' into compile-opt 2023-08-20 13:08:56 -05:00
Calvin Rose
ca4c1e4259 Try to use atomics inside signal handler for ref count. 2023-08-20 08:49:49 -05:00
Calvin Rose
91712add3d Fix threaded abstracts in min build. 2023-08-19 20:19:05 -05:00
Calvin Rose
7198dcb416 Add sanboxing for signal handling. 2023-08-19 17:44:04 -05:00
Calvin Rose
08e20e912d Use pthread_sigmask when adding signal handlers. 2023-08-19 17:30:55 -05:00
Calvin Rose
f45571033c Add os/sigaction for signal handling.
Also improve interrupts to work better with busy loops
and signals.
2023-08-19 13:26:29 -05:00
Calvin Rose
2ac36a0572
Merge pull request #1257 from primo-ppcg/any-every
Update `any?`, `every?`
2023-08-18 07:20:44 -05:00
Calvin Rose
3df1d54847
Merge pull request #1258 from primo-ppcg/each
Update `each` keys before body
2023-08-18 07:16:19 -05:00
Calvin Rose
f3969b6066
Merge pull request #1259 from primo-ppcg/buffer-from-bytes
Add `buffer/from-bytes`
2023-08-18 07:15:08 -05:00
primo-ppcg
6222f35bc8 add buffer/from-bytes 2023-08-18 12:35:12 +07:00
primo-ppcg
2f178963c0 update each keys before body 2023-08-18 10:32:24 +07:00
primo-ppcg
15760b0950 update any?, every?
Updates `any?` and `every?` to be exact functional analogues to `or` and `and`.
2023-08-18 07:39:30 +07:00
Calvin Rose
43a6a70e1e
Merge pull request #1255 from primo-ppcg/sort
Special case common `sort` usages
2023-08-16 20:34:17 -05:00
Calvin Rose
cd36f1ef5f Distinguish between threaded channels and non-threaded when marshalling.
Threaded channels _can_ be marshalled, just not for communication
between threads. This is a special case since the same abstract type
is used for both threaded and non-threaded channels.
2023-08-16 14:26:52 -05:00
Calvin Rose
46bda4e6fa Stub out type inference pass. 2023-08-16 14:09:25 -05:00
primo-ppcg
cdd7083c86 special case common sort usages 2023-08-15 11:58:22 +07:00
Calvin Rose
fdbf4f2666 Merge branch 'master' into compile-opt 2023-08-13 12:36:19 -05:00
Calvin Rose
8df7364319 Quick fix for discussion #1253
Protect against garbage collection during connect.
2023-08-13 12:00:54 -05:00
Calvin Rose
b939671b79 Add check for redefining types. 2023-08-13 11:09:20 -05:00
Calvin Rose
63023722d1
Merge pull request #1246 from wooosh/use-object-typedefs
Use typedefs for strings, symbols, keywords, tuples, structs, and abstracts.
2023-08-13 08:33:19 -05:00
Calvin Rose
4b8e7a416f Have separate instructions for pointer arith 2023-08-12 17:36:06 -05:00
Calvin Rose
79c12e5116
Merge pull request #1252 from primo-ppcg/reverse
Rework `reverse`, again
2023-08-12 14:29:23 -05:00
Calvin Rose
1e1e7a5cfd Update garbage collection for sysir abstract type. 2023-08-12 13:47:23 -05:00
Calvin Rose
91e459e4a5 Format sysir. 2023-08-12 13:43:51 -05:00
Calvin Rose
b6adc257f4 Merge branch 'master' into compile-opt 2023-08-12 13:43:28 -05:00
Calvin Rose
a2bd98390e More work on the sysir. 2023-08-12 13:42:52 -05:00
primo-ppcg
53e16944a1 rework reverse, again 2023-08-13 00:54:17 +07:00
Calvin Rose
d9912f38f8 Add union types and change name of type constructor instructions. 2023-08-12 10:29:24 -05:00