Commit Graph

40395 Commits

Author SHA1 Message Date
Matthew Flatt
67a7a5c869 cs: streamline continuation application slightly
Avoid some allocation and indirect calls, and add a shortcut for the
case where there are no winder changes, no mark changes, etc.
2019-10-10 17:01:52 -06:00
Paulo Matos
d49b182cf4 CI Build RacketCGC and Racket3m with -Werror 2019-10-10 13:18:34 +02:00
Matthew Flatt
067dda578b cs & io: fix log receiver synchronization
A misplaced `wrap-evt` could allow the result from `sync` on
a log receiver to be an opaque event, instead of a vector.

In other cases, a differently misplaced `wrap-evt` could also cause an
internal instance of `control-state-evt` to not be unregistered
correctly.

The solution to both problems is to add a wrapper procedure to
`control-state-evt`.

Closes #2664
2019-10-09 19:46:12 -06:00
Matthew Flatt
2ad4c6f508 cs: unbreak #:in-original-place? for foreign procedures 2019-10-09 19:43:42 -06:00
Matthew Flatt
f3aae7f4fb cs & thread: simplificaton for future "sync" action 2019-10-09 15:52:34 -06:00
Matthew Flatt
7cc3345761 cs & thread: fix place + futures termination
Repair problems with asynchronous callbacks for futures and for
foreign callbacks. Asynchronous callbacks are used for future "sync"
operations, like `hash-set!`, that run must in a place's main thread
(as of commit f574583907).

Separately, synchronization to clean up future threads used a `ping?`
flag in a backwards sense, and it also treated a record as a box.
These problems could cause place termination to hang.

Related to #2725
2019-10-09 13:54:50 -06:00
Matthew Flatt
8ad13a472f cs: implement #:in-original-place? #t for foreign calls
The `math` library relies on this working right, since MPFR is
normally not compiled as thread-safe.

