Commit Graph

6065 Commits

Author SHA1 Message Date
Matthew Flatt
b058be9bfc Chez Scheme: clean up "Mf-<unix>" and "<unix>.def"
Replace lots of mostly-duplicated "Mf-<platform>" and "<platform>.def"
files with just a few "Mf-unix" and and "unix.def" files plus
configuration within "configure" and "workarea". Also change
"version.h" to infer more OS details (as was used for pb, anyway).
This change simplifies setting up configurations for different
platforms, and it makes it easier to share among similar
configurations.
2021-04-30 09:08:14 -06:00
Matthew Flatt
0eeb8d26f3 net/url: trim whitespace when getting enviornment variables like http_proxy
For compatibility with other systems, trmi whitespace from environment
variables.

Closes #2663
2021-04-29 11:33:03 -06:00
Matthew Flatt
6f1875c384 bc: fix interaction of prop:object-name and prop:procedure
Document the fact that `prop:object-name` takes precedence for the
`object-name` result, and make printing also use `object-name` instead
of the propcedure's name when they're differet.

Also, repair constructor-style printing of a transparent structure
type that has `prop:object-name`.

Closes #2585
2021-04-29 11:23:15 -06:00
Matthew Flatt
5ae19c56e1 fix submodule loading when a ".zo" file is referenced directly
The default load/use-compiled handler was not consistent with the
default load handler in the treatment of submodules from module files.

Closes #2363
2021-04-29 10:05:11 -06:00
Matthew Flatt
ed115af6b2 windows makefile: fix liblz4.dll linking
Link "liblz4.dll" with the right LZ4 library for /MT mode. It looks
like VS 2017 links anyway, but VS 2015 (and probably earlier) does not
link with the wrong library.

In a normal build, "liblz4.dll" is not needed, but it's linked in case
it turns out to be useful to compress or decompress boot files. A
normal build will construct boot files with the intended final
compression, at least when all the right flags are passed around to
the right places.
2021-04-29 10:05:02 -06:00
Matthew Flatt
a1452ab399 configure: add -lrt for BC on Linux
Linking with `-lrt` is needed for `clock_gettime` on older Linux
distributions.
2021-04-29 08:24:07 -06:00
Matthew Flatt
cfa10d5f30 fix typo in in-value change
Thanks to @yjqww6
2021-04-28 20:29:46 -06:00
Matthew Flatt
bd94ac6b27 fix impersonator-prop:application-mark for keyword arguments
Closes #1836
2021-04-28 17:51:05 -06:00
Matthew Flatt
387f5dc3ba add current-inexact-monotonic-milliseconds
Closes #1826
2021-04-28 17:29:38 -06:00
Matthew Flatt
4eed365e1f class: fix name-conflict checking with local names
Closes #1819
2021-04-28 16:20:08 -06:00
Matthew Flatt
3e9a8ccf59 mixin: fix error-message construction
Closes #1693
2021-04-28 14:30:31 -06:00
Matthew Flatt
94725ffb4e in-value: fix inlined binding
The inlined version of `in-value` in a `for` form did not bind the
left-hand identifier at the right layer relative to other bindings in
`for/fold`, which caused the inlined `in-value` to behave differently
than a non-inlined `in-value`. Confusing about this `in-value`, in
turn, had led to incorrect documentation on `for/fold`.

It would be nice to clean up a little more of the evaluator and
availability of bindings in `for/fold`, but doing so runs a
significant risk of breaking existing code (unlike fixing `in-value`,
which behaved even worse and where the repair seems less likely to
break existing programs).

Closes #1659 (again)
2021-04-28 14:19:50 -06:00
Matthew Flatt
09480c86e8 open-output-file et al.: add #:permissions argument
Add a `#:permissions` optional argument that is a permissions integer
in the same style as `file-or-directory-permissions` and that is used
when a file is created. On Unix, the given permissions are combined
with the process's umask.

Closes #1654
2021-04-28 13:58:12 -06:00
Matthew Flatt
bff31f0768 expander: allow syntax-local-lift-require during #%module-begin expansion
Making `syntax-local-lift-require` during `#%module-begin` expansion
provides a solution to a long-standing problem with composing
languages via `#%module-begin`, where the bindings of some lanuage
should be made available for expanding the module body by
`#%module-begin` expansion (i.e., the language is *not* the initial
import). If the language does not support `require`, then there was no
way to expand and expose the language import dependency.

