Commit Graph

43174 Commits

Author SHA1 Message Date
Philip McGrath
0ead209cc5 Chez Scheme: further adjust paths for utils in build scripts
As suggested by @akeep

Co-authored-by: Andy Keep <akeep@robotman.org>
2021-04-21 07:25:18 -06:00
Matthew Flatt
f383076784 Chez Scheme: repair bignum shift right
When a negative bignum is shifted right by a multiple of the bigint
bit size (which is 32), when a shifted-off bit is non-0, and when the
result would be a sequence of bigints with all 1 bits before rounding
to deal with the dropped bits, a carry that should have been delivered
to a new high bigint was dropped.

Closes #3794
2021-04-20 18:25:23 -06:00
Matthew Flatt
890aa076a9 doc: simplify readtable-mapping result contract 2021-04-20 18:25:23 -06:00
Philip McGrath
cc0b1bafeb remove committed "racket.boot"
This file appears to have been checked in accidentally.
2021-04-18 10:16:15 -06:00
Robby Findler
9085ffe69b Update racket/collects/json/main.rkt
Co-authored-by: Sam Tobin-Hochstadt <samth0@gmail.com>
2021-04-16 16:15:02 -05:00
Robby Findler
7cae0adaa6 change json parser to be more strict about whitespace (matching the spec) 2021-04-16 16:15:02 -05:00
Robby Findler
fea6a0b9ae specialize or/c when its arguments are eq-contracts
This commit improves the performance of or/c contracts with symbols
(or other things that the contract system compares with eq?).

For example, on the program below we halve the distance to
just writing the contract directly as a predicate.

```
 #lang racket/base
(require racket/contract/base)

(define c1 (or/c 'x 'y (integer-in 1 24)))

(define (c2 x)
  (or (eq? x 'x) (eq? x 'y)
      (and (exact-integer? x)
           (<= 1 x 24))))

(define f1
  (contract (-> c1 any)
            (λ (x) x) 'pos 'neg))

(define f2
  (contract (-> c2 any)
            (λ (x) x) 'pos 'neg))

(define (try f)
  (time
   (for ([x (in-range 1000000)])
     (f 'x) (f 'y) (f 10) (f 'x) (f 'y) (f 10)
     (f 'x) (f 'y) (f 10) (f 'x) (f 'y) (f 10)
     (f 'x) (f 'y) (f 10) (f 'x) (f 'y) (f 10)
     (f 'x) (f 'y) (f 10) (f 'x) (f 'y) (f 10)
     (f 'x) (f 'y) (f 10) (f 'x) (f 'y) (f 10))))

(try f1)
(try f2)
```

with this commit:
cpu time: 849 real time: 850 gc time: 39
cpu time: 615 real time: 616 gc time: 2

without this commit:
cpu time: 1020 real time: 1021 gc time: 37
cpu time: 616 real time: 617 gc time: 2
2021-04-16 14:31:43 -05:00
K
df0c756f73
typographic rehash of --help output
The current output for `--help` is quite messy and hard to
navigate.

I added some indentation and spacing to make the document
easier to read. For example,

    File and expression options:

      -e <exprs>, --eval <exprs>
         Evaluate <exprs>, print results
      -f <file>, --load <file>
         Like -e '(load "<file>")' without printing

The new layout is longer, but at least it is readable. It
might be better if we could move all the options to a man
page and only select a few common ones to put in `--help`.
2021-04-16 08:25:31 -06:00
Sorawee Porncharoenwase
73381c3ad3 expander: another improvement to make-readtable's error message
Currently `(make-readtable #f #\a 'dispatch-macro)` produces the error
message

```
; make-readtable: expected procedure argument after symbol argument
;   given: 'dispatch-macro
```

which is very confusing, because it sounds like `'dispatch-macro` is
incorrect, but it is in fact correct already.

This PR adjusts the error message to:

