Commit Graph

40313 Commits

Author SHA1 Message Date
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
Matthew Flatt
b1a6baffc6 configure: add --enable-sdk9 2019-09-25 06:45:36 -06:00
Sam Tobin-Hochstadt
920d3ce51e Check that => is followed by an identifier in match clauses.
Closes #2830.
2019-09-24 15:45:19 -04:00
Matthew Flatt
00969092c8 avoid C compiler warniing when not MZ_PRECISE_RETURN_SPEC
Follow-up to 3a512a2a60, where we need a `return` statement
back to avoid a wanring from some compilers.
2019-09-22 17:51:10 -06:00
Matthew Flatt
5fea629cea cs: tune parameterization lookup 2019-09-22 16:10:03 -06:00
Matthew Flatt
e147a96843 simpler current-parameterization
An `extend-parameterization` call with no extra arguments used to
adjust a parameterization, but it has no effect anymore, so drop it.
2019-09-22 13:46:17 -06:00
Matthew Flatt
97c552e87b cs: tune thread-cell implementation
Speed up thread-cell access and make update safe for futures.
2019-09-22 11:08:46 -06:00
Matthew Flatt
b5e145c755 cs: tune continuation-mark lookup 2019-09-21 10:08:03 -06:00
Matthew Flatt
c0c628e721 cs: fix inline of call-with-immediate-continuation-mark 2019-09-21 07:14:18 -06:00
Matthew Flatt
b7dc3f4bda schemify: repair with-continuation-mark optimizations
Repairs a bug in 7d725ab48b.
2019-09-20 16:48:52 -06:00
Matthew Flatt
7d725ab48b schemify: optimize with-continuation-marks
Prune some `with-continuation-marks` forms that aren't observable
(because the body is simple enough that it won't inspect marks). More
significantly, specialize `with-continuation-marks` forms to indicate
when the current frame is known to have no marks and to indicate
when tthe key expression is known to produce a non-impersonator.
2019-09-20 11:20:23 -06:00
Sam Tobin-Hochstadt
7ae4943a57 Adjust .mailmap.
Closes #2824.
2019-09-20 12:57:42 -04:00
Matthew Flatt
5be9ee424c cs: use #3%$app for #%app
Since `#%app` (used where an applicable structure might show up)
injects its own `procedure?` test and makes sure that that a procedure
is returned to the function position of the application, use `#3%$app`
to make Chez Scheme suppress a redundant `procedure?` check for the
appliction.
2019-09-19 07:29:16 -06:00
Matthew Flatt
d02fbebba8 schemify: improve handling for mutated, known-initialized variables
Avoid unnecessary checks for an "undefined" state.
2019-09-19 07:29:16 -06:00
Paulo Matos
f0a0ffc50d
Add support for MSVC2019 (#2827) 2019-09-19 15:27:12 +02:00
Matthew Flatt
2b567b4488 cs & thread: avoid counting a descheduled thread as "no progress"
It's not clear that a thread can be descheduled without the current
thread's work counting as progress, but a descheduled thread certainly
shouldn't coun as a no-progress scheduled thread.
2019-09-18 14:03:20 -06:00
Matthew Flatt
19efcb955d cs & io: avoid spinning if epoll/kqueue setup fails 2019-09-18 14:03:20 -06:00
Matthew Flatt
ec72f5df45 cs & thread: avoid accumulating post-atomic callbacks
Only one instance of each callback is needed. Allowing them to pile up
is inefficient, and possibly it can trigger a reaction that causes
even more to pile up.
2019-09-18 14:03:20 -06:00