Closes #1352
2021-04-28 08:30:20 -06:00
Matthew Flatt
f4ccd0fdc6 expander: correct some namespace-mismatch error formats
Related to #1352
2021-04-28 07:13:06 -06:00
Matthew Flatt
8cea33baa1 racket/unitsig: fix location on indirect reference
Set the source location of a function call that implements an indirect
import to be the original identifier, so a use-before-definition error
has the right location.

Closes #1324
2021-04-28 07:13:06 -06:00
Matthew Flatt
bf4fb553b3 raise-syntax-error: accomodate cyclic S-expressions
Closes #1016
2021-04-28 07:13:06 -06:00
Matthew Flatt
613e142447 typo in comment 2021-04-28 07:13:06 -06:00
plan-do-break-fix
0cdede88c3 Chez Scheme: corrects typos in project documentation 2021-04-27 19:43:22 -03:00
Matthew Flatt
6e3a94b6ac openssl: fix waiting on input or output
As noted by @rmculpepper, using an underlying input port as an evt to
indicate more SSL input is not right if data can be pumped from the
underlying input port meanwhile. This commit uses progress evts (real
or synthesized) to avoid that problem.

[The commit include more whitespace changes than I'd normally like,
but it seems like some past tabify went wrong.]

Closes #3804
2021-04-27 12:50:07 -06:00
Matthew Flatt
2f9cd5446b cs: auto-flush stdout/stderr only when terminals
Match BC's long-standing behavior of only flushing the original output
and error ports on input from the original input port when the output
and/or error port is a terminal port.
2021-04-27 11:55:59 -06:00
Matthew Flatt
a385788971 cs: make flush-output error if port is closed
Closes #3803
2021-04-27 09:23:32 -06:00
Matthew Flatt
9ae6d66449 bc: fix sync when a guard-evt turns into choice-evt late
During the time that the procedure in a guard-evt is called by `sync`,
it's possible for the `sync` evt choice to become determined. If the
guard-evt procedure then returns a choice-evt, the BC implementation
of `sync` could lose track of the selected evt; the selection is
represented by an index, and choice-evt splicing can shift indices.

Possibly related to #3004
2021-04-27 08:39:40 -06:00
Matthew Flatt
f4a9058941 stream-{ref,tail,take}: avoid retaining stream for potential error
Although retaining the original stream argument to `stream-ref`,
`stream-tail`, or `stream-take` can enable a better error message if
the stream runs out of elements too soon, it can also interfere with
the intended memory use of a stream.

Closes #2870
2021-04-26 20:03:55 -06:00
Matthew Flatt
a2d724fff6 security-guard-check-network: fix contract
CS was correct, but BC and the documentation were too strict.

Closes #1763
2021-04-26 18:14:00 -06:00
Matthew Flatt
5b66a2e590 racket/rerequire: fix submodule handling
Closes #971
2021-04-26 16:32:08 -06:00
Matthew Flatt
60129ffaca native libs: add CG-with-clipping patch to Cairo
This patch is useful for emoji support on Mac OS.
2021-04-26 16:32:08 -06:00
shhyou
0cff2f6caf ->[*]: Put srcloc on the outermost syntax object 2021-04-26 09:06:41 -05:00
John Clements
b1f84fa60d typo, insert 'to' 2021-04-25 17:16:37 -07:00
Greg Hendershott
b72c11f08b Supply original stx to make-import
Although commit 5b0f0cee23 was sufficient to make `rename-in` expand
to `rename` with srcloc for the original name, it turns out it did not
address a similar issue with `only-in` renaming.