Also, fix some locking/interrupt/atomicity problems with async
callbacks generally.
2019-10-09 13:54:02 -06:00
Matthew Flatt
f812fd9e67 cs: fix misuse of fx>= for _int64, etc. 2019-10-09 13:54:02 -06:00
Matthew Flatt
58e8421618 cs & thread: fix sync on place channel with no writer
When `sync` or `place-channel-get` is used on a place channel whose
other end has been GCed, then the blocking thread should also be
GCable. The `sync` case didn't work because the implementation uses
`replace-evt`. Change `sync` so that it can recognize asynchronous
`replace-evt`s in the same way as semaphores and channels (which is
more than traditional Racket offers).
2019-10-09 13:54:02 -06:00
Paulo Matos
8e6087878d Build racketcs from racketcgc
Like this racketcs pipeline can start sooner since it does not
have to wait for building racket3m
2019-10-09 20:57:34 +02:00
Sam Tobin-Hochstadt
c5affe1e96
Try to fix Slack notifications. 2019-10-09 10:24:20 -04:00
Paulo Matos
b81724c38d Fix use of markdown on Gitlab CI README 2019-10-09 14:52:35 +02:00
Paulo Matos
f6d7e6fa65 Docker image files with pre-installed Racket dependencies
This should speed up building and testing jobs in Gitlab CI for Linux.
2019-10-09 14:49:07 +02:00
Paulo Matos
f160661d45
Enable MZ_ASSERT on Linux (#2852)
Related to #2851
2019-10-09 08:06:48 +02:00
John Clements
877ed67b93 Post-release version for the v7.5 release 2019-10-08 21:16:33 -07:00
Matthew Flatt
1a2c48cbd6 cs & thread: fix place custodian unregister
When a place terminates, it was directly accessing its parent's
custodian. Prior support for cross-place uses of a hash table
probably helped hide this problem previously.
2019-10-08 21:59:15 -06:00
Matthew Flatt
aa4d65f3f2 cs: suppress a "too much serialization" test
At least for now. Chez Scheme can fasl some things that traditional
Racket would refuse. This seems like a problem, but it's not a new
one, and it's not immediately obvious how to fix it. One test started
failing because the representation of scopes changed just enough to
become faslable.
2019-10-08 08:52:27 -06:00
Matthew Flatt
dce39cf24b add note to a broken test
The test doesn't go wrong so often that its crucial to fix now,
but it should be fixd in the near future.
2019-10-08 08:52:26 -06:00
Matthew Flatt
84827d04aa expander: avoid race on multi-scope -> scope table
Although extremely unlikely, it was possible for multiple Racket
threads operating on the same scopes to race on a multi-scope's table
mapping phase levels to scopes.

Also, for some some mutable hash tables that will be shared across
places as read-only in Racket CS, make sure they are definitely set up
for iteration.
2019-10-08 08:52:26 -06:00
Paulo Matos
c996e09e06
Ensure errkind_str is not used uninitialized (#2851)
This removes a compiler warning about `errkind_str` being possibly uninitialized.
2019-10-08 14:11:43 +02:00
Paulo Matos
91e6ab238f Use pmatos/racket-ci:testdeps image for CI
This avoids the download and installation of all the test
dependencies per job, therefore accelerating all test runs.
2019-10-08 13:46:16 +02:00
Matthew Flatt
4ea09bf731 cs & thread: fix shared hash table
An `eq?`-based hash table in the implementation of custodians was
still shared across threads.

Also, taking the global lock at the Rumble level did not disable
interrupts. Since sometimes the lock is taken with interrupts
disabled, threads could potentially deadlock by not having an order.
Fix the problem by disabling interrupts before taking the lock.
2019-10-07 19:05:45 -06:00
Matthew Flatt
5f3ab00351 cify: fix procedure names
Extend the repair in e72f954e85 for cify.
2019-10-07 17:06:30 -06:00
Matthew Flatt
e72f954e85 cs: fix procedure names in startup code
Commit 7d725ab48b interferred with the way that procedure names are
recorded for the code that is built into the Racket executable.
2019-10-07 15:21:14 -06:00
Matthew Flatt
0c4fbda8ba cs: add evt-polling shortcut
For simple cases, avoid `dynamic-wind` and related work when polling
events.
2019-10-07 15:21:14 -06:00
Paulo Matos
ada70bbd68
Fix typo
s/continuaations/continuations/
2019-10-07 21:04:36 +02:00
Matthew Flatt
4c8168cc9d cs: use pseudo-random generator from Chez Scheme
Use the pseudo-random generator API that is now available from Chez
Scheme. While the generator can be written in Scheme, the lack of
unboxed floating-point arithmetic unfortunately makes it about 6 times
as slow as a built-in implementation. That difference is significant
when `sync` uses `random` for fair scheduling.
2019-10-07 11:37:51 -06:00
Paulo Matos
eda5f7a817
Do not run subprocess test unless cc or gcc exist (#2850)
Running this test in a linux docker without cc or gcc installed,
caused a failure.
2019-10-07 14:00:18 +02:00
Matthew Flatt
482fcd6d59 schemify: improve known-value detection
Recognize `(let () <expr>)` and `(begin <expr>)` when inspecting
expressions.
2019-10-06 17:49:32 -06:00
Matthew Flatt
ca285c384d cs: small further improvement to thread swapping
Instead of mutating a record, update virtual registers. Updating a
virtual register doesn't involve a write barrier.
2019-10-06 15:54:49 -06:00
Matthew Flatt
88e7e0a5e4 cs: fix time-apply process timing
The `time-apply` function was measuring thread time instead of proecss
time. While thread time would be more useful in many cases, it's meant
to report process time.
2019-10-06 11:19:27 -06:00
Sam Tobin-Hochstadt
4fb8e4a38d Avoid incorrect use of cadr. (#2848)
Fixes #2847.
2019-10-06 10:02:22 -07:00
Matthew Flatt
9bb5bc9352 expander: re-fix namespace-require/copy
The previous repair shifted by the wrong dimension.
2019-10-05 19:58:54 -06:00
Matthew Flatt
52f6098de8 expander: fix namespace-require/copy at phase > 0 2019-10-05 19:38:21 -06:00
Matthew Flatt
f574583907 cs: change mutable hash tables to be safe only for Racket threads
Mutable `eq?`- and `eqv?`-based hash tables were formerly guarded by a
lock that made them safe for Scheme threads (i.e., OS-level threads).
In particular, that futures could concurrently access hash tables. But
the cost of that lock appears to be too high for such a rarely-used
capability.

Switching `eq?`- and `eqv?`-based hash tables so that they're safe
only for Racket threads means that the lock on a hash table can be
much cheaper. A lock is still needed to because the Rumble layer adds
extra fields for iteration. In the specific case of `hash-ref` on
`eq?`-based tables, however, the lock can be ignored, which makes one
of the most common `hash-ref`s much faster.

Overall, `hash-ref` on a mutable `eq?`-based hash table is now 4-5
times as fast, which makes it about twice as fast as traditional
Racket's `hash-ref`. A `hash-set!` operation is about twice as fast as
before, which puts it on par with traditional Rackets `hash-set!`. The
`hash-ref` improvement makes `send` about twice as fast as before in
Racket CS, making it a little faster than traditional Racket.

Since futures can no longer concurrently access `eq?`- and
`eqv?`-based hash tables, they have to synchronize with the main
thread for access. Racket CS had avoided the "sync" action on futures
that traditional Racket sometimes uses, but this change introduces
sync actions to Racket CS, since it's appropriate for accessing
mutable `eq?`- and `eqv?`-based hash tables.
2019-10-05 16:16:36 -06:00
Matthew Flatt
f8bc4e8fa1 cs: compile FFI stubs in unsafe mode
Unsafe mode saves time compiling the stubs (which happens dynamically
for programs using `ffi/unsafe`) more than running them.
2019-10-05 07:10:23 -06:00
Matthew Flatt
d3d0bffb88 cs: further reduce allocation during thread swapping 2019-10-04 19:39:04 -06:00
Matthew Flatt
f9e12dc9bc fix doc typo 2019-10-04 19:39:04 -06:00
Matthew Flatt
e970a9f882 cs & threads: make thread swapping more direct
Adjust the internal engine protocol to avoid a jump from a starting
engine (representing a thread) to a scheduler outside of an engine
to a target engine (for a swapped-ni thread); instead, jump from the
first engine to the target, effectively running the scheduler within
the starting engine's context.
2019-10-04 05:53:53 -06:00
Matthew Flatt
f93f959506 cs: reduce thread-swap overhead
Reduce overhead by taking a shortcut for capturing a thread's
metacontinuation and by reducing closure allocations.
2019-10-03 18:23:21 -06:00
Matthew Flatt
20e0252664 consistently discard buffered bytes on failed flush
In a file-stream output port or TCP output port, when flushing
encounters an error, consistently discard bytes in the buffer. This
isn't the obviously right choice, but otherwise a future flush attempt
(including one triggered by trying to close the port or one triggered
by a plumber) will likely just fail again, which is probably worse
than dropping bytes.

Also, fix related problems/inconsistencies.

Overall changes:

 * For traditional Racket, discard bytes in a TCP port when flushing
   fails.

 * For Racket CS, discard bytes in file-stream and TCP output ports
   when flushing fails.

 * For traditional Racket, when a file-stream port flush is
   interrupted by an asynchronous break, *don't* discard buffered
   bytes.

 * For Racket CS, don't register TCP ports with the current plumber.
2019-10-03 13:54:17 -06:00
Matthew Flatt
db322a49ee improve error for misuse of non-serializable module
When the original compiler handler is called with a true second
argument, then the resulting module is not serializable. Improve
detecting and reporting of the misuse.

The error is phrase in terms of linklets, which is not ideal, but
that's the level where the error can be detected. Abusing the original
compile handler in this way is not easy, though, so maybe this
improvement is enough.
2019-10-02 18:18:52 -06:00
Stephen Chang
2643a75ce3 fold: fix err while erroring when 3rd (or greater) list arg isnt list 2019-10-02 07:03:02 -06:00
Ben Greenman
84340c6cca syntax: provide 'default-compiled-sub-path' and update docs
The docs talked about a 'get-default-compiled-sub-path'.

I changed them to use the name from the library.
2019-10-01 22:58:53 -04:00
Bogdan Popa
f7c85e1788 expander: improve error reporting of conflicts during require
Adds an additional line to the error message that is raised when a
required module provides a binding that is already provided by another
required module.  The additional line displays the name of the first
module that provides the binding.

The error before this change:

    tmp/c.rkt:4:9: module: identifier already required
      at: x
      in: "b.rkt"
      location...:
       tmp/c.rkt:4:9

and after:

    tmp/c.rkt:4:9: module: identifier already required
      at: x
      in: "b.rkt"
      also provided by: "a.rkt"
      location...:
       tmp/c.rkt:4:9
2019-10-01 18:04:09 -06:00
Sam Tobin-Hochstadt
8ff88b5e77 Rename COPYRIGHT.txt to LICENSE.txt 2019-10-01 17:33:06 -04:00
Sam Tobin-Hochstadt
b44955cade
Specify that inbound contributions are licensed under MIT/Apache/LGPL. (#2839)
Add text of MIT and Apache v2 licenses.
Add initial CONTRIBUTING.md file which specifies contribution license.
Add COPYRIGHT.txt file which specifies the license and lists some
external components.

The LGPL license stays in its current location to avoid having to
modify the build right now.
2019-10-01 10:05:32 -04:00
Matthew Flatt
c3d23ccf18 docs: remove unneeded space
Very minor: The space made sense previously to make things line up,
but it's not helpful anymore.
2019-09-30 18:15:08 -06:00
Matthew Flatt
27c1847ce8 xform: accomodate unusual #pragma placement
The Mac OS 10.15 headers include a `#pragma` just before the closing
`;` of a `struct` declaration. That confuses poor xform. Handle this
special case by  detecting it and swapping the order of the `#pragma`
and `;`.
2019-09-30 18:12:30 -06:00
Paulo Matos
fa1c2219ab Implement workaround to empty needs keyword
Due to https://gitlab.com/gitlab-org/gitlab/issues/30631 an empty
needs keyword is ignored. This worksaround that limitation.

Once this bug is fixed, we can revert this change.
2019-09-30 17:37:40 +02:00