Commit Graph

868 Commits

Author SHA1 Message Date
Matthew Flatt
afebbdd6a9 convert GC to "mkgc.ss" implementation
Replace repetitive C code in "gc.c" and "vfasl.c" with an
implementation using a little "Parenthe-C" language, which is a
somewhat declarative description of object tracing. From that
descrition, we generate different kinds of tracing functions, such as
the copy function or the sweep function.

The little language is still bascially C, just with parentheses and
parameterization that is much better than trying to use the C
preprocessor. (The "mkgc.ss" file includes the compiler from
Parenthe-C to C.)

Besides replacing existing code, we also generate a new traversal to
implement `compute-object-sizes`. Finally, the GC can now perform a
fused `collect` and `compute-object-sizes` in a single traversal.

Also improve the way that locked objects are detected during GC. This
can make a significant difference (on the order of 10-20% for a full
collection) when locked objects are long-lived.

original commit: de1f5c41d729ac75822a1f1e633ec6d042c883dc
2020-04-04 10:21:16 -06:00
Matthew Flatt
8656bbae7e fix ephemeron allocation
Only half(!) of the needed space was actually allocated. The extra
space is ony used after a GC, however, and a GC makes the extra room,
so that's why things haven't fallen over completely, but that's more
subtle than intended.

original commit: 3d72bc14b9247d6764809cb651403dbb4063a905
2020-04-04 10:01:04 -06:00
Gustavo Massaccesi
5c91b7f9ac cptypes: fix reduction of $value in ignored expressions
original commit: 858cc5fe0f40e73a3473e3cc3f506c2c232c0a81
2020-04-01 18:59:22 -03:00
Matthew Flatt
f828cb1eaa fix emphemeron-key tracking in a segment with locked objects
original commit: 9d1252b176e972f92030599dae0ce159c9d36c5b
2020-04-01 07:53:32 -06:00
Matthew Flatt
ec138ba57c repair compute-size-increments for anonymous fields
The size of a record with anonymous fields was not included in the
computed size.

original commit: 1c44e61a8174629cacc71adedccc028e982ca323
2020-03-28 08:34:48 -06:00
Matthew Flatt
de465e4f92 fix vfasl problems
Fix problems with record meta-types and symbol interning interleaved
with vfasl loading.

original commit: 2d98d94b3c4d634ba882f10eaebc627a5d9a1ccd
2020-03-28 08:34:48 -06:00
Matthew Flatt
26a83b4b8e avoid fold-left on records in compute-size-increments
original commit: 76713b4a708efbe1b3698d9febc9d28225f383c5
2020-03-28 08:34:48 -06:00
Matthew Flatt
bb4e1c5c51 avoid copying property lists in inspector
original commit: cab986a82105814e605bb03cc38000dff79dfb61
2020-03-28 08:34:48 -06:00
Gustavo Massaccesi
6a964d7600 cptypes: add fuel for simple? and single-valued?
So they can recognize easy cases like the expansion of not