Do so by supplying the original (not renamed) identifier syntax as the
`orig-stx` for `make-import`.
2021-04-23 09:46:09 -06:00
Matthew Flatt
af40cdb7e7 repair struct with same #:name and #:constructor-name identifier
Closes #3791
2021-04-21 11:20:36 -06:00
Matthew Flatt
725a7e353c cs: avoid crash on startup if the working directory does not exist
Closes #3793
2021-04-21 11:07:59 -06:00
Bob Burger
c6608d78d3 Chez Scheme: maybe-compile-program now returns void 2021-04-21 07:54:17 -06:00
Jamie Taylor
17bc9b2b33 Chez Scheme: fix mat that failed in bullyx with cmg=1 2021-04-21 07:53:18 -06:00
Jamie Taylor
b090edbe9d Chez Scheme: update docs on ftype pointer types in foreign-procedure
Now specifies that the ftype pointer parameter types - `(* ftype)` and
`(& ftype)` - actually require an `ftype-name` (i.e., the syntax
requires an identifier in that position). This clarifies the problem
encountered in issue cisco/ChezScheme#557 (although further examples
would be helpful, of course).
2021-04-21 07:52:52 -06:00
Jamie Taylor
e97ae6522c Chez Scheme: add instructions for building docs
[The original commit has been adapted to revised "BUILDING" format.]
2021-04-21 07:52:52 -06:00
Bob Burger
70db865800 Chez Scheme: fix typo in get-process-id documentation 2021-04-21 07:27:12 -06:00
Amirouche
2e8da7ecb7 Chez Scheme: typofix 2021-04-21 07:26:31 -06:00
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
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
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
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
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
Matthew Flatt
4fabc762a5 Racket HISTORY.txt notes for v8.1 2021-04-10 10:19:22 -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
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
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
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
Matthew Flatt
ed8019742c ffi/unsafe: add optional malloc mode to _ptr and _box
The optional mode is probably most useful when 'atomic-interior is
needed in combination with a `#:blocking? #t` function.
2021-04-04 08:24:06 -06:00
Matthew Flatt
dcaf358c64 cs: add malloc support for 'interior mode
Since immobile vectors now exist at the Chez Scheme level, it's easy
to support 'interior mode (similar to 'interior-atomic).
2021-04-04 07:51:34 -06:00
Matthew Flatt
601f4a76e7 ffi/unsafe: fix cast from _bytes to _pointer
The `cast` function is supposed to auto-promote its second argument to
a GCable type if the value to convert is a GCable pointer. This
promotion did not happen for `_bytes` and other string-like types.

Also, in CS, `malloc` did not alocate GCable memory by default when
given the `_bytes` type, which would sometimes interfere with getting
a GCable pointer result.

This bug explains why the "draw-test/tests/racket/draw/dc.rkt" test
would occassionally have an `unscaled-alpha-set` failure on DrDr (for
many years).
2021-04-02 10:32:40 -06:00
Matthew Flatt
181b9c80ac add syntax-serialize and syntax-deserialize
The new functions provide a more direct way to serialize and
deserialize syntax objects than compiling and running a `quote-syntax`
form. The new functions also offer additional configuration related to
preserving extra syntax properties and limiting the use of shared
"bulk binding" tables (i.e., tables that must provided by module
declarations in the namespace).

This change does not add syntax-object support to `serialize` or
`s-exp->fasl`, because serialized syntax objects are still in many
ways like code: they are version-specific, and their invariants can be
broken by mangling the serialized form (in much the same way that
compiled code can be broken by mangling, and with similar safetly
implications).
2021-04-01 08:05:51 -06:00
Matthew Flatt
2606ae3d8e raco pkg: add support for "git+http[s]://" package sources
When referring to a Git repo with a "https://" URL, the URL must end
with ".git" to distinguish the URL for directory and file URLs. A
"git+https://" URL specifies that the Git-over-HTTP protocol should be
where the URL cannot contain ".git". For example, SourceHut URLs do
not include ".git" (while hosting services like GitHub or BitBucket
allow ".git" to be in the URL).

