Commit Graph

40330 Commits

Author SHA1 Message Date
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
Paulo Matos
2ef7c550e5 Speedup build with custom docker image and dag layout
Recently GitLab added the needs keyword which allows implementing dag
layouts for pipelines. CI also spends a lot of time building
dependencies. A custom image currently hosted in
https://github.com/pmatos/racket-ci contains the dependencies to build
racket properly.

Enabling both features that cuts CI time by 60%.

Note that we use an empty needs keyword to mean that a job depends on
nothing but it is currently ignored pending a fix for
https://gitlab.com/gitlab-org/gitlab/issues/30631
2019-09-30 16:36:04 +02:00
Ben Greenman
487d3bfd7d
doc: fix regexp-try-match range contract
closes #2816
2019-09-28 23:22:46 -04:00
Matthew Flatt
a20a27f5b0 cs & thread: repair for sync/timeout
If a `sync/timeout` on a semaphore (or simiilar asynchronous event)
succeeds simultaneously with the timeout, the success could get lost.
2019-09-28 11:40:01 -06:00
Matthew Flatt
11c6f1686c reference: describe ordering guarantees for futures & places 2019-09-27 10:46:21 -06:00
Matthew Flatt
10b110adc1 reference: improve description of thread-based concurrency
Related to #2834
2019-09-27 09:18:18 -06:00
Matthew Flatt
a07e973316 raco setup: accomodate unusual flie names in pkg-dep checking
If a source file name lacks an extension, then the pkg-step would get
confused trying to convert a ".zo" name back to a source name. The
original name is not really needed, anyway.
2019-09-27 06:55:44 -06:00
Thomas Dickerson
429436fb77 Fix headers so they don't break compilation with modern C++
Add space between string literals

Necessary so that modern C++ compilers don't misinterpret `SPLS_LINUX` as a user-defined literal type.
2019-09-27 06:55:35 -06:00
Matthew Flatt
cb9cfe9c83 make-rename-tranformer: history note
Record the correction made by c8652e063a.
2019-09-26 15:57:04 -06:00
Alexis King
c8652e063a Add macro-introduction scopes when expanding rename transformers
This can’t affect scoping, but it can affect `syntax-original?`, which
is important for Check Syntax.
2019-09-26 15:55:05 -06:00
Matthew Flatt
c651cedc1f expander: don't turn local reference into syntax-original?
When a reference to a local variable is updated with the scopes of its
binding in a fully expanded program, remove the syntax-original
property if the original reference had macro-intrudction scopes.

Closes #2820
2019-09-26 14:53:32 -06:00
Matthew Flatt
01de71981b unsafe-poller: remove overly-conservative false positives
Trying to be more helpful about the thread running an `unsafe-poller`
callback gets in the way of making the process sleep when multiple
threads are blocked on unsafe pollers.

Closes #2833
2019-09-25 09:17:52 -06:00
Matthew Flatt
0873b21d6d configure: fix --enable-sdk9 flag help 2019-09-25 07:42:49 -06:00
Matthew Flatt
4e2fef3557 rename ".scm" files not meant to be compiled 2019-09-25 07:42:49 -06:00
Paulo Matos
3a46e41cde
Disable test many-vectors-in-reasonable-space? for cgc (#2832)
This is currently failing in cgc:
     https://gitlab.com/racket/racket/-/jobs/303266624
2019-09-25 14:47:46 +02:00
Matthew Flatt
6d7ae5e1d2 racket-benchmarks: some microbenchmarks for continuations. etc. 2019-09-25 06:45:36 -06:00