(not x) => (if x #f #t)

original commit: 83f43e4fd228c3df503f8ab972aec71efa4ba496
2020-03-24 09:22:33 -03:00
Gustavo Massaccesi
a72817e69c cptypes: add handlers for atan and char-name
They had a very strange signature, than needs a special case.

original commit: 16d94b6731982f76548fc26c0e3524b253ddbb66
2020-03-24 09:21:08 -03:00
Gustavo Massaccesi
f976cec5da cptypes: remove discardable operations in arguments that are ignored after a reduction
After a reduction like (pair? (list <x> <y>)) => (begin (list <x> <y>) #t) make a semi-shallow
reduction of the argument, so it is further reduced to (begin <x> <y> #t) and even remove <x> or <y>
if they have no side effects.

original commit: fe085761cbd200f4c67025d968d6d1418ab7d3e7
2020-03-24 08:13:09 -03:00
Matthew Flatt
c920f3953d collect in main thread when active
For a collect rendezvous, call the collect-notify handler in
the main thread if it is active. A collect-notify handler can
then make sure the main thread is active and try again, if
that's useful to an application.

original commit: 0bc286e81827f029dd02a3627a192edd053b3b91
2020-03-23 15:32:00 -06:00
Matthew Flatt
b5bce547d2 fix x86 (32-bit) __collect-safe callable
original commit: 530e6ac49b6ac31c2993517cb15633de73e6c85a
2020-03-17 20:31:37 -06:00
Gustavo Massaccesi
16b9ffb57c cptypes: fix reduction of record?
Check that the rtd argument is single valued. For example
(record? 5 (values 1 2))
was incorrectly reduced to
(begin 5 (values 1 2) #f)

original commit: 543ba171cee6c03b4207de5ea970573dd85dd3a0
2020-03-13 15:20:30 -03:00
Matthew Flatt
840e5143e2 recognize long form of call/cc in optimization
original commit: 05c31cd27455bce6d122188da14b4973d8a49d7a
2020-03-13 08:14:39 -06:00
Matthew Flatt
5f57648104 add call-in-continuation
This operation effectively allows sending an expression back to a
continuation, instead of just a value. It's the same as Marc Feeley's
`continuation-slice` operation, but adjusted slightly to support
continuation attachments.

original commit: d0e36e72d20a6eaa5d9d8b795da5e77abde75289
2020-03-12 04:48:39 -06:00
Matthew Flatt
ad7f0b9b57 fix annotation argument in fasl step
original commit: e10716c3c6f456007ddfaee75ad07233b31c33d8
2020-03-07 07:59:16 -07:00
Matthew Flatt
35e77092f3 fix typo in a debugging assertion
original commit: 10148ea09455445a76b037e2e9fb5abcb72913ae
2020-03-07 07:06:05 -07:00
Gustavo Massaccesi
75872880f8 cptypes: rewrite implementation of primref->argument-predicate
Also, remove signatures from primref. Now the record is reverted to the one in
the main ChezScheme version.

And lift most of the code outside the cptypes function.

original commit: 8f4384e0a5e1e9b383f65e097d6088b30d8069e5
2020-03-07 08:47:37 -03:00
Gustavo Massaccesi
db47781c8c cptypes: rewrite primref->result-predicate
Also, move all result-types calculations to priminfo.ss

original commit: 5a36377edca85724e44a6462ad8a0e53b1c4f669
2020-03-07 08:47:37 -03:00
Gustavo Massaccesi
1cb4278a06 cptypes: pass an explicit variable for the prelex counter
The implicit counter to number the prelex has caused problems in the multithread
version many times, so make it an explicit arguments of the functions that is
passed around until the prelex-counter function uses it.

Perhaps it can be remover later, after rewriting the implementation of
define-specialize.

original commit: 6ca1db6a0159b6a7756fad7c5e25b0225c858609
2020-03-07 08:47:36 -03:00
Matthew Flatt
d2961790b0 add fasl terminator
While "\44\26\2\f6" currently works as a terminator for non-compressed
fasl streams, the working byte sequence varies as the fasl format
changes. Add "\177" as a simpler and unchanging terminator.

original commit: 332019360491be6cedd2063c9a8056183d764bbb
2020-03-05 17:05:22 -07:00
Gustavo Massaccesi
83e920e0a0 fix fasl-read signature
primdata.ss

original commit: 8a3300b4898fb2f8504512b9a8a91a41582d8b3a
2020-03-01 13:25:17 -03:00
Matthew Flatt
f8fa08dafb fix version in install makefile
original commit: 060bf8c21f1fc758de68d2eff0b6f9f802207c25
2020-02-23 07:20:24 -07:00
Matthew Flatt
5b7f4e2fd8 unbreak Windows build
original commit: 6c062f550486dfb9b25dfc62f6d1a829bbce1d1b
2020-02-22 19:41:02 -07:00
Matthew Flatt
995e53ca71 Merge github.com:cisco/ChezScheme
original commit: 8cf52012e2a7b5928cb2602bb17e0128ae0f2776
2020-02-22 15:18:47 -07:00
dybvig
d0b405ac8b library-manager, numeric, and bytevector-compres improvements
- added invoke-library
    syntax.ss, primdata.ss,
    8.ms, root-experr*,
    libraries.stex, release_notes.stex
- updated the date
    release_notes.stex
- libraries contained within a whole program or library are now
  marked pending before their invoke code is run so that invoke
  cycles are reported as such rather than as attempts to invoke
  while still loading.
    compile.ss, syntax.ss, primdata.ss,
    7.ms, root-experr*
- the library manager now protects against unbound references
  from separately compiled libraries or programs to identifiers
  ostensibly but not actually exported by (invisible) libraries
  that exist only locally within a whole program.  this is done by
  marking the invisibility of the library in the library-info and
  propagating it to libdesc records; the latter is checked upon
  library import, visit, and invoke as well as by verify-loadability.
  the import and visit code of each invisible no longer complains
  about invisibility since it shouldn't be reachable.
    syntax.ss, compile.ss, expand-lang.ss,
    7.ms, 8.ms, root-experr*, patch*
- documented that compile-whole-xxx's linearization of the
  library initialization code based on static dependencies might
  not work for dynamic dependencies.
    system.stex
- optimized bignum right shifts so the code (1) doesn't look at
  shifted-off bigits if the bignum is positive, since it doesn't
  need to know in that case if any bits are set; (2) doesn't look
  at shifted-off bigits if the bignum is negative if it determines
  that at least one bit is set in the bits shifted off the low-order
  partially retained bigit; (3) quits looking, if it must look, for
  one bits as soon as it finds one; (4) looks from both ends under
  the assumption that set bits, if any, are most likely to be found
  toward the high or low end of the bignum rather than just in the
  middle; and (5) doesn't copy the retained bigits and then shift;
  rather shifts as it copies.  This leads to dramatic improvements
  when the shift count is large and often significant improvements
  otherwise.
    number.c,
    5_3.ms,
    release_notes.stex
- threaded tc argument through to all calls to S_bignum and
  S_trunc_rem so they don't have to call get_thread_context()
  when it might already have been called.
    alloc.c, number.c, fasl.c, print.c, prim5.c, externs.h
- added an expand-primitive handler to partially inline integer?.
    cpnanopass.ss
- added some special cases for basic arithmetic operations (+, -, *,
  /, quotient, remainder, and the div/div0/mod/mod0 operations) to
  avoid doing unnecessary work for large bignums when the result
  will be zero (e.g,. multiplying by 0), the same as one of the
  inputs (e.g., adding 0 or multiplying by 1), or the additive
  inverse of one of the inputs (e.g., subtracting from 0, dividing
  by -1).  This can have a major beneficial affect when operating
  on large bignums in the cases handled.  also converted some uses
  of / into integer/ where going through the former would just add
  overhead without the possibility of optimization.
    5_3.ss,
    number.c, externs.h, prim5.c,
    5_3.ms, root-experr, patch*,
    release_notes.stex
- added a queue to hold pending signals for which handlers have
  been registered via register-signal-handler so up to 63 (configurable
  in the source code) unhandled signals are buffered before the
  handler has to start dropping them.
    cmacros.ss, library.ss, prims.ss, primdata.ss,
    schsig.c, externs.h, prim5.c, thread.c, gc.c,
    unix.ms,
    system.stex, release_notes.stex
- bytevector-compress now selects the level of compression based
  on the compress-level parameter.  Prior to this it always used a
  default setting for compression.  the compress-level parameter
  can now take on the new minimum in addition to low, medium, high,
  and maximum.  minimum is presently treated the same as low
  except in the case of lz4 bytevector compression, where it
  results in the use of LZ4_compress_default rather than the
  slower but more effective LZ4_compress_HC.
    cmacros,ss, back.ss,
    compress_io.c, new_io.c, externs.h,
    bytevector.ms, mats/Mf-base, root-experr*
    io.stex, objects.stex, release_notes.stex

original commit: 72d90e4c67849908da900d0b6249a1dedb5f8c7f
2020-02-21 13:48:47 -08:00
Matthew Flatt
745482e3e4 vfasl: repairs for fcallables
A 0 relocation is used by fcallable code as a recognizable cookie, and
its relocations must be preserved.

original commit: 38fb3fdf75cf6540d6bd2568f015af6272d22995
2020-02-20 13:24:47 -07:00
R. Kent Dybvig
8457bfe57a Merge pull request #494 from jltaylor-us/concatenate-object-files
Add concatenate-object-files procedure.
original commit: 28254f270ab55e8dde4a4318c9998b42a241f7a5
2020-02-20 10:48:09 -08:00
Jamie Taylor
3e1ee3c681 Add concatenate-object-files procedure.
In previous versions of Chez Scheme, multiple object files could be
combined by concatinating them into a single file.  To support faster
object file loading and loadability verification, recompile information
and information about libraries and top-level programs within an object
file is now placed at the top of the file.  The new
concatenate-object-files procedure can be used to combine multiple object
files while moving this information to the top of the combined file.

original commit: d4ef2ad9393578ff3ffe3b712736bc6a4ae7b8eb
2020-02-18 14:51:38 -05:00
Matthew Flatt
aa0c555c70 Add support for record types with anonymous fields
Avoid saving a list of per-field vector descriptions when
field names are not going to be relevant and the rest of
the description is easily computed from information that is
alerady available.

original commit: a20e3f305cee3b4a386582dd50cda344a49174c3
2020-02-11 06:10:47 -07:00
Matthew Flatt
5d45d6dca2 adjust event-detour path again to apply more often
Instead of constaining the use of event-detour so much, make it merely
unlikely that the detour will have to allocate when used in a loop
that otherwise doesn't allocate. We'll only have to allocate if the
available stack space turns out to be too small --- and if we do
allocate, it's not the end of the world.

original commit: f1dbed82df415c18c8304bedcee2ecf4912badc7
2020-02-09 09:43:26 -07:00
Matthew Flatt
fab0282acb disable cptypes specialization of call-with-values, for now
It's not clear whether there's something wrong with this case or
whether it's exposing a more general problem, but disabling it for
now allows a parallel Racket CS build to proceeed.

original commit: 00f6733e573c068165abc4dbbdb46cdede9f778e
2020-02-09 08:54:21 -07:00
Matthew Flatt
115f08603b make cptypes caches thread-local
original commit: 4627507cf081e2ea85b43fe8ca02404396ede253
2020-02-09 08:54:21 -07:00
Matthew Flatt
34dc3f4371 doc clarification on eq-hashtable-try-cell
original commit: bcea49bf88c916c742de48c58e91060489ac8592
2020-02-08 19:25:16 -07:00
Gustavo Massaccesi
24be6703bf cptypes: add support for call-with-values, apply and similar functions
In some procedures, one of the arguments is a function that will surely be called
and the result is the result of the whole expression. These procedures need an
special version of define-specialize that gives more control.

original commit: f2f0401d2b83313e8cb0d5742e89ed098500cbd6
2020-02-08 23:18:23 -03:00
Gustavo Massaccesi
c581cd24fe cptypes: uses define-specialize handlers for special functions like eq? or list
Rewrite the handler of record? and $sealed-record? to make it easier to
understand.

Also, delay the reductions of lambdas in a sequence of arguments. This helps
to reduce for example

  (map (lambda (x) (box? b)) (unbox b))
=>
  (map (lambda (x) #t) (unbox b))

original commit: 20e478b9280c779e260f5557c2eee74946313a44
2020-02-07 21:28:49 -03:00
Gustavo Massaccesi
eb29023ed9 cptypes: add bottom-fxmap
It is a fxmap that is is full of 'bottom.

original commit: c171fca3345de3190e8d915b0cdf4c11d5ec055c
2020-02-07 21:28:48 -03:00
Matthew Flatt
baf3bba9de constrain smaller trap-check code to avoid allocation
Having the trap check allocate is questionable, since it can be
triggered during a loop that otherwise performs no allocation. Also,
on platforms where at most 1 argument is passed in a register, then
sending two arguments to the event handler could potentially need
stack space that isn't there. So, constrain the smaller trap-check
code to cases where no stack space is needed and where no allocation
happens unless the wrong number of arguments are provided.

original commit: 260a7ef5bc0bf851d9848587b0a78bdb4aab59f8
2020-02-07 15:27:07 -07:00
Matthew Flatt
d4981dd8c3 less code for trap checks
When a proceudre starts with a trap check, move the check to the very
beginning, even before checking the argument count. That way, event
detection can turn into a compact jump to an event handler, instead of
inserting a general call to `$event` in the procedure body.

original commit: 06b12d505698a2378734689370bb9e0f8eda06b9
2020-02-07 10:56:15 -07:00
Matthew Flatt
40c407e1c2 add $record-type-field-count
This is a `$` function because it is defined only for record types
that have pointer-sized fields (i.e., the normal case).

original commit: 47213a7c8450aa52bd18e8f605c02b6c1081eadf
2020-01-31 11:17:04 -07:00
Matthew Flatt
fd1745c628 improve code generation for black hole as an immediate
original commit: 2e15df8a992d1c634f04bf4e162f40026a4f0840
2020-01-31 06:43:14 -07:00
Matthew Flatt
d13e5898c8 add enable-unsafe-variable-reference
original commit: 77a0ef249b6d419dcac7c8e1c28e710b30a7aa33
2020-01-30 17:46:30 -07:00
Matthew Flatt
27e21e6e7d code inspector: improvements to reloc reporting
Fix 'reloc to avoid a crash on static-generation code, and add
'reloc+offset to report an offset for each entry.

original commit: 4d4195044377f9c619cfb46056e365044069d5bc
2020-01-29 16:22:52 -07:00
Matthew Flatt
6962aceaf0 change * to Karatsuba
original commit: 8038a1745b8d176bc97c1dd69024da76626eb775
2020-01-26 10:51:38 -07:00
Matthew Flatt
5587285fac faster bitwise-arithmetic-shift on bignum shift
Immediately produce 0, -1, or out-of-memory, instead of looping
towards one of those.

original commit: dccc7e81b2f0909ce3c7871b849b0faa83eae576
2020-01-26 08:23:37 -07:00
Matthew Flatt
16acbf1ae6 fix a test
original commit: bd0eb64e1b13e731d8378ffa2fa2bc835795d4f8
2020-01-24 19:32:57 -07:00
Matthew Flatt
26ff90e8e6 more compact return points for function calls
In the general form of a function call, the return point embeds 4
words of information: offset to the start of the enclosing function,
frame size, live-veriable mask, and multiple-value return address. In
the common case, however, the multiple-value return address is either
the same as the return address or it is a `values-error` library
function, and the frame size and live-variable mask fit into a word
with bits to spare. This patch implements a more compact return point
for that common case, which shrinks the 4 words to 2 and also avoids a
relocation (= 1 more word).

Multiple-value returns are more complex with this change (i.e.,
require more code), since they must check whether the return point is
compact or not. But multiple-value returns are far less common than
function calls, so saving function-call space is a clear win.

Overall, this change tends to reduce code size by about 10% on x86_64.

original commit: 1f53b5eabef966db01086cb32e544bbf8deacfca
2020-01-24 19:19:32 -07:00
dyb
1d2d9c6f54 updated release notes date
original commit: 600edcdc0f2ce629d1d632f6df390fb0fbbfb610
2020-01-24 10:39:20 -08:00
Matthew Flatt
83f8acbfef avoid symbolic link in repo checkout
original commit: 8eb10e62d0a58d945dec67cdc38a317a8a1d88e0
2020-01-23 17:58:15 -07:00