When using `raco pkg`, it was possible to specify `--type git` for an
"https://" reference, but for consistency and internal tracking, a
".git" would be added to the URL, anyway. Using `--type git-url` can
similarly force the interpretation of an "https://" reference without
triggering the addition of ".git". The new state is mostly internal,
but it is reflected in the output of `raco pkg show`, which shows
`git` for such references (as opposed to `url` as shown for others).
2021-03-31 13:29:42 -06:00
Ryan Culpepper
9a4f9688ad db: fix custom functions for blocking sqlite3_step change
Also fix error reporting for aggregate functions.
2021-03-30 10:15:12 +02:00
Ryan Culpepper
d65e648d6a db: mark sqlite3_step and sqlite3_prepare* as blocking
This allows the GC to run during these ffi calls. It is probably only
worth marking often-used, potentially long-running calls.
2021-03-30 09:06:35 +02:00
Bogdan Popa
6535f4f2b8 xexpr: add current-unescaped-tags to disable escaping for certain tags 2021-03-29 11:38:16 -04:00
Bogdan Popa
1a1018d9fe rumble,error: fix error case when given a field with no value
Closes #3744
2021-03-29 07:03:38 -06:00
Matthew Flatt
920e3dbde5 cs: repair async-apply handling for foreign callbacks
The CS implementation was missing a level of indirection. It worked
for a typical handler `(lambda (thunk) (thunk))` for the case when the
callback can run atomically, but it did not work for caces where
`thunk` is made to run later (potentially out of atomic mode).

Also, fix the management of interrupt state, including for some place-
and future-related asynchronous callbacks.

Thanks to @rmculpepper for the `async-apply` report, new `async-apply`
tests, and the repair for the interrupt-state bug.
2021-03-28 20:18:56 -06:00
Matthew Flatt
e31003b0ad racket/stream: unbreak chained lazy streams
The new implementation attempting to collapse lazy streams was broken.
2021-03-27 08:23:55 -06:00
Matthew Flatt
a5615a7bae racket/stream: add more control over laziness
Add `#:eager` options to `stream-cons` to control whether the head
and/or tail expression is delayed. Also add `stream-lazy` to
explicitly construct a lazy stream and `stream-force` (normally not
needed) to force a stream.

Delayed expressions in `stream-cons` are now non-reentrant, like
promises created by `delay`. This is a change in behavior, but I'm
hoping that no one relied on the old behavior, which has the bad
property that the delayed expression is retained until its result is
received.

For consistency, this commit also changes `stream*` to delay the
stream-construction expression when its the only one expression that
is given.

Internally, changes to the stream implementation reduce allocation.

The `stream-lazy` form would be more natrally called `stream-delay`,
but that creates a conflict with existing packages.
2021-03-26 19:52:42 -06:00
Matthew Flatt
4704dc6962 makefile: fix RACKET_FOR_BOOTFILES 2021-03-26 10:43:40 -06:00
yjqww6
4328b3acdb fix signatures of $fx+? and $fx-? 2021-03-26 15:07:51 +08:00
Alex Knauth
5c2949d051
add make-struct-type-property/generic and make-generic-struct-type-property (#3627) 2021-03-25 19:44:40 -04:00
Matthew Flatt
cd2d5f0ac7 cs: fix some error-message formatting
Some Chez Scheme error messages were not converted correctly,
leaving the values to be printed by Chez Scheme's printer.
2021-03-23 16:41:30 -06:00
Brian Adkins
f65560ed4c Optimize when sep is unspecified or the default regexp 2021-03-23 16:16:07 -06:00
Brian Adkins
754b3457c3 Verify the argument is a string?
For the fast path of splitting on whitespace, verify the str
argument is a string, so that internal-split will handle the
invalid argument error.
2021-03-23 16:16:07 -06:00
Brian Adkins
d061df81ce Optimize splitting strings on whitespace
Use an optimized function, instead of regexp-split, when string-split
is called with the default separator and trim setting.
2021-03-23 16:16:07 -06:00
Matthew Flatt
2a718d8162 Chez Scheme: repair for cross-library inlining
The cross-library inlining improvement in commit 6020b944ef did not
manage internal names correctly, and it could mix up bindings that
have the same printed form.

Closes racket/ChezScheme#35
2021-03-23 15:33:10 -06:00
Matthew Flatt
281eed7dda Chez Scheme: fix some typos 2021-03-23 13:42:05 -06:00
Gustavo Massaccesi
61cca93086 Chez Scheme: improve eq[v]? reductions in cptypes
Improve eq? and eq? handling to reduce expressions like
(eq? (newline) (void)) => (begin (newline) #t)
2021-03-23 15:14:56 -03:00
Gustavo Massaccesi
355b9f51be Chez Scheme: fix too much propagation of numbers in cptypes
In this example, after the check with eq? or eqv? the value of
the variables x and y are known, so cptypes replaced the
reference to the variable with it. But it can interact badly
with the eq? test, for example in this case the first (eq? x y)
can be #f and the second be reduced by the compiler to #t.

In spite eq? cannot be used to compare numbers reliably, this
behavior is too confusing and it's better to avoid it.

(define (one)
  (let ([r (random 2)])
    (if (= r 0) (one) r)))

(define (f x y)
  (define first-comparison (eq? x y))
    (when (and (eqv? x 7.0)
               (eqv? y 7.0))
      (define second-comparison (eq? x y))
      (eq? first-comparison second-comparison)))

(f (+ 6.0 (one)) (+ 6.0 (one)))))
2021-03-23 15:14:56 -03:00
Matthew Flatt
ef0ff679d0 correct some hash-table locking cases
BC did not take a lock for `hash-clear!`. Maybe the intent was that a
lock isn't needed from the perspective of `hash-clear!` when it isn't
traversing the table, but failing to take a lock before modifying the
table can break other operations (that do take a lock) in progress.
Furthermore, some iterations that intentionally did not take a lock
also did not guard against changes well enough. Various repairs here
avoid crashes, and now `hash-clear!` consistently takes a lock.

