Commit Graph

5118 Commits

Author SHA1 Message Date
Alex Muscar
966399dec6 Fix gen:dict methods for alists with duplicate keys (#2846)
* Fix gen:dict methods for alists with duplicate keys

This fixes https://github.com/racket/racket/issues/2803.

Note that while this works, the implementation is not particlarly fast.
Especially for iterators.

* Fix tabs

* Make code more efficient

* Fix function definition order

* Import set library

* Preserve order

* Use immutable hash sets

* Remove unused import and remove duplicate checks

* Fix syntax error
2019-10-30 11:04:40 -04:00
Matthew Flatt
c5a7d0e38a finish udp-ttl and udp-set-ttl!
Add tests, documentation, and fixes for rktio and Racket CS.
2019-10-29 18:34:03 -06:00
David K. Storrs
24ec75fd03 added udp-ttl and udp-set-ttl! 2019-10-29 15:35:58 -04:00
Matthew Flatt
c34538c58f cs & thread: fix sync shortcut and handle-evt
A shortcut meant to speed up `sync` on values such as semaphores
caused `handle-evt` handlers to sometimes not run in tail position.
2019-10-28 19:05:31 -06:00
Matthew Flatt
a81f9c1c6d /: repair for complex inexact
For a division c+di, when c is less than d, and when (/ d c) produces
infinity, then the sign on the imaginary part of the result was
backwards. For example, `(/ -1.0e-9-1.0e+300i)` produced `-0.0-0.0i`
instead of `-0.0+0.0i`.
2019-10-28 14:02:27 -06:00
Fred Fu
1439fc0e85 fix a typo in comments (#2876) 2019-10-28 10:25:09 -04:00
Sam Tobin-Hochstadt
44895a0027
Relicense this repository under Apache 2.0/MIT. (#2871)
Note: the traditional Racket executable continues to incorporate
LGPLv3 code and thus modifications to it must be released under
that license. However, all Racket code in this repository, as well
as the Racket-on-Chez excutable, are more permissively licensed.

Thanks in particular to @otherjoel and @zyrolasting for their work
on this project.
2019-10-28 09:17:56 -04:00
Dan Holtby
42c897a75f fix for (setup) when (current-library-collection-links) contains hash tables 2019-10-28 06:06:59 -06:00
Matthew Flatt
238cd527f4 revert accidental change to setup/main 2019-10-27 13:49:29 -06:00
Matthew Flatt
0965e5ad6c cs: fix internal procedure-arity-includes/c macro
Repair to 5345fd294c.
2019-10-27 10:38:45 -06:00
Matthew Flatt
bee4a92251 cs-bootstrap: updates to work with recent Chez Scheme changes 2019-10-27 10:38:45 -06:00
Matthew Flatt
f26181dd84 racket/date: add correctly spelled scaliger functions 2019-10-24 15:00:16 -04:00
Matthew Flatt
b1cae06897 openssl: use OPENSSL_sk_num when no sk_num, etc.
OpenSSL 1.1 adds `OPENSSL_` to the front of some names.
2019-10-24 15:00:16 -04:00
Sam Tobin-Hochstadt
2f8207e7c9 Revert "scalinger -> scaliger"
This reverts commit de0fbf2648.
2019-10-24 14:58:59 -04:00
Sam Tobin-Hochstadt
8f579af413 Revert "Handle symbol changes between openssl-1.0 and 1.1"
This reverts commit 822938d9ae.
2019-10-24 14:58:59 -04:00
Matthew Flatt
fb38db3b84 cs: more direct application of continuations 2019-10-24 07:33:24 -06:00
Matthew Flatt
5345fd294c cs: faster internal procedure-arity-includes/c 2019-10-24 06:25:20 -06:00
Matthew Flatt
487277ad02 cs & thread: fix use of custodian weak reference
Commit 77023aeaba made the reference from a custodian-managed
value to the custodian weak, and that could cause a crash in
certain shutdown cases.

Relevant to #2867
2019-10-23 17:32:57 -06:00
Matthew Flatt
79c27ece6f cs: use improved Chez Scheme call/cc
Just bumping the version number here to make sure the improved
`call/cc` is used. The improvement saves about 10% on ctak by avoiding
a layer of closure allocation.
2019-10-23 17:32:57 -06:00
Matthew Flatt
5bce9e822f cs: improve composable continuation
Refactor to move some composable-continuation support out of the
way of prompts, and add a shortcut for simple composition cases.

Also, fix stack traces with continuation barriers and composable
composition, which could show sections of a trace duplicated.
2019-10-23 17:32:57 -06:00
Matthew Flatt
7f5f289ff6 cs: improve notes on Racket CS developement
Explain how to build Chez Scheme bootfiles using Racket, and fix
information on concurrency that had become out-of-date.
2019-10-19 17:02:01 -06:00
Matthew Flatt
77023aeaba fix custodian weak reference and memory-limit unregistration
For Racket CS, weaken references from managed objects to managing
custodians. Otherwise, a custodian with any managed values cannot
be GCed. Also, fix `collect-garbage` call that is triggered by
a memory-limit shutdown to happen after the current thread
(likely shutdown) is swapped out.

For traditional Racket, fix custodian shutdown on a memory-limited
custodian so that it is unregistered as having a limit.
2019-10-18 22:31:35 -06:00
Matthew Flatt
3c2efafbf5 cs: fix printf and handler interaction
Fixes inconsistency in the uses of handlers compared to traditional
Racket, and repairs a crash for displaying byte strings via `~a`.
2019-10-18 18:57:46 -06:00
Matthew Flatt
588778d14c cs: fix compile for non-serializable literals
Lift and delay serialization for non-serializable literals when
using `compile`. Just `compile`ing such an expression is ok, but
it reports an error if there's an attempt to serialize (by printing)
the compiled value.

This improvment also brings Racket CS much more in line with
traditional Racket on the kinds of values that it is willing to
serialize. For example, non-prefab structures no longer serialize
(where deserializing in a new Racket run would produce an instance of
a distinct structure type). The exception type and error message also
now matches traditional Racket.

The improvement relies on a new argument to `s-exp->fasl` for handling
errors.
2019-10-18 18:36:52 -06:00
Matthew Flatt
772289e2c1 force a major GC after memory-limit custodian shutdown
Also, adjust a memory-limit test that wasn't checking behavior as
intended and that wasn't consistent with a Racket CS improvement over
traditional Racket.
2019-10-18 06:57:44 -06:00
Matthew Flatt
a0aeadca0a schemify: fix name associated to on-demand procedure
Fix the procedure name that is used before an on-demand procedure is
extracted.
2019-10-16 15:50:16 -06:00
Luke Lau
a3d2939dae Fix libcrypto native-lib install on macOS 10.15
Catalina now aborts when dlopen'ing the versionless libcrypto/libssl
dylibs.
This removes the versionless libs on macOS from the list of versions
2019-10-16 13:55:35 -06:00
Matthew Flatt
01ed8e4662 cs & ffi/unsafe: change base type of (_bytes o <n>) to _pointer
A base type of `_gcpointer` works ok for traditional Racket as a kind
of "maybe it's GCable, so treat it that way just in case". That
approach doesn't work for Racket CS, where `_gpointer` has to mean
"definitely GCable memory". Although the difference is unfortunate,
making Racket CS base `(_bytes o <n>)` on `_pointer` is consistent
with the way plain `_bytes` is like `_pointer` in Racket CS and like
`_gcpointer` in traditional Racket.
2019-10-16 13:52:21 -06:00
Matthew Flatt
e0b51e2709 expander: repair top-level compilation to machine-independent 2019-10-16 07:18:17 -06:00
Matthew Flatt
ecf905469a normalize license file names can centralize as much as possible 2019-10-16 05:34:09 -06:00
Matthew Flatt
972788c137 replace "INSTALL.txt" with rendered Build Guide 2019-10-15 19:05:36 -06:00
Matthew Flatt
6aa96ad3f7 csm thread, io: avoid termination problem
Especially avoid problems with `custodian-shutdown-all` on the main
custodian in the main thread.
2019-10-14 18:38:19 -06:00
Matthew Flatt
6e0c5e60f3 expander: fix extract dependency checking
Don't convert the recorded version number to a path.
2019-10-14 16:43:04 -06:00
Matthew Flatt
978d60e4a7 windows: adjust flush handling of file-stream output ports
Some synchronization built into `close-output-port` seems unnecessary
on modern Windows (NT and up). An extra manager thread is needed for a
anonymous pipe for "write ready?" purposes, but not to buffer output.
The Windows documentation is not entirely clear on this point, but
experiments suggest that modern anonymous pipes behave in the obvious
way.

Meanwhile, adjust the io layer used by Racket CS with the
synchronization that would be needed for Windows 95. This adjustment
is questionable, because it doesn't seem likely that we'll ever go
back that far with Racket CS. But the rktio interface to support
flushing synchronization might somehow be needed in a future setting,
or mabe it will turn out that I'm wrong about pipe buffers.
2019-10-14 16:12:06 -06:00
Matthew Flatt
c19b944110 racket/port: fix evt constructors to work right with read errors
Propoagate read errors to the `sync` that is applied to an event,
instead of writing the events to stdout.

Related to racket/web-server#76
2019-10-14 11:52:50 -06:00
Matthew Flatt
89403dc8cd fix file-stream read/write on concurrent close
Includes repairs for both Racket CS and traditional Racket.
2019-10-14 10:53:33 -06:00
Matthew Flatt
2799713ea5 cs & io: fix pipe read/write on concurrent close 2019-10-14 10:53:33 -06:00
Ryan Culpepper
ca2eafbfc4 syntax/parse: fix ~between; closes #2856
Please merge to release branch.
2019-10-14 04:09:22 +02:00
Matthew Flatt
edfcec8211 cs: repair call-with-immediate-continuation-mark
The default-value expression could get lost, replaced with just #f.
2019-10-13 09:38:02 -06:00
Matthew Flatt
cd596e5277 cs: fix error reporting for apply on a non-list 2019-10-12 16:20:16 -06:00
Matthew Flatt
2d3b426d05 cs: rewrite more error messages
Closes #2801
2019-10-12 16:10:42 -06:00
Matthew Flatt
a85a915f88 cs: fix value formatting in car, etc., exceptions 2019-10-12 15:33:55 -06:00
Matthew Flatt
77cdfde679 cs: fix inlining of unsafe vector and box operations
Before this repair, `unsafe-vector-ref` was slower than `vector-ref`.
2019-10-12 13:39:36 -06:00
Matthew Flatt
61e39657fa cs & io: fix caching of locale converters
Fix an interaction with custodians and byte converters that are
used by `string-locale<?`, `string->bytes/locale`, etc.
2019-10-10 17:01:52 -06:00
Matthew Flatt
2338d98761 cs: fix some io demos 2019-10-10 17:01:52 -06:00
Matthew Flatt
9ce8713cdc cs: significantly improve continuation capture and application
Avoid a continuation frame and layer of thunks that was in place for
checking for breaks just after applying a continuation. Instead, we
install just the continuation marks and check for breaks before
actually jumping; the break checker can't tell the difference, since
marks are the only way for it to check the continuation. This
improvement cust about 40% of the time for simple continuation capture
and application.
2019-10-10 17:01:52 -06:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Ryan Culpepper
b86ca89102 fix error message 2019-09-18 11:29:54 +02:00
Ryan Culpepper
375a4837c7 format-id: add #:subs? option for sub-range-binders
inspired by #2624 by @lexi-lambda
2019-09-18 11:29:54 +02:00
Gustavo Massaccesi
3907f35d1d fix error of malformed in-values in a for clause
(for ([x (in-value 1 2)]) x)

should raises a run time error, not a syntax error.

Fix similar error in other in-something macros.

Fix name of in-directory, when used as a function outside a for.
2019-09-17 11:52:41 -03:00
Paulo Matos
3a512a2a60
Enable MZ_NORETURN annotation only if MZ_PRECISE_RETURN_SPEC is defined (#2823)
Unfortunately, MZ_NORETURN spec is causing a few problems - see #2808
It would be great to fix these but due to lack of time, this is a
workaround that should keep things working until all supported
configurations accept MZ_NORETURN properly.
2019-09-17 08:36:04 +02:00
Matthew Flatt
4e07c20afe cs: improve Chez Scheme version check
Use the new `scheme-fork-version-number` function to make sure
the build uses the latest.
2019-09-13 07:32:07 -06:00
Ben Greenman
a5448f112d for/stream: delay finding first element
Fixes #2812
2019-09-12 14:18:16 -05:00
Matthew Flatt
72852c7b75 cs: use call-consuming-continuation-attachment
Use `call-consuming-continuation-attachment` to implement
`with-continuation-marks`, because that avoids duplicating
a set of checks when in tail position.
2019-09-11 17:21:25 -06:00
Matthew Flatt
5bcf7eb19d cs: fix optiimizer arity for make-parameter
Should have been part of 91d702c6fe.
2019-09-08 17:58:34 -06:00
Matthew Flatt
2403b18e0f cs: more constant tokens
Should have been part of 12a2cd75a8.
2019-09-08 17:57:10 -06:00
Alexis King
415f030212 Fix syntax-local-value[/immediate] rename transformer context
fixes #2815
2019-09-08 14:56:43 -05:00
Matthew Flatt
866c5d41e0 cs: unbreak Windows build 2019-09-08 07:24:49 -06:00
Matthew Flatt
f4fa74e6f2 expander: fix reader bug
Fix incorrect comparison of character to EOF. There's a test, already,
but the test fails only if the expander is compiled in safe mode.
2019-09-06 17:35:54 -06:00
Matthew Flatt
4c630a2442 sync bootstrapped expander
Update expander embedded in traditional Racket to pick up
the parameter names added in 5147771b04.
2019-09-06 17:35:54 -06:00
Matthew Flatt
3024b77ba5 add custodian-based unloading of foreign libraries
Specificially, add a `#:custodian` argument to `ffi-lib`.
2019-09-06 17:35:54 -06:00
Matthew Flatt
276a102d6a add ffi-lib-unload at the #%foreign level 2019-09-06 17:35:54 -06:00
Sam Tobin-Hochstadt
5147771b04 Name more internally-defined parameters and std library parameters. 2019-09-06 11:54:22 -04:00
Paulo Matos
a5abfa9a0d
Fix typo 2019-09-06 08:35:28 +02:00
Matthew Flatt
8bb41e590d cs: yet another try at the major-GC heuristic
Looking at `bytes-allocated` usually works, but sometimes lets
memory use spiral out of control. Looking at `current-memory-bytes`
is more reliable, but still makes peak memoy use too high.
Combining those values doesn't limit the peak well enough.
Try the more obvious (in retrospect) approach of comparing
`bytes-allocated` changes and `current-memory-bytes` changes
separately, and triggering a GC if either grows enough.
2019-09-05 20:14:31 -06:00
Matthew Flatt
12a2cd75a8 cs: constant tokens
Instead of allocating tokens like `undefined` or `parameter-key`
with `gensym` on startup, allocate them once for all eternity.
2019-09-05 11:13:41 -06:00
Matthew Flatt
8284dfa1b1 cs: add names for primitive parameters 2019-09-05 08:22:49 -06:00
Matthew Flatt
1f2342b57a cs: adjust trigger major GC
Commit 1811193285 caused Racket CS to have much higher peak memory
use. Adjust the heuristic again to trigger a major GC when the
`current-memory-bytes` value is the post-GC `bytes-allocated` plus the
post-GC `current-memory-bytes`, which means waiting until
another `bytes-allocated` bytes are allocated (instead of waiting
until the number of newly allocated bytes also catches up to overhead,
such as unserused pages due to locked objects).
2019-09-05 08:22:49 -06:00
Matthew Flatt
91d702c6fe add name argument to make-parameter 2019-09-05 08:22:49 -06:00
Matthew Flatt
cccaf4e46e cs: change representation of parameters
Implement a parameter as a Chez Scheme wrapper procedure,
instead of an applicable record. A wrapper procedure can be
applied more directly, saving 10-20% of the time for some
parameter lookups.
2019-09-05 08:22:49 -06:00
Paulo Matos
8c049d914e
Remove definitions for __LITTLE_ENDIAN, __BIG_ENDIAN, and __BYTE_ORDER (#2807)
These are already defined in /usr/include/endian.h for all tested configurations
Related to #2797
2019-09-04 19:32:02 +02:00
Matthew Flatt
36e00806de io: fix call to raise-arguments-error 2019-09-03 18:47:44 -06:00
Jon Zeppieri
b0d753e2d6 Implements negated unicode categories in pregexps
The grammar for pregexps includes:

   | \p{‹property›} Match (UTF-8 encoded) in ‹property›
   | \P{‹property›} Match (UTF-8 encoded) not in ‹property›

and <property> is defined as:

   ‹property› ::= ‹category› Includes all characters in ‹category›
               |  ^‹category› Includes all characters not in ‹category›

That is to say, there are two independent ways to negate one of
these character classes. The Racket implementation of regexps
(as opposed to the C implementation) does not recognize negated
categories. This PR fixes that.
2019-09-03 18:47:33 -06:00
Matthew Flatt
9fa6e9e25d repair GC problem with 'atomic-interior / 'interior
Some parts of the GC meant to traverse all objects on a page of
'atomic-interior or 'interior objects used "<" to detect the end of
the page, but "<=" was needed. As a result, things could sometimes go
wrong for the last object on a page for platform and size combinations
where the last object ends exactly at the end of the page.

This change consistenly computes the iteration end in a way that makes
both "<" and "<=" work.

Using MPFR bindings from the `math` library could trigger a problem
(but it's difficult to provoke the problem in a reasonably small
example --- difficult enough that I couldn't do it).
2019-08-30 12:25:32 -06:00
Matthew Flatt
1811193285 cs: correct and imprrove heuristics for force a major GC
Use `current-memory-bytes` instead of `bytes-allocated` to determine
major GCs, because the latter doesn't include enough (perhaps missing
finalized values). For example, the repair avoids unbounded memory use
from

  (let loop ([i 0])
    (malloc 6400 'atomic-interior)
    (loop))

due to finalizers that pile up faster than they are run.
2019-08-30 06:32:17 -06:00
Matthew Flatt
dd5e517e88 cs: fix random-seed to be compatible with Racket
Fix `random-seed` to set the pseudo-random generator's
state to the same state as traditional Racket.
2019-08-29 19:14:39 -06:00
Matthew Flatt
afef3fe900 remove unused C function declaration 2019-08-28 15:51:51 -06:00
Matthew Flatt
fd63d5a1ba cs: rewrite error message for car, cadr, etc.
Closes #2798
2019-08-28 05:56:47 -06:00
Gustavo Massaccesi
800ea98525 use KMP to avoid quadratic time in string-contains? 2019-08-27 09:59:51 -03:00
Matthew Flatt
a8d5a4f2f4 avoid unneed preprocessor redefinition
Limit a Mac-specific declaration that isn't needed anyway.

Related to #2797
2019-08-27 06:01:16 -06:00
Matthew Flatt
9f424cfe0a cs: fix procedure names in jitified linlet to use 'inferred-name
When a linklet is too large to pass to Chez Scheme whole, then
names for the procedures that are individually compiled need to
be extracted from 'inferred-name for reference in the wrapper.

Closes #2787
2019-08-22 21:06:53 -06:00
Matthew Flatt
2a5df8ad2a rktio: fix Windows network error reporting
Convert wide-character error message to UTF-8.

Closes #2794
2019-08-22 17:15:20 -06:00
Matthew Flatt
d14a4f75a1 read: refine message for some ill-formed #lang lines
In particular, improve the message when `#lang` is followed
by two space characters.
2019-08-22 15:40:59 -06:00
Nick Thompson
8d2b0ba363 Add native dark mode to macOS apps
Enables native dark mode UI elements in macOS 10.14 and above. Adds the
'NSRequiresAquaSystemAppearance' key with a value of 'false' to the
Info.plist file, while allows UI elements to match the system theme even
when not building against the latest SDK.
2019-08-22 14:37:33 -06:00
Matthew Flatt
2d0f10f473 rktio: better behavior for opening write and of fifo
When opening the write end of a fifo that doesn't have a reader
already, the old implementation could allow writing bytes that are
discarded. This new implementation uses a blocking `open` in a
`pthread`, and that way the write routines know whether the stream is
ready for writing or not.

The difference is visible in the Racket API in a two places:
`subprocess` needs to wait until a fifo writer is connected before
attempting to dup the corresponding file descriotor, and more
generally a use of `unsafe-port->file-descriptor` needs to wait. The
former blocking operation is now build into `subprocess` (and
documented), but the burden is place on callers of
`unsafe-port->file-descriptor` to wait is necessary.

The new `port-waiting-peer?` predicate exposes the waiting state,
while `sync` is sufficient to wait for a peer.

Closes #2784
2019-08-22 05:14:58 -06:00
Matthew Flatt
264ec72790 cache bytes converter used for locale conversions
On platforms other than Windows and MacOS, locale encoding (inclduing
path <-> string conversion) opened a converter for each separate
operation. That can be slow on some OSes, so cache converters used for
locale conversions.

Relevant to #2781
2019-08-16 12:10:28 +02:00
Matthew Flatt
001abc5b55 ffi/unsafe/alloc: allow #f as an "allocator"
Allowing #f as an allocator avoids problems composing `allocator` with
foreign-function lookup where failure is anticipated and implemented
as #f. For example, `g_settings_new` in the "gui-lib" package's
"mred/private/wx/gtk/gsettings.rkt" can be #f if the libgio libray is
too old, in which case there won't be an attempt to use
`g_settings_new`.
2019-08-15 09:42:10 +02:00
Paulo Matos
6c17f38f27
Add make rule for gmp_arch_gcc sources to gc2 Makefile.in (#2782)
This avoid a split build (first build cgc and then 3m based on cgc)
failing on arm/alpha.
2019-08-06 18:14:15 +02:00
Gustavo Massaccesi
ecaff3dc96 cs: fix display and print when print-vector-length is enabled
Don't use print-vector-length in `display`.

Use print-vector-length in `print` for fxvectors and flvectors.
2019-08-05 13:09:45 -03:00
Gustavo Massaccesi
63173a32be fix pretty-write when print-vector-length is enabled
Show "#3(struct:b 1)" instead of "#(struct:b 1 1)", so it behaves like `write`.
2019-08-05 13:09:45 -03:00
Gustavo Massaccesi
964e998d70 fix pretty-print when print-vector-length is enabled
In some cases, (vector x 2 3 3 3) was pretty-printed as "(vector x 2 3)" when
print-vector-length was enabled.

Also print "(fxvector)" instead of "(fxvector )".
2019-08-05 13:01:42 -03:00
Chuan Wei Foo
68621c3ee1 Add vector-empty? (#2695)
* Add vector-empty?

* Add tests for vector-empty?
2019-08-03 15:51:33 +02:00
Paulo Matos
f6b14a7bc1
Add -D to pkg install as an alternative to --no-docs (#2777)
raco setup already provides --no-docs and -D so we should too.
Followup to #2776
2019-08-03 15:49:31 +02:00
Paulo Matos
fc76f59457
Add --no-docs command line to raco pkg install (#2776)
This simply passes the same flag to setup, which already knows how to
run setup without rendering the documentation.
2019-08-01 21:12:10 +02:00
Matthew Flatt
2819d73d7f cs: make collect-garbage always return (void) 2019-08-01 07:26:37 -06:00
Matthew Flatt
a5f70561d2 expander: fix module-path resolution in module->namespace namespace
This repair affects DrRacket and xrepl after `enter` so that a
`require` in the context of a module namespace is resolved relative to
the module's path (as it did in the old expander, before v7.0).

Closes racket/drracket#276
2019-07-31 13:52:17 -06:00
Jon Zeppieri
f797694931 Ensure interned_key is initialized 2019-07-31 10:35:21 -06:00
Matthew Flatt
754109fa31 JIT: fix useless test for N-ary unsafe-fx+, etc.
Running tests on 32-bit ARM exposed the problem.

Relevant to #2773
2019-07-30 16:04:29 -06:00
Matthew Flatt
17bc626293 fix bignum quotient on 32-bit ARM
The assembly implementation of `gmpn_invert_limb` is needed to
correctly implement bignum division within the embedded slice of GMP.

Relevant to #2773
2019-07-29 18:39:48 -06:00
Matthew Flatt
af163a533d integer-bytes->integer: repair for unsigned char
Fix `integer-bytes->integer` for the single-byte case when the C
compiler is configured to treat `char` as an unsigned type.

Relevant to #2773
2019-07-29 13:51:10 -06:00
James Bornholt
93dca626f0 repairs for syntax/template on Racket CS
Fix the default argument in `syntax/template`, where cons-proc-stx should be a
syntax object reflecting a procedure, not a procedure itself.

Fix test case for `syntax/template`, where restore-stx should be a syntax object
reflecting the restore procedure, not the proceure itself.

Closes #2745
2019-07-29 06:16:12 -06:00
Jon Zeppieri
0632ac616e Fixes bug in intmap equality
Collision nodes were previously only testing for the equality
of keys and ignoring values.
2019-07-28 18:38:58 -06:00
Jon Zeppieri
4ba070766e Replace uses of hashtable-cell with hashtable-ref-cell in rumble
The hash-demo's "mutable destructive for-each" test, which
uses hash-remove! is slightly faster after this change.
2019-07-28 17:36:48 -06:00
Matthew Flatt
cf0717b855 adjust build to update "raco.exe" when needed 2019-07-27 09:54:22 -06:00
Matthew Flatt
7d6e2fc89b cs: fix launcher hack for cross build
Disable optimizations that would avoid inspecting literal string data
that is modified in the run-time executable.
2019-07-27 08:46:41 -06:00
Matthew Flatt
49929ce8d3 cs: fix incremental cross-compile of Chez Scheme 2019-07-27 08:46:41 -06:00
Matthew Flatt
d48b4498cc cs: strip launchers in Windows cross build 2019-07-27 08:46:41 -06:00
Matthew Flatt
01af30a517 cs: repair recompile of Chez Scheme in Windows build 2019-07-26 16:55:14 -06:00
Matthew Flatt
2a1ffbbdf1 bump version to sync with Chez Scheme change 2019-07-26 16:22:37 -06:00
Stephen Chang
e22abfb8a4 reduce code generated by in-X-set sequence constructors 2019-07-26 13:32:04 -04:00
Stephen Chang
69d748a95e fix seg fault when using in-X-set sequence constructor with wrong kind of set; closes #2765 2019-07-26 12:59:20 -04:00
Matthew Flatt
572b29b874 rktio: fix leak and bad free in subprocess
Closes #2764
2019-07-26 08:37:39 -06:00
Philip McGrath
fce209d9f4 racket/private/serialize: eliminate unnecessary vector->list 2019-07-25 13:27:36 -06:00
Jon Zeppieri
0ebc43ef24 Adds hash-ref-key primitive
For now, the operation is implemented on mutable tables in Chez
using a combination of hashtable-contains? and hashtable-cell.
A more efficient version will require modifying Chez.
2019-07-25 07:43:13 -06:00
Matthew Flatt
57f64367ed cs: implement make-known-char-range-list
Compute the list (at compile time), instead of using a literal copy of
the output at one point.

Also, adjust the documentation to explain extra guarantees provided by
`make-known-char-range-list`.

Closes #2757
2019-07-24 07:33:28 -06:00
Matthew Flatt
f63ededab8 cs: fix copied environment setup from cross-compilation
The copy of the environment setup for cross-compilation was
out of sync with the main environment configuration.
2019-07-23 19:21:46 -06:00
Matthew Flatt
8b916fc5c1 expander & cs: sync lists of internal primitives
The expander and the rumble layer of Racket CS need to agree on a set
of extra primitives that are referenced by schemified linklets.
2019-07-23 17:49:45 -06:00
Matthew Flatt
c1bc49e45b update racket HISTORY.txt for v7.4 2019-07-23 13:01:31 -06:00
Matthew Flatt
05c82d877c rktio: fix problem with lazy ltps
Don't try to wait on a kqueue or epoll fd that is not yet initialized.
2019-07-23 11:00:05 -06:00
Matthew Flatt
491081eefd cgc: don't use GC_free on runstacks
Using GC_free() on runstacks was a way of reducing leaks with
conservative GC, but the implementation of prompts for delimited
continuations evolved in a way that is incompatible with using
GC_free(). The recent change to make certain runstack links weak
particularly exposed the mismatch.
2019-07-22 14:15:30 -06:00
Paulo Matos
7b3766ae84 Generate new certificate (valid for 10 yrs) for testing using 2048bits
Fixes #2748

Steps to create this certificate:
openssl genrsa -out key.pem 2048
openssl req -new -sha256 -key key.pem -out csr.csr
openssl req -x509 -sha256 -key key.pem -days 3650 -in csr.csr -out certificate.pem
cat key.pem certificate.pem > test.pem

When filling out the information for the certificate, keep the same
details - some tests depend on it.
2019-07-22 13:17:35 +02:00
Matthew Flatt
fa754ee333 unsafe-poller: fix result handling
Closes #2754
2019-07-21 18:05:57 -06:00
Matthew Flatt
91f5ec3c9b fix GC registration for scheme_unsafe_poller_proc 2019-07-21 18:05:57 -06:00
Matthew Flatt
23cb7c6a1a sgc: fix finalization callback data marking
Callback data should be treated accessible before conaidering any
finalized or weak references.

Relevant to #2734
2019-07-21 18:05:57 -06:00
Matthew Flatt
ab9a5d261e ffi: fix recording of foreign function names
The internal change to a curried mode caused a generic name to be
used.
2019-07-21 18:05:57 -06:00
Matthew Flatt
0f6cd01489 conservative GC: break weak links after finalization
Bring CGC and 3m in line by breaking weak links in CGC only after
ready level-1 finalizations (which correspond to will executors) have
been queued. The chage delays clearing of the weak link until after
the finalizer is run.
2019-07-21 18:05:57 -06:00
Matthew Flatt
deca030d34 fix finalization pessimization
Recurring during finalization marking could potentially delay
finalization that should happen in the same collection.
2019-07-21 18:05:57 -06:00
Robby Findler
93f4c9226b change the way +1 arity functions work so the code is generated
by `contract-out` instead of `->`

This seems to save about a second of startup time in (non-cs) DrRacket
and about .1 seconds in drracketcs.

The code is also theoretically more easily inlined. Still not easy enough, however.
2019-07-20 10:45:23 -05:00
Paulo Matos
2045c4abd8
Fix processor-count for windows systems (#2752)
DOS_FILE_SYSTEM is not defined in rktio, use RKTIO_SYSTEM_WINDOWS instead

Fixes #2674
2019-07-20 16:20:19 +02:00
Matthew Flatt
43ba15ca38 expander: fix performance problem with datum->syntax
In a pattern like

 (let loop ([l l])
   (define v (syntax-e l))
   (cond
     [(null? v) 'done]
     [else
      (loop (datum->syntax #f (cdr v)))]))

the running time was O(N^2) for a list of syntax objects of length N.
That pattern is relevant for traversals that use `syntax-case` like

 (let loop ([l l])
   (syntax-case l ()
     [(a . b) (loop #'b)]
     [() 'done]))

Avoid bad behavior by recording in an weak hash table certain pairs
that were previously been produced by `datum->syntax` internally so
that they can be used as-is.
2019-07-18 12:19:29 -06:00
Matthew Flatt
e4c6a2560b cs & thread: fix problems with future-shutdown synchronization
Relevant to #2725
2019-07-18 06:05:53 -06:00
Matthew Flatt
91cdc06c91 tanh: single flonum result for range of arguments
Fix the case for > 1.29f-08 and <= 0.549f0.

Closes #2736
2019-07-18 06:05:53 -06:00
Matthew Flatt
c397dba145 cs: better build-time error if lz4 isn't available
Mainly for cross-compilation with a Windows target, the Racket CS
build process may need to run `lz4` as an external program. In that
case, complain when `lz4` isn't found, instead of letting `system*`
complain about getting `#f`.
2019-07-17 13:15:50 -06:00
Sam Tobin-Hochstadt
997f5b583c Support chaperoning tcp-listeners as evts.
Found by the Typed Racket test suite.
2019-07-15 09:18:33 -04:00
Matthew Flatt
fa155727df cs: unbreak Windows build
Add pe-made "cs_config.h" for Windows.
2019-07-12 11:49:39 -06:00
Ryan Culpepper
b4d7885b16 openssl: fix ssl-addresses, docs for ports->ssl-ports 2019-07-12 00:22:28 +02:00
Ryan Culpepper
65e2d802dd openssl: add key and cert-chain args to ssl-make-{client,server}-context 2019-07-12 00:22:28 +02:00
Ben Greenman
eef651743e
contract: collapsible, prune leaves if eq? and trusted (#2706)
Change the condition for filtering leaf contracts via `eq?`.

Before, we looked for flat or chaperone contracts.
After, look for flat or trusted contracts. So:

1. untrusted chaperones with side effects that are unsafe to drop are not
   dropped, and
2. impersonator contracts can now be dropped (object/c, recursive-contract)
2019-07-11 15:53:16 -04:00
Matthew Flatt
ef4eb585d7 reader: repair readtable re-mapping of # comment forms
Thanks to @LiberalArtist for the bug report and examples.
2019-07-11 12:09:21 -06:00
Matthew Flatt
bad64945e7 racket/fasl: support unsafe-undefined
Since a literal unsafe-undefined can be serialized in compiled code,
support in fasl.
2019-07-11 05:13:39 -06:00
Paulo Matos
e6922e76ea
Ensure that src variable type to test mbsrtowcs is correct (#2735)
When compiling with -Werror (./configure CFLAGS="-Werror" ...),
the test to see if mbsrtowcs exists
failed with pointer type of incompatible type, is char **, should be
const char **. It would proceed to assume mbsrtowcs didn't exist.
2019-07-11 12:20:36 +02:00
Matthew Flatt
85f4fc1337 cs & schemify: fix incorrect constant-folding for {fx,fl}vector
Closes #2729
2019-07-09 17:56:15 -06:00
Matthew Flatt
15587d84fe cs & schemify: repair bad cross-module copy propagation
Closes #2732
2019-07-09 15:20:24 -06:00
Matthew Flatt
0284bdaa58 cs & thread: fix chaperone-evt on will executors
Closes #2730
2019-07-09 13:48:30 -06:00
Matthew Flatt
8c052df959 cs & thread: repair for custodian sync witth future host thread 2019-07-09 13:37:24 -06:00
Matthew Flatt
9c0a3abfdb cs: repair for 32-bit ELF 2019-07-09 09:04:58 -06:00
Matthew Flatt
8e85441410 repairs for procedure-spcialize 2019-07-08 11:48:15 -06:00
John Clements
003f0dd72e Post-release version for the v7.4 release 2019-07-08 02:33:57 -07:00
Matthew Flatt
839fb84eec cs & io: fix security-guard call in current-directory 2019-07-07 10:11:37 -06:00
Matthew Flatt
79d6b9bc18 json: preserve old behavior in terminating a number
The json parser has allowed "1x" as "1" and "1e-0x" as "1.0", so
keep that behavior for now.
2019-07-06 05:59:14 -06:00
Dmitry Moskowski
bbb8707a4a json: fixing scientific notation exponent sign bug
if exponent contains leading zeroes it's sign will be always `+`. example:

$ racket                                                                                                                                                                                                                                                      (6s 38ms)
Welcome to Racket v7.3.
> (require json)
> (jsexpr->string 0.000001)
"1e-06"
> (string->jsexpr (jsexpr->string 0.000001))
1000000.0
2019-07-06 05:57:22 -06:00
Matthew Flatt
c0104a29ef CS bootstrap: avoid pessimizing primitives
Speed up the bootstrap process by more directly referencing primitives
that won't be replaced in the top-lvel namespace for simulating Chez
Scheme.
2019-07-05 15:22:02 -06:00
Matthew Flatt
1e7dbbe020 CS bootstrap: fix structure-operation simplification 2019-07-05 12:12:13 -06:00
Matthew Flatt
3235f648fb speed up Chez Scheme bootstrap a little
Recognize constructor patterns to avoid some indirections.
2019-07-05 08:13:12 -06:00
Matthew Flatt
f0314ddad7 configure: fix failure handling in configure dispatch
Closes #2727
2019-07-05 08:13:12 -06:00
Alexis King
ca8870e964 Add property/c contract combinator for checking first-order properties 2019-07-04 14:08:30 -05:00
Matthew Flatt
21481421a0 unbreak compilation with gcc < v4.5 2019-07-04 07:38:53 -06:00
Matthew Flatt
62f1243136 expander: fix extract mode to not run and work with a submodule root
Also, report an error, for now, if a cache directory is not specified
in extract mode, since extraction doesn't currently work without it.
2019-07-03 10:38:12 -06:00
Paulo Matos
8f85df64d9
Add MZ_ prefix to macros NORETURN and UNREACHABLE (#2723)
Since the definitions of these live in the public header scheme.h,
adding this prefix reduces clashes with other related macros.
2019-07-03 15:32:48 +02:00
Paulo Matos
e26d2e11d8
Proper cross-platform no return annotations for error functions (#2709)
Ensures proper noreturn annotations for error functions. Implemented
cross-platform unreachable annotation. No warnings in tested clang or
gcc with default flags. Tested as well on MacOS and Windows.
2019-07-03 08:31:18 +02:00
Sorawee Porncharoenwase
0ffb16bce3 Fix various typos 2019-07-02 12:52:23 -06:00
Matthew Flatt
b0f77a98a3 schemify: improve cross-module optimization
The schemify pass collects known-value information as the first step
of processing a linklet body, but the main pass to process the linklet
body may simplify it in a way that exposes new information. For
example, in

 (define (call) (values 1 2))
 (define-values (x y) (call))

the main pass will inline `call` and expose the fact that `x` and `y`
are always 1 and 2, respectively.

Adjust schemify to inspect the simplified form of a definition and
potentially add new information to known-value information, which is
useful later in the ame linklet body and also as cross-module
information.
2019-07-01 15:19:28 -06:00
Matthew Flatt
ecabcd385a schemify: add constant folding
Like other optimizations that schemify duplicates, constant folding
helps support cross-module optimization. Related "no-prompt"
declarations for primitives can reduce `call-with-module-prompt`s in
schemified output, too, which can interfere with Chez Scheme's
optimizer.
2019-07-01 14:34:25 -06:00
Paulo Matos
831e75d731
Remove SCHEME_NO_EXN block (#2718)
This is probably related to #2712.
It's the only occurrence of SCHEME_NO_EXN pointing to the fact that
this is an historical artifact that can be removed.
2019-07-01 16:17:07 +02:00
Matthew Flatt
0e1af0be89 schemify: recognize define-values split after inlining
Recognize `(define-values (id ...) (values rhs ...))` and split to
multiple `define`s after simplifying the right-hand side of
`define-values`. Also, don't split if a define variable is referenced
too early.
2019-07-01 06:11:17 -06:00
Matthew Flatt
c5523fef02 use fixnum-for-every-platform? for case 2019-07-01 05:41:08 -06:00
Paulo Matos
e97c85b79e
Mark do_raise as NORETURN and ensure it does not return (#2717) 2019-07-01 12:55:30 +02:00
Paulo Matos
26cd03ec8f
Do not add explicit return statement when it doesn't exist (#2715)
Adding return statement where it doesn't exist, causes problems with
functions marked no return so it should be avoided.

Related to #2709 - with this PR, clang won't complain any longer
about issues with xform generated sources about functions marked
no return that do indeed return.
2019-07-01 12:30:45 +02:00
Paulo Matos
fcddf7e9ba
Whitespace cleanup (#2716)
Requested as a separate PR in #2714
2019-07-01 12:28:22 +02:00
Matthew Flatt
f8e5526b28 unbreak some 32-bit x86 builds 2019-06-30 11:40:17 -06:00
Matthew Flatt
020c75792c add fixnum-for-every-system?
The `case` macro needs to use the new predicate instead of `fixnum?`,
but delay swittching over until Typed Racket is ready.
2019-06-29 20:18:23 -06:00
Matthew Flatt
b1a5c86702 cs: disable bytecode loaded with a non-original code inspector
Racket CS now passes all tests in the core Racket test suite.
2019-06-29 09:20:36 -06:00
Matthew Flatt
97b2982a1d schemify: update demo 2019-06-29 08:30:08 -06:00
Matthew Flatt
efeb9116d5 cs & schemify: fix set!-vs.-define tracking 2019-06-29 08:13:52 -06:00
Matthew Flatt
82d40d1509 use wrappers for trig functions in complex variants
Using wrappers applies various "sconfig.h"-configured fixups.
2019-06-29 05:46:10 -06:00
Matthew Flatt
2847d1d22a improve atan, asin, and acos on complex numbers
Replace naive calculations with ones based on Kahan's "Branch Cuts for
Complex Elementary Functions" as implemented in Chez Scheme.
2019-06-28 16:51:48 -06:00
Matthew Flatt
8e1b27592f cs: disable non-decimal string->number on inexacts 2019-06-28 10:57:59 -06:00
Matthew Flatt
75ff7870bd improve / precision on mixed exact--inexact complex numbers 2019-06-28 10:57:59 -06:00
Matthew Flatt
ff94c6d8d8 cs: fix variable-reference->module-... on reference to primitive 2019-06-28 10:57:59 -06:00
Matthew Flatt
032ab4e374 cs: add place logging 2019-06-28 10:57:59 -06:00
Ryan Culpepper
3c12957c7e template: mark pattern variables as disappeared
This fixes a bug introduced in 291565.
2019-06-27 22:22:08 +02:00
Matthew Flatt
cbaddd2164 cs & thread: repairs for memory accounting and places 2019-06-26 13:50:06 -06:00
Matthew Flatt
8985a409b8 openssl: fix bytes-terminator problem on Racket CS
Make sure the argument to SSL_ctrl has a nul terminator.
2019-06-26 13:50:06 -06:00
Matthew Flatt
5e59ae0586 rktio: use only async-signal safe after fork
In particular, `malloc` is not async-signal safe.
2019-06-26 13:50:06 -06:00
Paulo Matos
7422abb42a
Remove reference to NO_SCHEME_EXNS (#2712) 2019-06-26 17:03:12 +02:00
Matthew Flatt
a0023d5797 fix environment-variables-copy and case-normalization
Preserve the original case of an environment variable for
round-tripping on systems where environment variable names are
case-normalized.
2019-06-25 14:56:39 -06:00
Matthew Flatt
8c1dbae88b expander: improve extractor to recognize once-set variables
When `set!` is used to tie a recursove knot in a flattened linklet,
the expander can recognize that pattern and not complain that a
mutable variable might be shared across places. Improving that
inference means fewer `++global-ok` flags in Makefiles.

This commit also avoids single-quote as an escaping form in a
makefile, which doesn't work with nmake on Windows.
2019-06-25 08:43:38 -06:00
Matthew Flatt
3fb226ce2a cs: fix future-thread signaling
Fix confusion between signal and broadcast operation.
2019-06-24 20:14:52 -06:00
Matthew Flatt
b64e17388f cs: fix stdio/syslog GC logging as triggered by future thread
Always use the main `rktio` instance and don't try to explicitly start
atomic mode.
2019-06-24 20:00:51 -06:00
Matthew Flatt
309a0c2489 cs: fix future-logging race 2019-06-24 18:28:03 -06:00
Matthew Flatt
51ab4a5c6a thread: repairs for event logging
Fix RacketCS so that the future visualizer works.
2019-06-24 16:36:16 -06:00
Matthew Flatt
0106abaf6e bump version number
Since it removes an built-in place-local definition, commit 564dcf339a
can affect compilation for Racket CS.
2019-06-24 15:29:45 -06:00
Matthew Flatt
0d3d0d7d86 thread: add notes on the behavior of futures 2019-06-24 14:54:37 -06:00
Matthew Flatt
564dcf339a cs: fix memory accounting and futures
Also avoid problems with interrupting a rapidly allocating
computation and shutting down the main custodian.
2019-06-24 13:59:03 -06:00
Matthew Flatt
a5a84ea8c6 remove accidentally committed debugging printout 2019-06-24 08:14:58 -06:00
Matthew Flatt
1192225c97 avoid some compiler warnings 2019-06-23 06:46:28 -06:00
Matthew Flatt
1e84b11462 expander: repair extraction when using an existing Racket build
Recent improvements to module-name resolution caching exposed a
problem in the extraction setup.
2019-06-22 07:43:02 -06:00
Matthew Flatt
f00de510de cs configure: support installed libz and libzl4
Continue to build the bundled-with-Chez zlib and lz4 by default, but
support `--enable-libz` and `--enable-liblz4`, and turn those on when
the Chez Scheme directory doesn't have bundled versions. That should
make things build right for distributions where repackaging
dependencies is disallowed or discouraged.
2019-06-22 07:11:09 -06:00
Matthew Flatt
6647d832bb configure: further improvements for NetBSD and OpenBSD
Enable ELF support for `racketcs` embedding, and add `paxctl +m`
build steps for NetBSD.
2019-06-22 06:23:47 -06:00
Matthew Flatt
7706b447a5 configure: propagate ARFLAGS to libffi configure 2019-06-21 21:54:22 -06:00
Matthew Flatt
5fb38fc246 cs: sync include path for {Free,Open}BSD 2019-06-21 21:12:17 -06:00
Matthew Flatt
e68269b357 makefile: avoid automatic "Makefile" rebuild 2019-06-21 19:46:39 -06:00
Matthew Flatt
90b79524aa revise build to avoid ld and nicear
The Chez Scheme build process now create an archive instead of linking
"kernel.o". Adjust the Racket CS build to use archives instead of
"kernel.o".

Also, modernize the Racket build's use of `ar`. Using the flags `rc` by
default (instead of `ruv`) should avoid the need for `nicear`.
2019-06-21 16:53:58 -06:00
Matthew Flatt
5c51096a88 cs: repair filesystem-change-evt
Correct an incomplete adaptation in a2a67a9660.
2019-06-21 13:35:33 -06:00
Matthew Flatt
c7f7170a3e avoid compiler warning 2019-06-21 09:50:32 -06:00
Matthew Flatt
6e70d8ec1d nicer nicear: suppress "modifier ignored" warning
If GUN ar is configured for deterministic mode by default, then

  ar: `u' modifier ignored since `D' is the default (see `U')

prints. Suppress that to avoid stderr output.
2019-06-21 09:49:11 -06:00
Matthew Flatt
db3b75eaf1 expander: add shadow filesystem for Windows in collection lookup
Checking for directories when searching for a collection can be
especially slow with the Windows filesystem, but Windows also supports
filesystem-change events. So, cache information about the existence of
paths, relying on filesystem-change events to detect with the cache is
out of date.

Related to racket/drracket#281
2019-06-21 09:27:12 -06:00
Matthew Flatt
a2a67a9660 filesystem-change-evt: fix use of failure thunk
Also, allow the failure thunk to be #f to get the default behavior.
2019-06-21 09:27:12 -06:00
Matthew Flatt
ec5b45e4f8 cs: inline arithmetic-shift and other bitwise operations 2019-06-20 18:31:19 -06:00
Matthew Flatt
9083c6abb4 schemify: use unsafe box operation for lifted mutable variables 2019-06-20 18:30:55 -06:00
Matthew Flatt
bf692f572d cs: avoid indirection through Chez Scheme for raise 2019-06-20 14:37:03 -06:00
Matthew Flatt
3f35504355 thread: refactor scheduler poll-and-select loop
Further reduce redundant checks, and also avoid an excessive delay
after making the process sleep.
2019-06-20 14:36:43 -06:00
Matthew Flatt
6d3eff55a4 cs: repair for external signals
Like 2a1404f9a3, but for Ctl-C.
2019-06-20 12:14:48 -06:00
Matthew Flatt
35ff9137e7 cs: tweak return for call/ec and call-with-continuation-barrier
The prompt installed for an escape continuation or continuation
barrier is never used to delimit a captured continuation, so the
return from the continuatiton can be streamlined slightly.

The benefit is very small (but detectable in the macro expander's use
of barriers). There's an opportunity to use `call/1cc` instead of
`call/cc`, but that change does seem to help --- neither Chez Scheme's
current `call/1cc` nor the opportunistic variant of `call/cc` use to
implement continuation attachments.
2019-06-20 08:48:56 -06:00
Matthew Flatt
30393ae0fa cs: linear-time prompt check
Add cache for `continuation-prompt-available?` so it's amortized
constant time.
2019-06-20 08:48:56 -06:00
Ryan Culpepper
685d067361 syntax/parse: fix handling of ~seq with action patterns 2019-06-20 16:36:14 +02:00
Matthew Flatt
2a1404f9a3 cs & io: fix fd semaphore polling
Reducing external-event polling exposed a problem with fd semaphore
checking, where the check before sleeping didn't abandon the sleep if
an fd semaphore was posted.

Also, fix a bug with interrupted network address lookup.
2019-06-19 18:13:37 -06:00
Matthew Flatt
1ba4d76fe0 cs & thread: avoid excessive polling for external events
Reduce polling in the case that threads that block and swap rapidly,
in which case polling on every thread swap can be useless and
expensive.
2019-06-19 17:27:24 -06:00
Matthew Flatt
ba8d442e75 cs & thread: refactor and finish futures implementation
Complete the implementation of futures, fsemaphores, future logging,
and their cooperation with threads, places, and custodians.
2019-06-19 12:50:19 -06:00
Ryan Culpepper
eb4ec000b0 syntax/parse: use generic tree functions in analyses 2019-06-19 16:21:43 +02:00
Ryan Culpepper
4b64cdef54 syntax/parse: add multiple pattern-processing passes
- pair specialization
- and/ord normalization, and cleanup
- add pat:seq-end to list-pattern
2019-06-19 16:21:43 +02:00
Ryan Culpepper
29e46bea78 syntax/parse: add generic (dynamic) tree traversal library 2019-06-19 16:21:43 +02:00
Ryan Culpepper
e845d0861d syntax/parse: add explicit pattern checks 2019-06-19 16:21:43 +02:00
Ryan Culpepper
fa78f5ebd3 syntax/parse: add well-formed pattern predicates 2019-06-19 16:21:43 +02:00
Ryan Culpepper
769dfb9e34 syntax/parse: add hpat:single; {single,head}-pattern types disjoint 2019-06-19 16:21:43 +02:00
Ryan Culpepper
5ab82ccdd4 syntax/parse: code reorganization 2019-06-19 16:21:43 +02:00
Ryan Culpepper
1c01df60ce syntax/parse: use logging instead of conditional eprintf, show more patterns 2019-06-19 16:21:43 +02:00
Ryan Culpepper
39bacd45d5 syntax/parse: simplify head pattern compilation
The continuation expression for a head pattern evaluates to a
procedure that takes the rest of the term and the current progress.
2019-06-19 16:21:43 +02:00
Ryan Culpepper
6e46dd1b0d syntax/parse: fix saving of eh-alternatives
Avoid adding extra syntax wrapping. This doesn't matter for parsing,
but it does matter for pattern analyses.
2019-06-19 16:21:43 +02:00
Ryan Culpepper
4a7717679a syntax/parse: clean up insertion of default expressions in patterns 2019-06-19 16:21:43 +02:00
Ryan Culpepper
233c9b8f50 syntax/parse: fix abstract failure pattern analysis 2019-06-19 16:21:43 +02:00
Ryan Culpepper
bad4dd909d syntax/parse: delete dead make-dummy-stxclass 2019-06-19 16:21:43 +02:00
Ryan Culpepper
51d7060ff0 syntax/parse: add missing failure -> failure* 2019-06-19 16:21:43 +02:00
Ryan Culpepper
7fb0250191 syntax/parse: update comments 2019-06-19 16:21:43 +02:00
Ryan Culpepper
6577791664 syntax/parse: improve minimatch on structs, vectors; delete dead code 2019-06-19 16:21:43 +02:00
Stephen De Gabrielle
38ef00fca3 raco pkg new changed to create APACHE and MIT license files 2019-06-19 09:17:53 -04:00
Ryan Culpepper
4cb37a1d8a template: improve ASTs, use smart constructors
Improvements include:
- less scattered handling of constant templates
- better recognition of constant templates, like (1 (... 2)), where
  the template syntax is not identical to its value
- better code for (x ... ...), where x is trusted
2019-06-19 14:48:28 +02:00
Ryan Culpepper
2915657c27 template: parse ellipses using stack of map environments
This is like the psyntax approach but frames are mutable
and track extra information.
2019-06-19 14:48:28 +02:00
Matthew Flatt
6184de2389 ffi: fix use of struct malloc mode for function results
Relevant to #2702
2019-06-17 15:32:14 -06:00
Matthew Flatt
1824fe5e41 io: add shortcut to get semaphore on blocking fd read
When reading from an input fd blocks, instead of creating a general
event that creates a semaphore, use the semaphore directly (when
available). Also, treat a semaphore internally as an event that
always produces 0.

This change speeds up the "echo" shootout benchmark.

This change speeds up the "echo" shootout benchmark.
2019-06-17 10:08:40 -06:00
Matthew Flatt
97e61b5f25 thread: avoid repeated polls while scanning available threads
Poll for external events just once before starting a search for an
available thread, instead of polling every iteration in the search.
2019-06-17 10:08:27 -06:00
Matthew Flatt
6d200e6143 cs: remove compile-as-independent? mode
This slower mode hasn't turned out to be needed, and since it hasn't
been used, it probably doesn't work anymore.
2019-06-17 09:10:39 -06:00
Matthew Flatt
9d55443e23 cs: force inline of applicable-struct support
When the schemify pass cannot determine that a call is to a primitive
procedure, it generates an `#%app` form that expands to

  ((extract-procedure rator) rand ...)

Force `extract-procedure` to be inlined (by making it a macro), so the
expansion is

  (let ([tmp rator])
    ((if (#%procedure? tmp) tmp (slow-extract-procedure tmp)) rand ...))

which is usefully faster in the common case that `rator` turns out to
be a primitive procedure.
2019-06-17 09:10:08 -06:00
Matthew Flatt
ae1bf1b9fc cs: lock-free eq-hash-code
Chez Scheme doesn't provide `eq-hash-code`, so it's implemented with a
weak `eq?`-based hash table that maps values to fixnums (except for
numbers, symbols, and characters). The table had a lock to support
concurrent use in multiple places, and that became a major source of
contention in parallel builds. Change the implementation to use a new
`eq-hashtable-try-atomic-cell` operation, which effectively moves
contention from the hash table to individual buckets (where it should
be much rarer).
2019-06-17 09:09:30 -06:00
Matthew Flatt
f27dbb7951 cs: fix cross-module inlining for separate compilation
Commit fe708871bd broke cross-module inlining for modules that are
compiled in different Racket processes. The problem is that
cross-module information is represented by prefab structures, and the
change caused Chez Scheme's fasl for prefabs to generate a different
structure type on different runs.

To solve the problem, use `racket/fasl` for cross-module information,
instead. But cross-module information also has inlining information as
correlated objects, so make those supported by `racket/fasl`, too.
2019-06-15 10:05:05 -06:00
Ben Greenman
b40e247edd contract-out: struct, keep original struct id
The first time a struct is provided through `(contract-out (struct id ....))`,
 save `id` to access its transformer binding later.

On reprovides:
- hang on to the original `id`
- use its transformer to recover the original predicate/accessor/mutator names

Also, fix a bug where the order of the mutator ids reported by the
struct info was getting reversed

Probably, nobody noticed that bug. They'd have to work around the renaming
issue in #2572 first.
2019-06-14 13:54:47 -05:00
Paulo Matos
ddaf3f5022
Regenerate exports (#2697)
This should have been done after e13fac3ccf, where schemef.h was changed.
2019-06-14 17:05:21 +02:00
Matthew Flatt
4c01f60d56 module name resolver: adjust resolver cache
The default module name resolver uses a cache to map module names to
resolved-path information. The cache was weak in a way that turns out
to be much weaker on Racket CS, essentially because Chez Scheme is
tuned to fire a minor GC more frequently.

The new cache cuts 45 minutes(!) from a 2h15m single-process
distribution build of Racket CS on Linux. That brings it under a factor
of 1.5 of the non-CS build time, instead of over a factor of 2.

Thanks to Caner and Sam for pointing out LONG ago (maybe a year ago)
that the cache works badly for Pycket. Since the cache doesn't make a
big difference for `racketcs -cl racket`, though, it took me this long
to understand that it can be such a big deal for Racket CS when
performing a distribution build.
2019-06-14 06:24:06 -06:00
Matthew Flatt
61bf75962c raco exe: make generated name for embedded module deterministic
Help avoid problems with serialization by making the generation of
embedded module symbolic names deterministic and relatively
insensitive to module order. The generated name is based on a
combination of `path->module-path` and paths relative to the
main module of the executable.

Related to #2693
2019-06-13 07:50:39 -06:00
Alexander B. McLin
9c95e31d26 cs: get_self_path implementation for FreeBSD 2019-06-12 12:46:21 -06:00
Matthew Flatt
9c4519628c cs: enable strip on install for FreeBSD 2019-06-12 07:01:05 -06:00
Matthew Flatt
1b729d157b cs: sync LDFLAGS for racketcs on BSDs 2019-06-12 06:52:15 -06:00
Matthew Flatt
0423ec9841 Windows: fix setup/winstrip for different variants
For the normal 3m Racket builds in non-cross mode, CGC DLLs have been
incorrectly left behind (e.g., in the Utah snapshot distributions).
2019-06-12 06:07:34 -06:00
Matthew Flatt
e51c44fa3d Use 3m to build CS on Windows
The extra time to build 3m via CGC seems worth it, especially when
building Chez Scheme's boot files.
2019-06-11 20:01:41 -06:00
Matthew Flatt
d8c3edd3e1 io: tiny performance tweak for path-element checking 2019-06-11 18:38:19 -06:00
Matthew Flatt
b1632232ca cs: reduce PLT_LINKLET_TIMES overhead 2019-06-11 16:44:15 -06:00
Matthew Flatt
41dc6f1335 measure resolver time instead of resolve calls in instantiate
The total time of module name resolver calls is more useful, because
each one takes longer, there should be many fewer, and there are
tasks that end up resolving module paths.
2019-06-11 15:53:37 -06:00
Matthew Flatt
a0ce64c5c4 rktio: add missing header
NetBSD needs <sys/time.h>.
2019-06-11 08:06:29 -06:00
Ben Greenman
bcd10a9114 file/tar: add #:timestamp parameter
Add a keyword argument that matches the arg. to `zip`

Fixes an "unbound" id in the docs
2019-06-10 13:24:11 -04:00
Matthew Flatt
d136245e3b expander as pkg: repair source mode
When support for machine-independent bytecode was added, the bootstrap
implementation of linklets ended up being slightly uncooperative.
Source terms from the bootstrap became wrapped as machine-independent
form. For various reasons, things worked anyway, except that
`--linklets` mode prints bytecode instead of S-expressions. Fix the
bootstrap implementation to cooperate correctly.

Related to #2688
2019-06-10 07:22:55 -06:00
Matthew Flatt
c020bd4feb racket/fasl: repair for +nan.f
The `racket/fasl` implementation wasn't updated with the change
to disable reading for lfoating-point literals.
2019-06-10 07:22:55 -06:00
Matthew Flatt
2f47629f74 optimize: repair some make-struct-type[-property] handling
Don't discard expressions that will fail due to trying to make a
prefab struct type from a parent that isn't a prefab. Similarly, don't
discard a `make-struct-type` with a built-in property that has a
guard. Don't discard a `make-struct-type-property` with a literal
guard procedure that has the wrong arity.

Related to #2685
2019-06-09 07:27:35 -06:00
Matthew Flatt
07e35566e2 optimizer: repair unsafe-mutable-hash-iterate-next and similar
Related to #2685
2019-06-09 07:27:35 -06:00
Matthew Flatt
b133bea92e optimizer: abs expects and produces reals, not numbers
Related to #2685
2019-06-09 07:27:35 -06:00
Matthew Flatt
34cd1e2a2b optimizer: don't discard potential hash errors
If `hasheq` is given an odd number of arguments or if `make-hasheq` is
given a bad argument, then the error should be preserved.

Related to #2685
2019-06-09 07:27:35 -06:00
Paulo Matos
2cd3679d8b
Fix typo s/assuptions/assumptions/ 2019-06-08 22:46:42 +02:00
Matthew Flatt
b2e95542d8 io and expander: performance tweaks 2019-06-05 17:52:37 -06:00
Matthew Flatt
a72220a3ac bytecode optimizer: remove exact->inexact on known flonum
And similar for `real->double-flonum`. Also, convert those to
`unsafe-fx->fl` when the argument is known to be a fixnum.
2019-06-05 15:21:49 -06:00
Robby Findler
a51231ffa2 use regular old append when possible 2019-06-05 12:52:51 -05:00
Matthew Flatt
c8e9083f0e repair for JIT-inlined unsafe-make-flrectangular 2019-06-05 10:07:04 -06:00
Matthew Flatt
edd74d6ecf makefile: configure with --enable-racket => no 3m dependency CS
Adjust the makefile that ends up in <builddir> with `--enable-cs` or
`--enable-csdefault` (as opposed to `--enable-csonly`) so that `make
racketcs` doesn't imply `make racket3m` if `--enable-racket` has
supplied an existing Racket.

Also fix `make install-cs` related to GRacket for the case that Racket
3m/CGC isn't built.

Relevant to #2683
2019-06-05 07:07:32 -06:00
Paulo Matos
eec118f4fb
Do not memcpy with null pointer as 2nd arg (#2682)
Caught by test:ubsan:cs
2019-06-05 14:40:23 +02:00
Paulo Matos
c40b24d0d3 Remove stray right paren from configure docs for ubsan 2019-06-04 23:51:27 +02:00
Matthew Flatt
0ca19cfa08 avoid retaining unneeded runstacks in continuations
While a continuation is set up to avoid retaining runstacks, partly by
storing a prompt ID instead of a prompt record, prompt records can
remain on the C stack and get captured anyway. Mitigate that problem
by making the runstack link weak in some prompt record.

Racket CS doesn't have this problem, of course.

Relevant to jeapostrophe/lux#10
2019-06-04 13:53:15 -06:00
Paulo Matos
6eb2175f7a
Fix UNSAFE_FX use of type for v, instead of intptr_t (#2653) 2019-06-04 20:56:10 +02:00
Matthew Flatt
b8617c24e9 unbreak cify build 2019-06-04 09:27:44 -06:00
Matthew Flatt
758e02fa39 schemify: fix bad check on mutated state 2019-06-04 07:34:13 -06:00
Matthew Flatt
03710757ef io: fix newline on custom output port
Closes #2677
2019-06-04 07:24:31 -06:00
Matthew Flatt
fcdd8a91dc disable single-flonum reading by default
Add `single-flonum-available?` and `read-single-flonum`, where the
latter controls whether numbers that have an "s" or "f" exponent
marker are parsed as single-flonums are normal flonums. The parameter
is disabled by default, which changes the meaning of most existing
code that has a literal number with "s" or "f", including `+inf.f`,
`inf.f`, and `+nan.f`.

The compiler constant-folds `single-flonum-available?` and
`real->single-flonum` on a literal number, so use a combination of
those to replace most uses of a single-flonum literal. Single-flonums
within quoted data are less convenient.
2019-06-04 06:46:53 -06:00
Alexis King
88b00d75f7 syntax/parse: Fix syntax instead of quote-syntax in def-litset
fixes #2673
2019-06-01 23:47:05 -05:00
Matthew Flatt
a4545594f6 fix make include setup in configure for Racket CS
Relevant to #2669
2019-05-31 06:44:07 -06:00
Gustavo Massaccesi
daba5db44a simplify code and test for print-pair-curly-braces
After the change that makes printing of struct ignore print-pair-curly-braces
it is possible to simplify the code in io/print and the associated tests.
2019-05-30 13:55:00 -03:00
Matthew Flatt
bdb578606e repairs for bytes-utf-8-index
For traditional Racket, fix `bytes-utf-8-index` to accept 5 arguments
as documented. For Racket CS, fix `bytes-utf-8-index` to return an
index relative to the byte string's start.

Closes #2670
2019-05-30 08:13:38 -06:00
Matthew Flatt
8c652de835 net/url: avoid failure on bad proxy environment variable
Related to #2663
2019-05-29 15:13:03 -06:00
Matthew Flatt
6381e3c009 print-pair-curly-braces: don't affect constructor output
When `print-pair-curly-braces` is true, change the built-in printer to
not use curly braces to group a constructor with its argument.
Restrict its effect to quoted lists, which is more what you expect and
more consistent with `pretty-print`.

Also, change `pretty-print` to not use `{` when using the `list`,
`list*`, `cons`, or `mcons` constructors.

Closes #2662
2019-05-28 19:14:48 -06:00
Gustavo Massaccesi
a121f45aac cs: use print-pair-curly-braces 2019-05-28 10:04:23 -03:00
Gustavo Massaccesi
006265e447 cs: use print-mpair-curly-braces 2019-05-28 10:04:23 -03:00
Jesse Alama
674242dfcf Say "GRacketCS" rather than "GracketCS"
On case-sensitive filesystems on macOS, these are
distinct (leads to a file not found error). On
case-insensitive systems, the change should not matter.
2019-05-28 06:34:58 -06:00
Matthew Flatt
155733eada io: fix function name in some error messages 2019-05-27 13:56:20 -06:00
Matthew Flatt
40846e3ed9 racket/system: add some missing synchronization
These changes are intended to address "input port is closed" errors
that have been showing up with Racket CS, possibly because its
scheduler exposed missing synchronization.
2019-05-27 10:39:19 -06:00
Matthew Flatt
0bffb7035d cs: fix weak equal? hash tables
The pruning step was wrong, causing lists of cleared weak boxes to
accumulate. This leak particularly affected `datum-intern-literal`.
2019-05-27 08:23:52 -06:00
Matthew Flatt
9d3a49f265 cs: move letrec conversion to schemify
Instead of having schemify generate `letrec*` and convert as needed
through a Chez Scheme macro, have schemify perform any necessary
conversion to get the right use-before-definition error messages and
`call/cc` interaction.

This change improves the conversion, since schemify has more
information about bindings, but it also avoids sending Racket terms
through a macro-generating macro at the Chez Scheme level. Avoiding
the macro-generating macro avoids a kind of leak in Chez Scheme, where
a gensym used in a template may become ineligible for GC due to the
way `free-id=?` may both reify the gensym's unique name and attach a
property to the gensym.
2019-05-27 06:03:50 -06:00