You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Memory outside the heap: shen-jit.pointer-sized makes a C pointer readable and writable in place, with
the same functions as a byte buffer, each access checked against the length stated. lib/memory.shen
allocates and frees such memory.
shen-jit.s32, s64, f32 and f64 and their stores, on byte buffers too, and shen-jit.pointer!.
lib/mmap.shen: all of a file as memory, on each system, with mmap.read, mmap.read-write, mmap.create
and mmap.close.
lib/handle.shen: memory that releases itself once nothing reaches it, with handle.wrap, handle.close and handle.sweep, over shen-jit.pointer-guard, shen-jit.pointer-owner and shen-jit.pointers-dead.
shen-jit.collect collects now.
shen-jit.pointer-read-only makes a pointer that raises when stored to, which is what mmap.read gives.
Real registers in native code written by hand: real, f64!, jump-unless and return-real keep doubles
unboxed in loops that call nothing, and loop and again make those loops, which can nest.
Word registers there too: word, jump-unless-word, return-word, word-box, and u8! to u64! keep 64-bit
integers that wrap, for hashes and random numbers, and as indices with no tag to check.
make bench-numeric runs numeric programs and a path tracer in C and in Shen.
make test-thorn runs THORN, from the kernel, with no time limit, and checks its inference counts and what it leaves
unproved, which Shen/Scheme also gives.
Contributed by @pyrex41 in #9.
The rendered guide now has how Shen/JIT works, its semantics, its instructions and calling C as pages of
their own.
Changed
Arithmetic and comparisons on reals, and division, compile inline.
A loop that calls nothing works out the memory it reads and stores through once, on the way in.
In native code, machine registers go to what the deepest loops use most, whatever the order of the names, and
an access to memory reached at one width takes one comparison.
New objects now always go in the same memory, so a program that allocates uses much less of it, and allocates
faster where two semispaces taking turns outgrew the cache. A process that only starts takes about 2 MB more.
On x86-64 outside Windows, a loop that calls nothing keeps up to four values in registers, where it was two.
The heap grows with what is live, not by doubling, so a program holding a lot of data no longer slows down as it
nears the next doubling. Such a program can use more memory than before, at most about 1.7 times.
get-time takes about half as long, as it no longer looks up the symbols run and unix at each call. THORN asks
for the time at every predicate call.
Contributed by @pyrex41 in #8.
Fixed
=, <, >, <= and >= now compare an integer with a real exactly. From 2^53 up the integer was rounded to a
double first, so = was not transitive, unification could depend on the order of its arguments, and two keys that
were = could have different hashes.
Contributed by @pyrex41 in #6.
= no longer crashes on terms nested deeper than the C stack, in the head of a pair or in an absvector. A cyclic
term still ends the process, now with a message.
Contributed by @pyrex41 in #7.
An integer literal too big for a fixnum, and one with a large exponent such as 1e300, now reads as the
nearest real. They could land slightly off it, as 1e100 read as 1.0000000000000006e100.
A burst of new symbols, such as from gensym in a loop, no longer slows every later collection for as long as
the process runs.