Commit Graph

41059 Commits

Author SHA1 Message Date
Matthew Flatt
6d06086dad cs makefile: preserve permissions when embedding boot files
Closes #3192
2020-05-19 09:54:52 -06:00
Matthew Butterick
e8e3b61547
Docs: update link to Objective-C runtime 2020-05-19 08:28:06 -07:00
Matthew Flatt
2988917f03 cs: send immutable byte strings to custom output ports
Related to #2726
2020-05-18 17:45:14 -06:00
Matthew Flatt
61b365f4be add unsafe-X->immutable-X! for vectors, strings, and byte strings
Follows up on an idea by @gus-massa in #1219, because this will be
useful to fix a problem with Racket CS I/O.
2020-05-18 17:41:40 -06:00
Matthew Flatt
0f4a947bab bc: add stack-overflow checking in part of the optimzier
Related to #3190
2020-05-15 14:51:17 -06:00
Matthew Flatt
2f22a5638d windows: finer granularity for sleep
The Windows scheduler tends to work on 16ms bounaries, which
is not good for sleeping (as part of an animation, say) for
times near or less than 16ms. Change rktio to request more
fine-grained scheduling temporarily when trying to sleep for
a short time.
2020-05-15 06:57:33 -06:00
Matthew Flatt
c754bd851e cs: fix DESTDIR install
Closes #3189
2020-05-14 19:13:19 -06:00
Matthew Flatt
90e708d78e force: avoid double promise-forcer test 2020-05-14 19:12:52 -06:00
Matthew Flatt
272271f36f cs: cache object-name for procedures
Extracting the name from a procedure involves `string->symbol` and
possibly some string parsing. Map the code object to the result
symbol to speed up multiple requests for the same code object.
2020-05-14 19:11:23 -06:00
Sam Tobin-Hochstadt
f5f2cd9345 Improve error message for disallowed links. 2020-05-14 10:48:59 -04:00
NoahStoryM
b5660ce0dc Fix bug.
(begin (set! x (cons 'ctc x)) any/c)
should be evaluated whenever `f' is called. If there isn't an arg list (), it would only be evaluated 1 time.

https://github.com/racket/racket/issues/2711
2020-05-14 09:04:56 -04:00
Sam Tobin-Hochstadt
dfa86ebdee Mark a few more simple expressions as immediate-default?.
This reduces the number of `unsafe-undefined` uses in the flattened
expander by about 10% (682 -> 611).
2020-05-13 23:48:28 -04:00
Ben Greenman
84f9126f77
class-internal: avoid wrapping "immediate" opt/kw defaults (#3182)
When expanding a method definition, do not wrap the default expression
 for optional and keyword args if it matches `immediate-default?`
2020-05-13 18:02:40 -04:00
Sam Tobin-Hochstadt
e8202b7fa3 Change tanh to produce inexact values when approximating near 0.
Since the approximation is that (tanh x) = x for small x, previously
(tanh 1/10000000000000000000) produced an `exact?` answer, even though
this is an approximation.

Found by Typed Racket random testing:
http://drdr.racket-lang.org/54493/racket/share/pkgs/typed-racket-test/tr-random-testing.rkt
2020-05-13 16:11:49 -04:00
Paulo Matos
8859d6596a
Add future tests to CI (#3175)
We added these before but noticed CGC issues so we had to revert it to fix those. 
Future tests added again but a few of them disabled for CGC.
2020-05-13 09:23:42 +02:00
Matthew Flatt
beeb98e0c8 bc: fix optimizer bug related to with-continuation-mark
Uncovered by random testing via the delimited-control Redex model.
2020-05-12 15:58:49 -06:00
Paulo Matos
8ff7b4cc86
Ensure that the GMP ARM extra file has the correct extension (#3178)
* Ensure that the GMP ARM extra file has the correct extension

We hardcoded in some places the extension of the GMP ARM extra file
with .o, however the Makefile rule to build the file will use .lo is
--enable-shared is enabled. This commit fixes the discrepancy by not
hardcoding the extension anywhere.

Fixes #3176

* Avoid gnu make extension

* Replace spaces to conform with other lines

* Ensure we only add extension if file is needed

* Move the LTO definition to the configure.ac

* Carry the LTO variable into the Makefile

* Fix variable reference

* Add variable definition to gc2 Makefile

* annotate assignment
2020-05-12 21:04:59 +02:00
Matthew Flatt
03c978d2e8 expander: avoid race condition on syntax-e
Concurrent lazy scope propagation had a (very unlikely) race condition
updating a syntax object. Ryan pointed out this problem as part of the
discussion for #3162.

Switch to using a single field for a syntax object's content and
propagations, so a CAS can be used to update the field. As a pleasant
side effect, this change tends to make syntax objects more compact.
2020-05-12 13:04:17 -06:00
Matthew Flatt
761c577479 cgc: repair for fsemaphore-wait 2020-05-11 12:41:12 -06:00
Matthew Flatt
9ab5ba0fbc cs: fix interaction of places and 'GC log receivers
Related to #3174
2020-05-11 10:15:17 -06:00
Ben Greenman
0e6415899b doc: typo, '(failure-result/c any/c)' -> 'failure-result/c'
Both the implementation and docs for failure-result/c agree
 that it does not take a parameter:

- https://github.com/racket/racket/blob/master/racket/collects/racket/contract/base.rkt#L157
- https://github.com/racket/racket/blob/master/pkgs/racket-doc/scribblings/reference/contracts.scrbl#L3634

Thanks to @rfindler for pointing out the mistake
2020-05-10 11:49:03 -04:00
Matthew Flatt
b0e65199fd cs: fix ptr-ref on result of ptr-add
Fix `ptr-ref` to properly handle the offset in a pointer for
specialized references, like extracting ` _double`.

Thanks to Laurent Orseau for the bug report and Jens Axel Søgaard for
intial debugging.
2020-05-10 07:01:49 -06:00
Matthew Flatt
e301d3061d another simplification suggested by scan-build 2020-05-10 07:01:49 -06:00
Paulo Matos
812107f015 Revert "Add future tests to CI (#3169)"
This reverts commit 2195db7233.
Future tests are timing out. Investigated under #3172.
Will re-commit once fixed.
2020-05-10 10:59:20 +02:00
Sam Tobin-Hochstadt
689118db0b Increase timeout for snapshot build 2020-05-09 21:12:07 -04:00
Matthew Flatt
60bf8f970e simplications suggested by scan-build 2020-05-09 15:10:11 -06:00
Paulo Matos
7fc0dc36d1
Add precise annotations to improve scanbuild (#3170)
This enables `noreturn` attributes which should improve static analysis results.
2020-05-09 23:00:10 +02:00
Sam Tobin-Hochstadt
b476f39f67 Suffix distributions properly 2020-05-09 15:55:08 -04:00
Paulo Matos
2195db7233
Add future tests to CI (#3169) 2020-05-09 21:46:46 +02:00
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
567fd9e866 style: revert formatting for 2nd textual example
The 2nd example on the page is about end-parethesis position too,
 and cannot use racketmod

sorawee points out, this racketmod behavior is related to:
 https://github.com/racket/racket/issues/3071
2020-05-09 08:19:03 -04:00
Ben Greenman
b804936db0 style: revert 1st example formatting
Revert a change from #3060

The first example is now offset to the top-right, but makes the point
it's supposed to make.

Something is wrong is Scribble to make racketmod and fileblock look
different. Once that's fixed, this example will be at peace.
2020-05-08 22:53:46 -04:00
Sam Tobin-Hochstadt
dd93f9c0f2 Build main-distribution in GHA snapshots. 2020-05-08 22:12:31 -04:00
Sam Tobin-Hochstadt
e8c7b0b6f0 Improve GHA Snapshots, including minimal versions. 2020-05-08 17:46:58 -04:00
Ben Greenman
6a1328cd77 ^ regression tests 2020-05-08 08:27:33 -04: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
Stephen De Gabrielle
6c72b04c1a
add link to https://racket-lang.org/friendly.html (#3164) 2020-05-08 12:57:53 +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
Matthew Flatt
aeb32081db cs: repair for raco decompile 2020-05-07 16:18:25 -06:00
Paulo Matos
bc97c65bb8
Fail when ubsan finds failures (#3166)
This is enabled for CS since ChezScheme has no ubsan warnings since: 65e05772a1
2020-05-07 20:13:50 +02: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
Sorawee Porncharoenwase
219f9c0846 Remove a contract: gen:name is not an identifier value 2020-05-07 07:53:30 -04:00
Paulo Matos
bcdfa42000
Add workflow to test racket with sanitizers (#3159) 2020-05-07 13:20:25 +02:00
Sorawee Porncharoenwase
6e6166ef95 Fixes #2264: remove incorrect description of the body metavariable 2020-05-07 07:20:14 -04:00
Sorawee Porncharoenwase
b0cb1adda6 Fixes #2219: correct the contract for rem
I didn't use the suggested fix by either @Syntacticlosure or @mfelleisen
because there's another usage of `not-has?` which is correct already, so
changing `not-has?` would break it.
2020-05-07 07:19:10 -04:00
Sorawee Porncharoenwase
f6f5cafed1 Fixes #1858: document list* as an alias of list-rest 2020-05-07 07:16:15 -04:00
Sam Tobin-Hochstadt
74600748d9 Specify log file location 2020-05-07 06:45:08 -04:00