Commit Graph

42440 Commits

Author SHA1 Message Date
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
Paulo Matos
7621ccbb7b
Explicit zero assign to avoid warning (#3082)
GCC 9.3 things that `h2` might reach line 385 uninitialized.
```
./hash.c:385:14: warning: 'h2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  385 |       h = (h + h2) & mask;
      |           ~~~^~~~~
```
2020-03-27 18:37:19 +01:00
Matthew Flatt
4a2cb6f577 bc: fix optimizer bug
Local-variable type information was not properly removed from
information threaded through optimization.

Closes #3081
2020-03-24 08:51:37 -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
9222a135c3 cs: reliable GC callbacks on major GCs
A Chez Scheme garbage collection involves a rendezvous among threads
that are used to implement places and futures (and potentially other
things that create Chez-level threads). The thread that is used to
drive the garbage collection was not formerly specified, and callbacks
like the GC icon in DrRacket can only be run in the initial thread.
When a major collection was run in a non-initial thread, the callback
was simply skipped.

The Racket branch of Chez Scheme now drives a collection in the
initial thread whenever that thread is active. In Racket CS, the
initial thread can be inactive if it's waiting for external events,
and a place can meanwhile trigger a GC. Now, when the Racket CS GC
callback is called for a major collection in any thread other than the
initial one, it defers the major collection to an asynchornous
callback in the main thread (and meanwhile performs a minor
collection).

So, a major collection might now be delayed by just a little while if
the main thread is inactive, such as when it's waiting for external
events, but callbacks like the GC icon in DrRacket will be reliably
invoked for major collections.
2020-03-23 17:50:04 -06: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
Paulo Matos
4a62408b71
Fix typo in comment 2020-03-23 16:58:33 +01:00
Sorawee Porncharoenwase
3c966bc297 Unbreak syntax/to-string tests
It's still unclear what the specification of syntax->string regarding whitespace
before closing parens should be. The implementation also has not dealt with
the issue. This PR therefore removes whitespace before closing parens from
the tests.

Once the discussion at
https://github.com/racket/racket/issues/3071#issuecomment-601984438
has reached a conclusion and implemented, we can add these tests back.
2020-03-22 20:46:12 -04:00
lkh01
d9c064d06c make syntax->string work with unquote, quasiquote, etc. 2020-03-22 15:05:01 -04:00
lkh01
6a7ad2e49e add some tests for syntax->string 2020-03-22 15:05:01 -04:00
lkh01
40c589ef8a do not overwrite whitespace after a quote 2020-03-22 15:05:01 -04:00
lkh01
2a8e10b31a account for difference between quote and ' in syntax->string 2020-03-22 15:05:01 -04:00
Sam Tobin-Hochstadt
b1a415f232
Add additional syntax tests in GHA. (#3078)
Suggested by @sorawee.
2020-03-22 11:34:06 -04:00
Matthew Flatt
ba59d87ac4 makefile: add an advice-giving clean target
Implementing a thorough `clean` target for a repo-based is tedious and
error-prone. Instead, make the `clean` target suggest `git clean -d -x
-f .`, which is more effective in most situations (but seems too
dangerous to run automatically).
2020-03-21 15:09:58 -06:00
Matthew Flatt
b5bce547d2 fix x86 (32-bit) __collect-safe callable
original commit: 530e6ac49b6ac31c2993517cb15633de73e6c85a
2020-03-17 20:31:37 -06:00
Matthew Flatt
9effeef7ab cs: fix stencil-vector HAMT for 32-bit platforms 2020-03-17 18:24:30 -06:00
Matthew Flatt
3390896a59 schemify: clean up unnecessary lets in interpreter
Collapse `let` with unused binding to `begin`, and then
collapse resulting nested `begin`s.
2020-03-17 18:24:30 -06:00
Ben Greenman
b69c1208b7 doc: typo, expr -> stx-expr 2020-03-17 12:12:25 -04:00
Sam Tobin-Hochstadt
c7a9690143 Fix recursive make invocation.
Eliminates warning in DrDr.
2020-03-16 13:35:59 -04:00
Matthew Flatt
8f256c9261 cs: fix error-print-width handling when output just fits the limit
For example, if the limit is 5, then "abcde" should print as "abcde",
not "ab...".
2020-03-13 16:12:34 -06:00
Sorawee Porncharoenwase
74c0844101 Also fix ~.a in 3m 2020-03-13 15:20:10 -06:00
Sorawee Porncharoenwase
b8eee66b72 add a test for minimum value for error-print-width 2020-03-13 15:20:10 -06:00
sorawee
8f286fc810 Fix #2986: error-print-width 3 shouldn't error 2020-03-13 15:20:10 -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
c52d45613b minor whitespace corrections 2020-03-13 11:32:49 -06:00
Matthew Flatt
f1a177e880 cs: fix applicable struct implemented with applicable struct 2020-03-13 11:14:39 -06:00
Matthew Flatt
edfdcb0b6d add call-in-continuation
The `call-in-continuation` function generalizes applying a
continuation to values by accepting a thunk that is called in the
restored continuation. In other words, insteda of having to use the
pattern

 ((call/cc (lambda (k)
             .... (set! saved-k k) ...
             (lambda ()
               original-result))))
 ...
 (saved-k (lambda () new-result))

The extra call and thunk on the capture side can be omitted:

 (call/cc (lambda (k)
            .... (set! saved-k k) ...
            original-result))
 ...
 (call-in-continuation saved-k (lambda () new-result))

At the Chez Scheme level, a `call-in-continuation` in tail position
within a function can avoid forming a closure for its second argument.
The `call-in-continuation` function at the Racket CS level doesn't yet
provide that benefit.

The `call-in-continuation` operation is called `continuation-slice` in
Feeley's "A Better API for First-Class Continuations".
2020-03-13 09:46:12 -06:00
Matthew Flatt
9ef2124a38 speed up keyword expansion
Expansion of a procedure with keywords is quadratic due to generating
a nested sequence of `let`s, but speed it up by roughly a constant
factor by using a dintinct symbol for each nested layer.

Related to #3070
2020-03-13 09:46:12 -06:00
Matthew Flatt
f98d0a5cc1 cs: use call-in-continuation
Using `call-in-continuation` to apply a thunk within a continuation
slightly simplifies and speeds up parts of the implementation of
delimited continuations.
2020-03-13 09:46:12 -06: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
sorawee
3ddc1ca367
Fix typos (protect-syntax -> syntax-protect) (#3069) 2020-03-11 11:47:09 -04:00
Matthew Flatt
a105e47d35 Inside Racket docs: add advice on embedding files
Since embedding "petite.boot", "scheme.boot", and "racket.boot" can be
a good idea, add some advice to the documentation to show how that can
be done.
2020-03-08 18:05:59 -06:00
Matthew Flatt
601ffc9b36 avoid compiler warnings 2020-03-07 14:42:41 -07:00
Matthew Flatt
fab04633f3 makefile: add DISABLE_STATIC_LIBS 2020-03-07 14:24:50 -07:00
Matthew Flatt
0de88f203d struct: don't generate excessive struct-field-index code
The expansion of `struct` created far too much code to parameterize
`struct-field-index`, making expansion of a `struct` form with just
100 or 200 fields take a noticeably long time to expand.
2020-03-07 10:45:33 -07: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
Matthew Flatt
00b6803e36 cs: enable embedding in other applications
The "Inside: Racket C API" manual now has a CS part and a BC part.
2020-03-07 06:39:41 -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
Gustavo Massaccesi
d6d30d2fcc cs: sync with Chez Scheme change fix in cptypes 2020-03-07 08:07:30 -03:00
Matthew Flatt
e2c9544ed5 bc: fix hash-set key replacement for eq? values 2020-03-06 11:15:50 -07:00
sorawee
6685120c0a
Doc: more illustrative example for the filter-map function (#3066) 2020-03-05 21:46:15 -05: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