CS had a similar (but more subtle and more limited) instance of the
problem in `hash-map` and `hash-for-each`. That problem is corrected
(without adding any new lock acquisitions).

The existing CS implementation of `equal-hash-code` for hash tables
takes a lock more than the BC implementation. A possibly surprising
result: when attempting to add a mutable hash table to itself as part
of a key, the `hash-set!` can block forever on the hash table's lock,
instead of doing something more random as a result of having a mutated
key. The documentation now notes that possibility.

Related to #3738
2021-03-21 13:03:17 -06:00
Ryan Culpepper
8bf8e3cf82 db: fix error case for disconnect in lock 2021-03-20 18:27:55 +01:00
Ryan Culpepper
5f66fad355 db: fix check for recursive lock acquire 2021-03-20 18:27:55 +01:00
Ryan Culpepper
815910b419 db: fix lock for non-escaping hopeless callbacks 2021-03-20 18:27:55 +01:00
Matthew Flatt
a099e18767 sync generated files 2021-03-19 15:11:23 -06:00
Matthew Flatt
206577d701 vector->pseudo-random-generator[!]: accept impersonated vectors 2021-03-19 15:02:30 -06:00
Matthew Flatt
a50aa9d164 cs: repair for callbacks that might throw exceptions
The callable used to trigger stack unwinding was unlocked during
initialization, but it shouldn't be.
2021-03-19 07:49:28 -06:00
Gustavo Massaccesi
3952355d30 Chez Scheme: add suport for lists in cptypes
With list-assuming-immutable? and the internal construct
immutable-list the compiler can assume that some lists will
not be mutated.

Also, change the definition of interned-char?, because in CS all chars
are interned.
2021-03-19 09:19:27 -03:00
Gustavo Massaccesi
993b86ffa3 Chez Scheme: fix test in date.ms 2021-03-18 09:55:15 -03:00
Matthew Flatt
3244fa7a3c normalize error message for mem{ber|q|v}
Restore roughly the old error message for BC, but also adjust it to
use the modern error-message style (with newlines).
2021-03-17 19:52:26 -06:00
Robby Findler
274e4b95b1 give the binding that is introduced to be renamed on provide a source
location so it can be the target of jumps from other files

related to #3733
2021-03-17 19:55:53 -05:00
Matthew Flatt
e2cbd9bd73 fix "non-pair" error message for ass{oc,q,v,f} 2021-03-17 14:16:29 -06:00
Matthew Flatt
d0feb5c75a move memq and memv back to core
This commit partly reverts c305dba649 and 88fc9a979f, which was
discusssed in #366.

The original discussion was about allowing an extra argument to
`member` to pick the equality predicate. That change is still in place
in the same (private) Racket module.

The `memq` and `memv` functions are in Scheme for Racket CS and back
to being and in C for Racket BC. The old motivation for moving `memv`
and `memq` --- to get them out of C --- is subsumed by the switch to
CS (granting that some C code got added back to BC meanwhile). The
advantage of moving `memq` and `memv` back to the runtime core is that
the compiler can do more with them, at least in CS.