```
; make-readtable: expected procedure argument after symbol argument
;   symbol: 'dispatch-macro
```

which is the convention that is already used when the mode argument is not given.
2021-04-16 08:22:43 -06:00
sorawee
bad18f5be6
expander: fix make-readtable's error message and doc 2021-04-15 12:33:23 -06:00
Doc Mo
c3e54219ff better phrasing 2021-04-15 12:07:26 -06:00
Doc Mo
b03f274933 generator argument formals specified directly 2021-04-15 12:07:26 -06:00
Gustavo Massaccesi
28a46e36c6 fix typo in resource.scrbl 2021-04-15 11:57:43 -06:00
Greg Hendershott
5b0f0cee23 Use import-orig-stx instead of import-src-sym when appropriate
The equivalent, for imports, of commit 66a8436bc1 and PR #3758 for
exports.
2021-04-15 11:57:12 -06:00
Matthew Flatt
6d30ff78c1 ffi/unsafe/try-atomic: don't use callback during nested atomic
When a `try-atomic` thunk starts a more nested atomic region, don't
trigger the callback until the more nested atomic region ends.
2021-04-15 09:16:09 -06:00
Matthew Flatt
237d627583 bc: send stderr/stdout logging through rktio
One effect of using rktio instead of fwrite is that Windows output
produces LF instead of CRLF. Writing CRLF is arguably more correct,
but it likely doesn't matter, and consistency with normal Racket
output is helpful.
2021-04-14 17:23:19 -06:00
Matthew Flatt
448b77a662 adjust DNS test to use different hosts for reverse lookup
The old one stopped working. Added two new ones, so we have a spare to
discard if one stops working.
2021-04-14 14:38:58 -06:00
Philip McGrath
1b8250de14 readme: remove reference to Boehm GC 2021-04-14 08:33:21 -06:00
Matthew Flatt
5dfe7b9c18 cs: repair run of at-exit custodian callbacks
When an at-exit callback is attached to a subcustodian, it wasn't run
as it should be.

Closes #3782
2021-04-14 08:14:19 -06:00
William J. Bowman
9f649e0afa Fix typo in engine docs 2021-04-14 09:18:16 -04:00
Matthew Flatt
84b58d9bae expander: more flexible top-level #%app expansion
Adjust top-level compilation to accomodate an `#%app` macro that
expands to definitions. Allowing `#%app` to expand to a non-expression
is more consistent with expansion in a module.

