Commit Graph

5118 Commits

Author SHA1 Message Date
Matthew Flatt
7a95ff3dd4 bc: fix log-message handling of prefix-message? argument
Closes #3168
2020-05-09 09:39:00 -06:00
Matthew Flatt
fae20b4b89 3m: add missing lock in write barrier
When a future triggers a write barrier, a lock is needed to prevent a
race between the future thread and other threads in the same place (on
most platforms).

Thanks to Dominik Pantůček for tracking down this bug.
2020-05-09 07:43:15 -06:00
Ben Greenman
098d4c789a file->x: ignore file-size errors 2020-05-08 08:27:33 -04:00
Ben Greenman
d52c845454 racket/file: check file-exists?
Check `file-exists?` before passing the file on to `file-size` and/or
`open-input-file`. The latter led to confusing error messages, e.g.:

```
(file->string "DNE")
;; file-size: cannot get size
```

affects: `file->value` `file->list` `file->string` `file->bytes`
 `file->lines` `file->bytes-lines`
2020-05-08 08:27:33 -04:00
Marc
c75881096a
Switch /replacement and /our-replacement names (#3103)
The call to `random-sample/replacement` gets called when `(not
replacement?)` holds, while `random-sample/out-replacement` gets called
otherwise.

This is probably because the algorithm for the without replacement case
actually replaces parts of the sample, but that is different from the
meaning of a sample with and without replacement, which means with
possible duplicates or without.
2020-05-08 12:58:27 +02:00
Matthew Flatt
b8f5216376 bc: fix potential GC problem with continuation invocation
Avoid updating the continuation-mark pointer until after the set of
mark segments is allocated when more segments are needed.
2020-05-07 16:18:25 -06:00
Sorawee Porncharoenwase
52b5f1864f Fix #1399: fix struct-copy bugs by exploiting struct-info
This PR fixes four bugs:

1. Accessors are required at use-site in order to use `struct-copy`.
This PR removes that requirement since the information is already available in
struct-info. The following program used to fail prior the PR but will now pass.

```

(module a racket
  (provide a)
  (struct a (b)))

(require 'a)
(struct-copy a (a 1) [b 2])
```

2. `struct-copy` fails if the structure type transformer binding is renamed
(#1399). The following program used to fail prior the PR but will now pass.

```

(module struct racket/base
  (provide (struct-out point))
  (struct point (x y) #:transparent))

(require (rename-in 'struct [point point2d]))

(struct-copy point2d (point2d 1 2) [x 3])
```

3. With supertype, it's possible to construct colliding accessors,
causing `struct-copy` to update an incorrect field. The following program
produced incorrect outputs prior this PR but will now be correct.

```

(module a racket
  (provide a)
  (struct a (b-c) #:transparent))

(require 'a)
(struct a-b a (c) #:transparent)

(struct-copy a-b (a-b 1 2) [b-c #:parent a 10])
;; before the PR: (a-b 1 10), after the PR: (a-b 10 2)
(struct-copy a-b (a-b 1 2) [c 10])
;; before the PR: (a-b 1 10), after the PR: (a-b 1 10)
```

4. Similar to 3., prior this commit, it's possible to refer to a bogus field
name when supertype is present. The following program doesn't result in
a syntax error which is wrong. This commit fixes that.

```
(module a racket/base
  (provide (all-defined-out))
  (struct a (b-c) #:transparent))

(require 'a)
(struct a-b a (d) #:transparent)
(struct-copy a-b (a-b 1 2) [c 10])
```

The key idea is that the actual struct name (if the struct is created via
`struct` or `define-struct`) can be extracted from the name of struct predicate.
The actual field names then can be precisely extracted from accessors.

Note that struct-infos that are created manually by `make-struct-info`
didn't work with `struct-copy`. This PR didn't attempt to fix that because
it requires a significant change that would not be backward compatible with
the current struct info.
2020-05-07 11:46:34 -04:00
Matthew Flatt
1bef5a6927 openssl: defer erorr logging when no x509 root sources are not found
Instead of logging an error when the `openssl` module is loaded, defer
a complaint until procedures that would depend on the configuration is
called. Otherwise, errors can get printed in programs that depend on
the `openssl` library but do not always need OpenSSL support at run
time.
2020-05-05 07:05:28 -06:00
Matthew Flatt
83f27f637b openssl: ssl-dh4096-param-path -> ssl-dh4096-param-bytes
This is a backward-incompatible changed, but no packages currently
registered at pkgs.racket-lang.org refer to `ssl-dh4096-param-path`.

Providing `ssl-dh4096-param-bytes`, instead, avoids carrying along an
extra file with any stand-alone executable that depends on `openssl`.
2020-05-05 07:05:15 -06:00
Matthew Flatt
f57aa0b90f improve docs and raco distribute about stand-alone executables
The `--orig-exe` flag is more useful than the documentation suggested,
and `raco distribute` now treats those executables better.
2020-05-04 15:10:15 -06:00
Matthew Flatt
cf4691ee87 cs: fix allocation mode for _string/utf-16
Closes #3153
2020-05-04 07:18:05 -06:00
Matthew Flatt
cdc32cdfeb cs: repair build via source distribution 2020-05-03 13:41:04 -06:00
Matthew Flatt
c59f72f101 bc: reserve GC parking spaces for place-main thread
Don't try to park values when allocating a weak box or pair in a
future thread, since that creates a race on the parking spaces. A
future thread can't run a GC, so it's doesn't need to park.

Touching a future in a future allocates a weak box, so this bug could
have been responsible for many crahses.

Related to #3145
2020-05-02 08:45:14 -06:00
Sam Tobin-Hochstadt
303b410bc7 Recent GMP is under LGPL v3.
Update GMP license statment following 392dc33ceb which comes from
a recent GMP version.

This does not affect the overall license situation of Racket BC,
which includes other LGPL v3 code, or of Racket CS, which does not
use GMP.
2020-05-01 22:26:25 -04:00
Matthew Flatt
61cefe693a cs: support raco exe --embed-dlls on Windows
Uses a MemoryModule PR by @DaLynX to fix a setjmp/longjmp
interaction with embedded DLLs.
2020-05-01 20:07:24 -06:00
Matthew Flatt
fffdeeddd2 move known-done subprocess from custodian
The `call-with-deep-time-limit` function in `racket/sandbox` expects a
subprocess to be removed from its custodian when the subprocess is
done. CS wasn't doing that at all, leaving custodian removal to a
finalizer. BC was doing delaying a remove until `subprocess-status` is
used (which happened to work for existing uses of
`call-with-deep-time-limit`, apparently.)

Relevant to #3140
2020-05-01 11:17:49 -06:00
Matthew Flatt
d358a4135b cs: prinitng for unsafe-undefined
Although `unsafe-undefined` should never arrive at a printing
function, handle it a little better if it smoehow does.
2020-04-29 09:34:25 -06:00
Matthew Flatt
1646d294fd schemify: fix potential "optimization" of too-early use
The part of schemify that checks for simple bindings was not keeping
track of when it should be checking for only simple procedure forms.
2020-04-29 08:55:17 -06:00
Matthew Flatt
58371b95d4 ffi/unsafe: add malloc-mode option to _list and _vector 2020-04-28 16:19:33 -06:00
Matthew Flatt
d7f0809490 cs: react to (collection-garbage 'incremental)
When incremental mode is enabled, adjust garbage collection to avoid
promoting objects from the next-to-oldest generation into the oldest
generation. This change produces a good approximation to incremental
collection for game-like programs (although probably not server-like
programs with large, temporary jobs).
2020-04-28 13:25:54 -06:00
Matthew Flatt
a4b5fe5b78 cs & regexp: fix incorrect request for extra bytes
When trying to match "\r\n" on an input port, for example, don't
insist on peeking a second byte if the first one already isn't "\r".

Closes #3132
2020-04-27 15:00:14 -06:00
Matthew Flatt
8eab18465c update "racket/HISTORY.txt" for v7.7 2020-04-26 08:47:05 -06:00
Matthew Flatt
1d41f0c5b8 cs: implement list? with list-assuming-immutable?
Use new support from Chez Scheme for constant-time `list?`.
2020-04-25 15:54:30 -06:00
Matthew Flatt
aeb1786476 cs: fix interaction of error-print-with and prop:custom-write
Closes #3108
2020-04-24 17:26:24 -06:00
Matthew Flatt
05dfd85853 cs: repair position-based struct accessor/mutator
Fix error checking and reporting for position-based struct accessors
and mutators. Also, fix mutability recording for prefab structure
types that have auto fields.

Related to racket/typed-racket#902
2020-04-24 11:30:14 -06:00
Matthew Flatt
40045ce1a6 expander: add missing available-module trigger
Repairs `(dynamic-require module-path (void))`.

Related to #3128
2020-04-24 09:24:19 -06:00
Matthew Flatt
db1d1916b5 cs: fix a semi-leak for places
The most recently created place's data could be retained
after the place terminated.
2020-04-23 15:27:21 -06:00
Matthew Flatt
f5a4180803 cs: fix a leak in plumbers
Who plumbs the plumbers?
2020-04-23 15:27:21 -06:00
Matthew Flatt
2d14996156 unbreak no-places, no-futures build
Also, update GC logging for CGC to be consistent with other variants.
2020-04-23 07:21:41 -06:00
Paulo Matos
362edb00de
Check that file specified by --enable-racket exists (#3118) 2020-04-22 23:22:19 +02:00
Matthew Flatt
9358ebc97d cs: fix peak-memory logging
That number shouldn't be negative, but print it right in case it is.
2020-04-22 14:39:08 -06:00
Matthew Flatt
7c7d514f73 cs: fix glib logging callback
Commit 16ad9ed522 removed a `lock-object`, but that's only ok as long
as the callable is retained (which is better than using
`lock-object`).
2020-04-22 14:39:08 -06:00
Georges Dupéron
d09ce588bf Allow dotted list syntax for match expanders, e.g. (match v [(some-match-expander a b c . d) (displayln (list a b c d))])
Closes #1438.
2020-04-22 14:10:59 -04:00
Matthew Flatt
16ad9ed522 cs: use new immobile-object support
Implement 'atomic-interior allocation and immobile cells using
`make-immobile-bytevector` and `make-immobile-vector`, which avoids
having to unlock through a finalizer.

Also, the Chez Scheme GC can now mostly mark a major generation,
instead of copying it, which can significantly reduce memory
use during a GC for an old, large heap (such as DrRacket's).
2020-04-22 07:19:38 -06:00
Matthew Flatt
dccd841adf adjust peak-memory logging
Show peak administrative as a parenthesized delta on peak space.

For BC, this extra delta is small, because BC compacts (instead of
copying) old-generation objects. For CS, the extra delta can large ---
typically an extra 50%, but potentially another 100% --- because a
full collection copies all old-generation objects.

Also, for BC, fix cumulative-allocation reporting to include child
places.
2020-04-22 07:19:38 -06:00
Sam Tobin-Hochstadt
859e7b4373 Avoid unnecessary use of fprintf.
Closes #3113.
2020-04-21 18:35:04 -04:00
Paulo Matos
392dc33ceb
Update gmp invert_limb from arm (#3111)
Extract invert_limb code for ARM from GMP 6.2.
In order to check for thumb mode availability use defined macro `__thumb__`, which in turns requires us to process the source file with `gcc` instead of `as` in order to access the preprocessor - tested with `clang` as well.

Fixes #3050
2020-04-21 07:12:05 +02:00
Paulo Matos
876aff85c2
Constrain the values of a and b in function not to be both NULL (#3106)
Fixes #2686
2020-04-17 21:55:17 +02:00
Matthew Flatt
734491b511 configure: fix unix-style configuration with --prefix
Closes #3046
2020-04-17 12:05:21 -06:00
Matthew Flatt
fb677d9569 cs: sync with Chez Scheme update
The Chez Scheme change avoids a leak while collecting in counting
mode, which is used by Racket's memory-accounting mode.

Also, add a small repair for 4256214981.
2020-04-16 17:25:04 -06:00
Matthew Flatt
8145434fa7 cs: small memory-accounting simplification
Remove an unneeded accounting hook.
2020-04-16 13:44:43 -06:00
Matthew Flatt
4256214981 cs: repair retention of a custodian with a memory limit 2020-04-15 17:25:23 -06:00
Matthew Flatt
d685c835f9 expander: fix reader demo 2020-04-14 08:14:56 -06:00
Matthew Flatt
9c53358035 raco pkg catalog-archive: revert bad change
Unchanged with respect to state database is still changed with respect
to the catalog being constructed!
2020-04-12 14:05:25 -06:00
Matthew Flatt
3d9d12a4d6 raco pkg catalog-archive: avoid writing non-changed information 2020-04-12 13:54:15 -06:00
Sam Tobin-Hochstadt
803f235c30 Use new URL for GitHub tarballs.
GitHub switched URLs for tarballs, redirecting to the new one with
a 302. However, old versions of Racket don't follow redirects in
`raco pkg install`, so they broke (before 6.3). Using the new URL
should work for everyone.

Reported by @greghendershott.
2020-04-12 15:22:05 -04:00
Matthew Flatt
7ed8ea040e raco pkg catalog-archive: support platform-specific dependencies 2020-04-12 11:19:18 -06:00
Matthew Flatt
5df1b7906b raco pkg archive-catalog: add --include and --exclude
Also `--include-deps`, which support the creation of a catalog archive
that is restricted to a specific set of packages. Also
`--fast-file-copy`, which is usefl for speeding up a pipeline of
archiving (helpful to pkg-build).
2020-04-12 05:26:40 -06:00
Matthew Flatt
1b48cd86f9 net/url: add #:method argument to get-pure-port/headers
Supports HEAD with redirections, for example.
2020-04-12 05:26:40 -06:00
Robby Findler
7f9784775f fixes a bug in case->, closes #3098
also use the contract equivalence predicate instead of
two calls to contract stronger
2020-04-09 15:53:59 -05:00