When `memq` and `memv` were moved previously, they lost checking for
cyclic lists. That wasn't discussed and presumably wasn't on purpose;
check is restored here, including for `member`.

There's no significant performance change in CS, except in cases like
`(memq x '(a b c))` that the compiler unpacks into a combination of
`eq?`s. For BC, the C version is a little faster (10-40%, depending on
the length of the list), but still slower than CS (probably because
`pair?` is slower, which due to representation differences).
2021-03-17 13:36:40 -06:00
Matthew Flatt
db34c62241 schemify: propagate 'compiler-hint:cross-module-inline through values
This change makes

 (begin-encourage-inline
   (define-values (f g h) (values e1 e2 e3)))

equivalent to

 (begin-encourage-inline
   (define f e1)
   (define g e2)
   (define h e3))
2021-03-17 13:33:04 -06:00
Sam Tobin-Hochstadt
4a65dfb1aa Use dd-parse to parse ... patterns inside quasipatterns.
Related to racket/typed-racket#1055.
2021-03-16 21:44:27 -04:00
Matthew Flatt
5058dc5a1a Chez Scheme: fix make-date and date-nanosecond signature 2021-03-16 08:26:06 -06:00
Matthew Flatt
a5db4bf376 Chez Scheme: fix make-time type signature
On a 32-bit platform, the nanosecond argument is not always a fixnum.
2021-03-16 07:47:45 -06:00
Matthew Flatt
a484cd76e5 cs & thread: fix problem with place initialization
The `current-place` place-local variable was initialized relatively
late in the set of place-creation steps. It was possible for the
thread scheduler to get involved before `current-place` was set ---
and in that case, it was possible for semaphores and Racket threads to
end up being used in the wrong place.
2021-03-15 13:51:16 -06:00
Matthew Flatt
c0cfd32bcb Chez Scheme: move cp machine-register indirection
Register allocation needs fresh machine-register state for each
compilation, and that was previously implemented by allocating a new
register record and indirecting references through a parameter. Move
the indirection to the places where conflict-set, index, and precolor
state is manipulated, and pass a state vector though to keep access
efficient. This change makes compilation slightly faster, and it makes
registers easier to work with by not having to introduce
indirections/delays in various places for register references.
2021-03-14 12:10:05 -06:00
Matthew Flatt
467ca64a7f Chez Scheme: split cpprim out of cpnanopass
Moving the np-expand-primtives pass to a separately compiled source
file reduces peak memory use when compiling Chez Scheme from about 1.3
GB to about 0.7 GB on a 64-bit platform. It's also nice from a
code-navigation perspective to split a 19k-line file to a 10k-line
file plus 8k-line file (and some additional small files).