There's still an issue with top-level expansion where

 (define-syntax-rule (#%app id)
   (begin
     (define-syntax (id stx) 'ok)
     id))

does not work, because the kind of partial expansion used for the top
level doesn't trigger `#%app`, and so the macro and use are expanded
together in a `begin` instead of separately. Changing that would be
subtle and maybe not worthwhile for the top level. Also, although the
behavior of the (very) old expander may not be relevant anymore, it
behaved the same way on that example.

Closes #3728
2021-04-12 17:00:12 -06:00
Matthew Flatt
4d6a23d1d5 cs & io: fix exception type for "port closed"
To be consistent with BC, it's an `exn:fail` exception, but not
`exn:fail:contract`.
2021-04-11 17:57:03 -06:00
Matthew Flatt
a808eb042b cs & io: fix read on closed byte-string input port
Closes #3770
2021-04-11 16:14:53 -06:00
sorawee
413f09aaaa doc: fix contract for read-syntax
Closes #3771
2021-04-11 09:30:41 -06:00
Matthew Flatt
48621b4bf5 bc: unbreak raco demod 2021-04-10 14:55:44 -06:00
Matthew Flatt
4fabc762a5 Racket HISTORY.txt notes for v8.1 2021-04-10 10:19:22 -06:00
Matthew Flatt
fbe4e7d705 fix doc type for raco demod 2021-04-10 09:10:34 -06:00
Matthew Flatt
b9fdb503c1 raco demodularize: adapt to CS
Really, `raco demod` is adapted here to work with any linklet-based VM
by compiling modules to machine-independent form, which is essentially
a wrapper around linklet S-expressions. The BC-specific implementation
remains in place, and it has the advantage of being able to work with
existing module compilations, while the implementation based on
machine-independent form must recompile all modules before attempting
to combine them (but that recompilation is easily cached).

Use `--work <dir>` to use `<dir>` as a cache for multiple
demodularizations.

Getting `raco demod` to work involved several incidental improvements:

 * make `racket/linklet` work with machine-independent forms;

 * add `linklet-body-reserved-symbol?`;

 * fix schemify for linklets that have unexported definitions (which
   the expander never generates, but the demodularizer does);

 * add `current-multi-compile-any` to expose CM's multi-target
   compilation mode programmatically; and

 * repair a bug in CS JIT mode.

The demodularizer could be a lot smarter to prune demodularized code
before sending it off to the compiler. Of course, the compiler should
be able to figure out improvements itself, but sending a smaller chunk
of code to the compiler can avoid the hybrid interpreter--compiler
mode that is used for large linklets and that prevents optimizers like
cp0 from doing much to prune definitions.

The demodularizer has a lot in common with the expander's flattener
that is used for bootstrapping, and a smarter demodularizer would have
even more in common. It would be nice to have one implementation
instead of two.
2021-04-10 08:13:29 -06:00
Robby Findler
1244396d01 fix *list/c so that it returns a flat contract when given flat contracts and a chaperone contract when given chaperone contracts 2021-04-09 22:18:10 -05:00
John Clements
16bc937e7f Post-release version for the v8.1 release 2021-04-09 12:17:53 -07:00
Matthew Flatt
ebb4ce990e cs: repairs for 'text mode on Windows
Commit 24c6b2450c fixes a problem with 'text mode output, but "io.scm"
needed to be sync'ed for that repair to take effect. The repair
exposed a problem with position counting for 'text mode input, which
is repaied here.

This commit includes a relatively unrelated repair to `_list` and
`_vector`, which was exposed by a combination of the I/O demo
bootstrap and a recent repair for `malloc` to recognizes `_bytes` as a
GCable type.
2021-04-08 16:01:26 -06:00
Ryan Culpepper
1c4570b315 fix commit 0a95c50f, missed one call to wrap-ports 2021-04-08 19:56:24 +02:00
Ryan Culpepper
0a95c50f77
openssl: add ALPN support for clients (#3765) 2021-04-08 15:26:01 +02:00
Gustavo Massaccesi
24c6b2450c rktio: fix output of newlines in text files in Windows 2021-04-08 07:01:19 -06:00
Matthew Flatt
4cf538f349 cs: compress boot files by default on Windows
Compressing boot files is a trade-off in file size versus startup
time. Compressed boot files take about 10MB instead of 40MB, but using
uncompressed boot files cuts the minimum startup time (for `racket
-n`) by around 25%.

On Unix-like platforms, we favor startup time by default. Although an
extra 30MB isn't small, it's also not that much, and the Unix culture
favors small excutables that start quickly (although Racket's startup
time is not as fast as we'd like).

On Windows, we try the opposite choice with this commit. Windows
doesn't have the same culture of little excutables, slower filesystems
(especially networked ones) seem more common, and the savings for
stand-alone executables seem more worthwhile.
2021-04-07 07:09:12 -06:00
Matthew Flatt
aec86a811d build guide: Chez Scheme for Racket is no longer in a separate repo
Closes #3762
2021-04-07 06:50:42 -06:00
Mike Sperber
922bab40b5 Add print-value-columns parameter. 2021-04-07 05:13:25 -06:00
Matthew Flatt
548aca02e7 configure and makesfiles: make code compression more configurable
Add a `configure` argument to enable even more compression in ".zo"
forms, and introduce environment variables to enable compression
control for Windows builds using MSVC.
2021-04-06 17:14:48 -06:00
Matthew Flatt
069e6d1417 cs: fix cross-compile non-code fasl compression
When cross compiling, use the same fasl compression mode as non-cross
compilation on linklet bundles --- instead of always compressing,
which slows down module loading in most environments.
2021-04-06 17:14:48 -06:00
Matthew Flatt
aaab0aca28 configure: unbreak --enable-compressboot 2021-04-06 17:14:48 -06:00
Matthew Flatt
1ad31fe559 cs: fix cross compile to omit RTD descriptions
This is another way that cross compilation differed from direct
compilation, overlooked before because it's an argumen to
`compile-to-port` instead of a parameter.
2021-04-06 17:14:48 -06:00
Matthew Flatt
185809bc2c doc typo 2021-04-06 17:14:48 -06:00
Matthew Flatt
e58a3d9dda cs: adapt (unused) Patricia trie implementation for negative hash codes
The hashing protocol has been adjusted since the Patricia trie
implementation so that the result can be negative. Force it to
avoid breaking an assumption in the Patricia-trie implementation
(even though this implementation is not currently used).
2021-04-06 17:14:48 -06:00
Philip McGrath
4d23c6da5a docs: "a inclusive-range application" -> "an" 2021-04-05 16:39:48 -06:00
sorawee
e8f857cc19
sequence & list: add in-inclusive-range and inclusive-range
Currently, a common way to generate an inclusive range is to
use `in-range`, but users need to figure out an appropriate
upper bound, which (1) is error-prone and (2) obscures the intention.
As an example, https://docs.racket-lang.org/pict/Animation_Helpers.html
uses `(in-range 0 1.2 0.2)` to generate `'(0 0.2 0.4 0.6 0.8 1.0)`.
It is also quite common to use `(in-range 1 (add1 n))` to generate
`(list 1 2 ... n)`. Both examples are subpar.

This PR adds `in-inclusive-range` as a counterpart to `in-range`, and
`inclusive-range` as a counterpart to `range`, to make inclusive range
construction easier.

An alternative API is to modify `in-range` to accept a keyword argument
like `#:inclusive? #t`, but this is more verbose and no other sequence
generating function accepts keyword arguments.
Therefore, I think `(in-)inclusive-range` is more appropriate.
2021-04-05 08:02:36 -06:00
Greg Hendershott
b7078dc272 provide-trampoline: Ensure expanded export id has srcloc
1. Forms like rename-out supply the original "export-id" syntax to
make-export as orig-stx, as well as the symbol value as out-sym. In
such a case -- that is, when (eq? (syntax-e (export-orig-stx export))
(export-out-sym export)) -- expand using orig-stx, retaining its
source location and other properties.

2. Otherwise, at least expand using out-sym as an identifier with
srcloc from orig-stx. Rationale: Although that source location might
not be exactly correct it is probably better than none at all.

Note: The spirit of this commit is to treat this as a private
implementation detail -- as opposed to stating some new official API
for renaming provide transformers in general -- so this commit doesn't
update documentation for e.g. `make-export`.
2021-04-05 08:01:41 -06:00
Matthew Flatt
612c1865de cs: ensure cross compile uses same configuration as non-cross
Some compiler settings were previously not carried over to
cross-compile mode, with the consequence that cross-compiled code was
slightly slower.
2021-04-04 15:12:11 -06:00
Matthew Flatt
7013cfb655 cs: configure MSVC Windows build to compress compiled code 2021-04-04 12:41:15 -06:00
Matthew Flatt
589f0e55e4 ffi/unsafe: repair cast from GCable pointer with offset
The repair in 601f4a76e7 did not correctly handle pointers with a
non-zero offset.

Thanks to Bruce O'Neel for the report.
2021-04-04 11:19:12 -06:00
Matthew Flatt
d3f3be5dc5 sqlite3: in ffi, fix _ptr arguments to #:blocking? #t functions 2021-04-04 08:30:43 -06:00