The overall time for Chez Scheme to compile itself is only slightly
affected, even though some support functions, macros, and record
declarations end up getting compiled twice.
2021-03-14 07:39:55 -06:00
Bob Burger
31358698f3 Chez Scheme: sleep of non-positive duration now returns immediately
A negative duration would previously result in an infinite pause in
Windows.
2021-03-13 11:05:51 -07:00
Matthew Flatt
5e1df80a00 unixstyle-install: adjust DESTDIR fixup for "lib" executables with a suffix
More generally, make the path-fixup step insensitive to specific
filenames in the "lib" directory, making it more like the handling of
the "bin" directory.
2021-03-13 10:12:05 -07:00
Gustavo Massaccesi
a6e77a1a0c Chez Scheme: Add more maybe-* and eof/* types
The logic was added in the previous commits, but it's necesary to add
the mapping from the names in primdata to cptypes.

Also add a few subsets of fixnum.
2021-03-13 11:20:02 -03:00
Matthew Flatt
6f58ef5458 make embedding wrapper executable less sensitive to argv[0]
Running a `starter`-based executable with an argv[0] different
than the executable's path can make sense in various situations, but
it doesn't work for finding code embedded in the enxecutable. On
platforms where it's possible to get the current process's executable
(not looking at you, OpenBSD), then use that instead of argv[0] for
the purposes of loading embedded code.

Related to #3685
2021-03-12 20:08:53 -07:00
Matthew Flatt
4a06e4a1e3 Chez Scheme: remove before install
Removing the old executable before copying a new one in place avoids
problems on ARM Mac OS, at least.
2021-03-12 20:08:53 -07:00
Ismael Luceno
44964359ae Chez Scheme: fix missing include in externs.h
The correct header is needed to build with musl.
2021-03-12 19:50:40 -07:00
Robby Findler
288d13b85a add blame-replaced-negative? 2021-03-11 17:02:53 -06:00
Gustavo Massaccesi
3d04b71ced Chez Scheme: add maybe-char to cptypes
chars are immediates, so the previous change doesn't add automatically
the combinations like maybe-char. Add also eof/char that is commonly
used and has the same problem.

And rename in ctypes the internal symbol $immediate/true to
true-immediate because in all the other instances / is used for unions.
2021-03-10 14:27:00 -03:00
Matthew Flatt
8ba89cbd2a Chez Scheme: avoid floating-point register shuffling on x86_64
For floating-point arithmetic, encourage the register allocator to use
the same register for an argument and destination in arithmetic.
2021-03-09 17:36:21 -07:00
Matthew Flatt
5a2b6aab1e Chez Scheme: update docs for expand/optimize and run-cp0
Mention that it runs cptypes.
2021-03-08 09:55:45 -07:00
Matthew Flatt
75ba7ff5bc cptypes: discard call form around an error, better cm support
An an example of better error handling,

 (f (error 'x "x") y x)

turns into

 (error 'x "x")

which may allow further propagation through `begin` and `if` as
alerady implemented.

Also, make cp0 and cptypes more aware of
`call-{setting,getting,cosuming}-continuation-attachment` in terms of
result types and single-valuedness. The single-valued part requires
some generalization to the existing `single-valued?` support (by
default, "single-valued" => "doesn't inspect/changed immediate mark")
in both cp0 and cptypes.

Finally, the "optimize.rktl" test suite is now enabled for Racket CS.
The tests helped expose some missed opportunities and bugs, and it
should be particularly helpful going forward, since we're back to
having a place for Racket-level optimization tests. Not all tests
written for BC pass with CS. Grep for 'chez-scheme for missed
optimization opportunities.
2021-03-08 09:10:18 -07:00
Matthew Flatt
73eeff4f60 fix problems with continuation-mark-key chaperones
CS: When `with-continuation-mark` for a chaperoned key is in tail
position for a mark (such as a `parameterize`), make sure the existing
mark is still in place while (non-tail-)calling the chaperone's
interposition function.

BC: Don't collapse immediately nested `with-continuation-mark`s for
the same key if the key might be chaperoned. Also, repair treatment of
module-level bindings as potentially chaperoned.
2021-03-07 20:08:49 -07:00
Matthew Flatt
87d84a59c1 cs & schemify: cptypes-nice inline of authentic access and mutate
Change schemify to inline accessors and mutators of authentic
structure types in a way that lets cptypes eliminate checks for
subsequent operations.
2021-03-07 19:11:21 -07:00
Matthew Flatt
9651b45c83 cs & schemify: fix inlining that fold to #f
When the schemify inliner tries to inline, and inlining is supposed to
succeed with a result expression `#f`, the #f was being treated as a
failure to inline.
2021-03-07 16:55:18 -07:00
Philip McGrath
e45cd87511 version/check: use https; actually enforce timeout; guard reading params
Also, add an environment variable for testing purposes
and document the fact that `check-version` may block.
2021-03-07 11:12:57 -05:00
Bogdan Popa
81e0c86fc3 pkg: show bad deps in check-dependencies 2021-03-07 07:37:42 -07:00
yjqww6
b4d05e7a41 add [unsafe-]assert-unreachable 2021-03-07 06:48:50 -07:00
Matthew Flatt
fac8463082 cs: fix raco exe for OpenBSD
The repair involvea adding a `-E` flag to Racket for use by the wrap
executable that `raco exe` created, because OpenBSD (intentionally)
does not have a way to access the executable file of the current
process.

Closes #3717
2021-03-07 05:03:50 -07:00
Matthew Flatt
a3bf702ac9 cs & io: fix simplify-path for 'up relative to a root
Closes #3716
2021-03-06 09:37:10 -07:00
Matthew Flatt
07c7ff51ff repairs for NetBSD 2021-03-06 09:37:10 -07:00
xxyzz
d03456b55e
Skip keywords in invalid-option-placement (#3621)
Close #3603

* skip keywords in invalid-option-placement
* replace check-duplicate with check-duplicates
* add skip keywords test
* add require and fix syntax-e error
* update comment of invalid-option-placement
* add mixture keywords and arguments test
* forget to skip keyword in loop
* and another two tests for syntax-parse
* define splicing-formals-no-rest as @Metaxal suggested
* add formals link
* rename splicing-formals-no-rest to formals-no-rest
* add attributes to formals
* remove racket/dict import
2021-03-06 00:55:52 +01:00
Matthew Flatt
076426e796 unbreak unzip
Commit 71b7f21fdb changed the scope of a shadowing binding.
2021-03-03 09:29:10 -07:00
Matthew Flatt
a5b61f7ac8 unzip: add option to insist on a zip archive
The fact that a non-zip archive has always been silently ignored seems
bad, but adding an error might break code that (probably accidentally)
relies on the behavior. This change makes sane behavior at least
available by adding a `#:must-unzip?` option.

Relevant to #3613
2021-03-03 09:07:06 -07:00
Matthew Flatt
71b7f21fdb unzip: avoid blocking on break exception
The `dynamic-wind` that causes problems dos not appear to be needed.

Closes #3703
2021-03-03 08:20:41 -07:00
Matthew Flatt
1e56ca9cc1 treat uname result as locale encoding instead of UTF-8 2021-03-03 07:06:07 -07:00
Philip McGrath
261d73abdb racket/src/cs/c/Makefile.in: use $(SHELL) rather than hard-coded /bin/sh
This change facilitates building in environments where `/bin/sh` is not
available, such as Nix and GNU Guix.
The GNU Autoconf manual lists several additional systems where `/bin/sh`
is either missing or not POSIX-compliant:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/The-Make-Macro-SHELL.html

Related to https://github.com/racket/racket/issues/3707
2021-03-03 07:04:51 -07:00
Philip McGrath
fdb2ad7892 Chez Scheme: avoid hard-coded paths for utilities in build scripts
These changes facilitate building Chez Scheme in environments where
utility commands are not available at their usual absolute paths,
such as Nix and GNU Guix.

Specific changes:
  - `cc` -> `$(CC)`
  - `/bin/rm` -> `rm`
  - `/bin/ln` -> `ln`
  - `/bin/cp` -> `cp`
  - `/bin/echo` -> `echo`
  - in `makefiles/installsh`, add a case to find `true`
    at an unusual path or as a shell builtin

Related to https://github.com/racket/racket/issues/3707
2021-03-03 07:04:51 -07:00
Matthew Flatt
5114fec2c7 file/resource: support REG_EXPAND_SZ
Also, provide workarounds for some broken conversions --- especially
the 'string/utf-16 conversion for reading. For writing, allow
specifying raw bytes that end up in REG_SZ or REG_EXPAND_SZ via
'bytes/string or 'bytes/expand-string.
2021-03-03 06:41:16 -07:00
Matthew Flatt
e615294e78 change (system-type 'machine) to use C-library uname
Thanks to @LiberalArtist for pointer out that uname(3) exists!

Related to #3707
2021-03-02 17:33:27 -07:00
Matthew Flatt
afe522ab9c find-executable-path: avoid conversion of PATH to string
Send bytes directly to `path-list-string->path-list`, since it can
handle bytes and convert directly to paths. Also check that the
argument to `path-list-string->path-list` has no nul character or byte.
2021-03-02 15:51:53 -07:00
Gustavo Massaccesi
421dce228d Chez Scheme: add maybe predicates to cptypes
Actually, use a more general decomposition with a part for an
$immediate, a part for a $record and a third part for other types
like string?, vector?, ...

This is not as general as an arbitrary union, but it is enough for
the common cases, and also to handles the common objects in Racket
that are implemented in CS as the corresponding object and a record
for the impersonator.
2021-02-28 17:05:20 -03:00