Commit Graph

6065 Commits

Author SHA1 Message Date
sorawee
dff6259ff0
Add prop:struct-field-info
This commit adds `prop:struct-field-info` which is implemented to provide
static information about field names. The property is attached to all
struct types generated by `define-struct`.

The commit also modifies kernstructs to have the property.
Finally, the commit switches `struct-copy` to use the static field name
information when it's available.

It remains to change `contract-out` and `match`'s `struct*` to
recognize/attach this new property, but this could be done
separately in the future.

This PR is largely based on racket/racket#732, though the approach is slightly
different.
2020-06-29 11:06:38 -06:00
Matthew Flatt
1118705bef cs & threads: another spurious-CAS-failure accomodation 2020-06-29 10:11:10 -06:00
Matthew Flatt
f38ffc53ed expander: fix prohibition on redeclaring attachment module instance
The check worked in the original namespace, but not the target
namespace for an attached instance.

Related to racket/drracket#227
2020-06-29 09:45:03 -06:00
Matthew Flatt
e99332af69 expander: improve module-name formatting in some error messages 2020-06-29 09:45:03 -06:00
Matthew Flatt
0527c9c9e2 expander: improve dependency-cycle reporting
Show the dependency chain when a redeclared module creates a
dependency cycle.
2020-06-29 09:45:03 -06:00
Matthew Flatt
cdf7e9c383 cs makefile: fix PLT_CS_COMPILE_LIMIT note 2020-06-29 09:45:03 -06:00
Matthew Flatt
4f9c0779f8 cs-bootstrap: fix size and offsets for double fields
Although building with the wrong offsets is good enough to compile
the compiler to compile itself correctly, a broken intermediate
compilation can create confusion.
2020-06-29 09:44:53 -06:00
Matthew Flatt
5e9c6b31c0 add note on compiling Rumble in safe mode 2020-06-28 13:13:58 -06:00
Matthew Flatt
a186e0070a expander & thread: accomodate spurious failure from CAS 2020-06-28 07:03:58 -06:00
Matthew Flatt
38d90a5b0b bc: fix some JIT mismatches
Using a newer GCC on arm32 exposed several small problems.
2020-06-26 15:21:09 -06:00
Matthew Flatt
866d6319a3 cs: enable threads on arm32le 2020-06-26 15:21:05 -06:00
Matthew Flatt
4ad93bcca0 cs: improve raco dec output
Handle `--linklet` mode better and show fasled arguments to compiled
linklet functions.
2020-06-26 12:11:53 -06:00
Matthew Flatt
a76380a343 remove expand-for-clause from racket/base
Closes #3246
2020-06-26 10:25:34 -06:00
Sam Tobin-Hochstadt
09c6ba48f6 Use source location for procedure in with-handlers.
Fixes #2159.
2020-06-25 15:08:35 -04:00
Matthew Flatt
5f5599d2e8 expander: restore datum-intern-literal in datum->syntax
As the documentation says, `datum->syntax` should use
`datum-intern-literal`. That helps avoid syntax-object mutability, and
it increases sharing in compiled forms. The use of
`datum-intern-literal` got lost when the expander was rewritten in
Racket.

Relevant to #3245
2020-06-25 12:08:46 -06:00
Matthew Flatt
27fd176968 cs: fix mutability check on prefab auto fields
Also, fix the error message for misuse of a mutator.
2020-06-24 06:19:31 -06:00
Gustavo Massaccesi
7578e8e083 fix typos in guide 2020-06-23 18:21:41 -03:00
Matthew Flatt
d9293df780 raco pkg config: warn about irrelevant default-scope
The default package scope is determined by consulting the user-scope
configuration, then falling back to the installation-scope
configuration, then defaulting to user.

So, if you have a user-scope configuration of `default-scope`, it
doesn't matter what the configuration says in other scopes, which
means that the output of `raco pkg config` can be confusing. Extra
output in this commit is intended to make it less confusing.

Probably the original mistake here was allowing `default-scope` at a
scope-specific layer, instead of having it just as an installation
configuration (like `name`).
2020-06-23 10:29:51 -06:00
Michael Ballantyne
a17621bec9
Force expression context for local and block
* Document liberal-defines? argument of generate-expand-context

* Add make-expression-transformer

* Ensure `block` expands in an expression context

Also refactors block to depend on racket/base and syntax/ modules rather
than private pre-base dependencies so it can use
`make-expression-transformer` and `generate-expand-context`.

* Ensure `local` expands in an expression context

* Add macro.rktl tests for block and local
2020-06-23 10:29:44 -06:00
Sam Tobin-Hochstadt
aafdafb1cf Copy fewer props in class forms that expand to macros.
Revises cd996c3b6c (see #3240) to only copy the neccessary
properties. Copying all properties interfes with Typed Racket's
class system parsing.
2020-06-23 09:20:28 -04:00
Matthew Flatt
7811a2edbb cs: fix io _uintptr bbinding for rktio and 32-bit platforms
Little-endian byte order hides this mistake, but it showed up
immediate on big-endian ppc32.
2020-06-21 06:45:29 -06:00
Matthew Flatt
9ad7ed82c2 cs: fix embedded-bootfile offset for big-endian ppc32 2020-06-21 06:45:29 -06:00
Matthew Flatt
037cf20eb2 rktio: enable ANSI escapes for Windows console output
Closes #3249
2020-06-21 06:45:29 -06:00
Matthew Flatt
da64bc22bb adjust package-content-state to detect as-is "info.rkt"
Avoid re-writing an "info.rkt" file if its S-expression content
doesn't change, which seems like a good idea in general and avoids a
test failure.
2020-06-18 13:08:09 -06:00
Spencer Florence
7538011f5f Strip package-content-state from info files when stripping to source 2020-06-18 13:08:02 -06:00
Matthew Flatt
22069faebc bc: fix compiler for set! as first subexpression of begin0
An optimization relatively late in the BC bytecode compiler pipeline
was wrong for `begin0`. The transformation and bug must be a very old,
since it's intended to help the bytecode interpreter.

Thanks to Sage for reporting and Alexis for initial debugging.
2020-06-17 07:12:11 -06:00
Matthew Flatt
2de28c8cf3 bc: update install for librktio.a
When linking with libracket.a or libracket3m.a, librktio.a is needed.
(The instructions in "Inside" have apparently been wrong since rktio
was split out.)
2020-06-17 07:02:08 -06:00
Sam Tobin-Hochstadt
14e206bd0b Add more kw source locations. 2020-06-16 22:01:34 -04:00
Matthew Flatt
f3dd113e9d cs: rumble layer tweaks inspired by investigations of random
The main (slightly) effective change here is to avoid disturbing loop
patterns within the Rumble layer's implementation.

Most of the commit is a commented out, updated version of the Scheme
implementation of MRG32k3a `random`. With the latest improvements for
unboxed floating-point arithmetic, performance is relatively good, but
it doesn't catch up to the C compiler's output. On an x86_64 MacBook
(i7 4870HQ) using LLVM or a Raspberry Pi 3 using GCC, it's about 50%
slower compared to C (in contrast to 300% slower before unboxing).
It's almost the same speed on a older x86_64 Linux machine (i7 2600)
using GCC. Where the C compiler wins, maybe it's due to the use of
SIMD instructions in the C output for x86_64 and Arm32. Switching to
the Scheme implementation of `random` would probably be fine, but
aisde from the satisfaction of being in Scheme, there's no reason to
pay the sometimes 50% penalty for now.
2020-06-16 17:03:40 -06:00
Robby Findler
e7f2331663 correct n->th
closes #3238
2020-06-15 15:01:58 -05:00
Ryan Culpepper
798618f6a6
add ssl-channel-binding (#3250)
add ssl-channel-binding

Additional references:
- https://bugs.python.org/issue12551
- https://paquier.xyz/postgresql-2/channel-binding-openssl/
2020-06-15 17:05:36 +02:00
Matthew Flatt
27198bbf43 schemify: adjust pre-lift transformation that can disturb loops 2020-06-14 19:43:34 -06:00
Matthew Flatt
6aa9f7a8eb cs-bootstrap: some additional functions for bootstrapping 2020-06-14 19:43:03 -06:00
Matthew Flatt
28271158dd cs: remove experimental JIT database support
Caching compiled JIT fragments in a SQLite database did not turn out
to be a viable path, so remove partial support for it. JIT mode in
general is rarely a good option, but it's at least completely worked
out, so left in for now.
2020-06-14 14:52:43 -06:00
Matthew Flatt
2a7d94d89c update compilation info, especially for CS
Update the Guide's performance section with current information for
Racket CS, and also document the Racket CS compilation mode and
inspection environment variables. Make a couple of environment
variables work more consistently: PLTDISABLEGC for CS and PLT_ZO_PATH
for BC.
2020-06-14 14:26:22 -06:00
Matthew Flatt
6309c64f6c cs: unbreak Windows build 2020-06-14 08:59:30 -06:00
Matthew Flatt
023681947c bc: fix GC cooperation on internal setjmp
The direct use of `__gc_var_stack__[1]` is wrong if xform has not
generated a function-call wrapper than sets that array element.
2020-06-14 06:24:50 -06:00
Matthew Flatt
e397ad0cbb schemify: fix loop detection in nested lambda forms 2020-06-13 19:03:24 -06:00
Matthew Flatt
265c9eaa57 bc: futures repair related to internal stack overflow
The combination of 1117392cb5 and the existing "tail-apply.rkt" test
exposed another bug.
2020-06-13 15:44:29 -06:00
Matthew Flatt
bc853db1c7 cs: sync with Chez Scheme
Latest FP-unboxing changes require recompilation, so bump the Racket
version.
2020-06-13 11:05:03 -06:00
Matthew Flatt
99acbdaf8c fix cs to not itialize 'atomic memory, docs to not claim initialized 2020-06-11 19:37:12 -06:00
Matthew Flatt
1117392cb5 cs: fix touch on future waiting for an atomic action
When the runtime thread `touch`es a future that is blocked on an
atomic action (just as JIT compilation), the runtime thread would
eagerly run the action, but still leave the future on the
atomic-action queue. Atomic actions tend to be ok to run a second time
(including JIT compilation), so a problem may not show up immediately,
but a semaphore can get out of sync and cause problems later.
2020-06-11 14:55:39 -06:00
Matthew Flatt
42cb80bc70 make fl->fx truncate
Change `fl->fx` to truncate as it converts, which is typically done
anyway by a machine instruction to convert from floating-point to
integer values. This makes `fl->fx` different from `inexact->exact`
or `fl->exact-integer`, but it brings BC and CS in line.
2020-06-11 06:17:18 -06:00
Matthew Flatt
fd236d99ef cs configure: propoagate some options to rktio configure
Otherwise, for example, there's a pthread mismatch currently on arm32
for rktio compilation and racketcs linking.
2020-06-10 08:13:13 -06:00
Sam Tobin-Hochstadt
ec0964861f Check for 0.0 imaginary part in exp.
Follows Chez Scheme and Guile. Turns `(exp 10000.+0.0i)` into
`+inf.0+0.0i` instead of `+inf.0+nan.0i`, which is analagous to
the behavior for exact 0 in the complex part.

Fixes #3194.
2020-06-10 09:10:22 -04:00
Matthew Flatt
2768499b88 fix rktio destroy to release a pipe used for internal singals
Also, fix CS to desstroy a place's rktio instance when the place
exits.

Closes #3243
2020-06-09 10:04:46 -06:00
Fred Fu
c2cae5b7e3
[CS] struct-type-make-predicate creates a value that passes struct-predicate-procedure?
Fixes #3239
2020-06-08 15:03:17 -06:00
Sorawee Porncharoenwase
cd996c3b6c Fixes #3236: preserve disappeared-use on local, block, and class 2020-06-08 13:35:59 -06:00
Matthew Flatt
79e6d1865a Revert "expander: fix intering of some module path indexes for ".zo""
This reverts commit 91f8d8a72f.
The idea that the same resolved path implies the same module
path index is incorrect.

Related to #3241
2020-06-08 10:41:17 -06:00
Matthew Flatt
110c580d97 cs-bootstrap: repair relevant to arm32le 2020-06-05 13:11:03 -06:00
Matthew Flatt
f508bb25ab cs & threads: fix replace-evt leading to choice-evt
Closes #3229
2020-06-03 09:48:48 -06:00
Matthew Flatt
774bfd9139 windows: repair command parsing, especially when building with MinGW
Related #3277
2020-06-02 08:05:08 -06:00
Matthew Flatt
17d60e479f unbreak 3m glib testing support 2020-06-01 14:22:10 -06:00
Matthew Flatt
3499e79377 cs: fix glib logging callback
Allow a NULL domain string.

Related to #3216
2020-06-01 14:14:43 -06:00
Matthew Flatt
11f4a0048b thread: fix scheduler's handling of async callbacks
If the callback takes too long to run, then a second copy was
scheduled --- which likely schedules a third copy, and so on. This
problem could lead DrRacket to get stuck in a GC cycle, for example.
2020-06-01 13:25:00 -06:00
Matthew Flatt
d5024cf595 schemify: keep simple loop patterrns intact
In Schemify's lifting pass, avoid disturbing loop patterns that Chez
Scheme will recognize. Keeping the loops intact is helpful for
floating-point unboxing, where (currently) unbxoing is supported
across loop iterations but not across function boundaries in general.
2020-05-31 17:17:17 -06:00
Paulo Matos
aa0cfd0557
Fix typo in comment 2020-05-30 08:42:01 +02:00
frogbird
f44877bf4b added in-list 2020-05-28 14:06:52 -05:00
frogbird
2cca55c38b moved up coerce-contract check 2020-05-28 14:05:00 -05:00
Sam Tobin-Hochstadt
72ef9f8b6b Avoid empty prototype list.
Related to github/codeql#3535.
2020-05-26 13:17:57 -04:00
Matthew Flatt
406a67def6 cs: fix resolve-path to preserve directory separator
Closes #3212
2020-05-24 13:48:35 -06:00
Matthew Flatt
0473bd52f8 bc: fix use of fsemaphores in the main thread
Fix a locking mistake in the implementation of fsemaphores.
2020-05-23 19:21:56 -06:00
Matthew Flatt
3473a2eeb2 raco setup: accomodate arbitrary files names when checking dependencies 2020-05-23 14:30:06 -06:00
Robby Findler
cc9514c290 add missing argument to raise-syntax-error 2020-05-22 20:56:45 -05:00
Sam Tobin-Hochstadt
8b629a329b Mark a few more simple expressions as pure in the expander.
Related to #3204.
2020-05-22 13:57:54 -04:00
Matthew Flatt
a17e662597 expander: shortcut for parsing already expanded
When a `module` or `let-syntax` form is `expand`ed (i.e., when a
syntax object must be generated), then code is expanded to a syntax
object and then parsed again for compilation. In that second parse,
take advantage of the fact that the expression is already expanded,
which means that no new scopes or bindings need to be created.

Related to #3165
2020-05-21 18:53:15 -06:00
Matthew Flatt
bdb0256220 cs: fix hash-code mixing
Hashing for structures and hash tables used a very poor mixing
function.
2020-05-21 15:38:14 -06:00
Matthew Flatt
f7f75fa901 avoid compiler warning 2020-05-21 10:00:25 -06:00
Paulo Matos
62c9a79c68
Use threaded time functions (#3199) 2020-05-21 15:45:22 +02:00
Matthew Flatt
08d4698934 cs-bootstrap: additions to work on latest Chez Scheme 2020-05-20 10:46:57 -06:00
Matthew Flatt
9ba5fd6a0f cs: fix issues with source->sfd cache
The cache wasn't kill-safe, and probably a weak cache could also lead
to non-determinism of source-path sharing across submodules.

Related to #3193
2020-05-20 08:29:56 -06:00
Matthew Flatt
07d3f3a2ec cs: faster number->string on flonums 2020-05-20 06:31:02 -06:00
Matthew Flatt
91f8d8a72f expander: fix intering of some module path indexes for ".zo"
Two "self" module path indexes are treated the same on load when they
have the same resolved module name. Fix the serialization intern table
to take that into account and avoid some GC-based non-deterministism.

Related to #3165
2020-05-19 16:49:26 -06:00
Matthew Flatt
12bc1b3841 expander: adjust module-path-index cache implementation
Change the implementation to one that is a simpler and slightly more
effective.
2020-05-19 16:49:26 -06:00
Matthew Flatt
b7908e97a1 cs makefile: refine handling of file permissions
On a second look, 6d06086dad unnecessarily duplicates work already don
by `copy-file` in most cases. For the case where `copy-file` was not
used, there was code to explicitly set an executable bit, but the new
approach is better and should be used just there.
2020-05-19 16:49:26 -06:00
Matthew Flatt
b6c5515efa cs: faster write-char on ASCII 2020-05-19 09:54:52 -06:00
Matthew Flatt
1655b6e2bb ffi/unsafe: match i, o, or io as symbols
Changes `_ptr`, `_list`, and `_vector` syntax to be more permissive.
Matching by symbol rather than binding is usually the wrong choice,
but the position where `i`, `o`, or `io` is recognized in `_ptr` and
company is not an expression position. Also, `i`, `o`, and `io` are
not otherwise bound. So, it's difficult to justify the current
behavior. If `_ptr` and company were defined today, we'd use keywords
like `#:i` instead of symbols like `i`.

A potential drawback of this change is that a `i`, `o`, or `io` might
be written with the intent of referring to a binding, and this change
makes such a reference silently allwowed instead of an errror. That
seems relatively unlikely, however, while having to avoid `i`, `o`, or
`io` as a binding is occassionally a pain --- something I've run into
once or maybe twice.

Closes #887
2020-05-19 09:54:52 -06:00
Matthew Flatt
6d06086dad cs makefile: preserve permissions when embedding boot files
Closes #3192
2020-05-19 09:54:52 -06: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
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
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
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
Matthew Flatt
60bf8f970e simplications suggested by scan-build 2020-05-09 15:10:11 -06: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
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
Matthew Flatt
99af295d99 cs: fix constant-time list?
Closes #3097
2020-04-09 09:44:06 -06:00
Sam Tobin-Hochstadt
c81689bf9f Declare loop-updated variable outside the loop.
Found by scan-build.
2020-04-08 15:03:34 -04:00
Sam Tobin-Hochstadt
92c1ba9a62 Free buffer in error case.
Found by scan-build.
cc @pmatos.
2020-04-08 15:03:34 -04:00
John Clements
36bb3bc21f Post-release version for the v7.7 release 2020-04-08 00:23:46 -07:00
Matthew Flatt
f673534ad7 cs: fix place root for accounting
Avoid charging a thread for a place's allocation just bacuse it refers
to the place.
2020-04-06 09:25:47 -06:00
Matthew Butterick
d396c70d0e
correct function name in error messages
needs to be `s-exp->fasl` not `fasl->s-exp`
2020-04-05 11:30:02 -07:00
Matthew Flatt
282ec8125a cs: use fused garbage collection and memory accounting
Chez Scheme now supports a single-pass combination of `collect` and
`compute-size-increments`, which makes a GC with accounting about
twice as fast. Meanwhile, other GC improvements reduce non-accounting
full-collection times by 10-20%.

Much of the GC implementation is now generated from a "Parenthe-C"
description, so update the bootstrap process for that step.
2020-04-04 10:43:58 -06:00
Matthew Flatt
5c77bfced9 further signed-vs-unsigned repairs to time handling
Changing the result of cpu-time functions to unsigned suggests
further corrections to avoid overflow.
2020-03-28 09:11:38 -06:00
Paulo Matos
9c2b84d849 Change return type of rktio_get_milliseconds to be unsigned
This fixes a major issue in arm 32bits, detected by ubsan, where
conversion of type to milliseconds results in overflow.

```
rktio_time.c:92:21: runtime error: signed integer overflow: 1584975753 * 1000 cannot be represented in type 'long int'
```
2020-03-28 08:55:24 -06:00
Matthew Flatt
9cb6debf44 cs & thread: memory accounting corrections
Repair trigger of a GC when using `current-memory-use`
on a custodian when a limit was just installed.
2020-03-28 08:39:42 -06:00
Paulo Matos
7621ccbb7b
Explicit zero assign to avoid warning (#3082)
GCC 9.3 things that `h2` might reach line 385 uninitialized.
```
./hash.c:385:14: warning: 'h2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  385 |       h = (h + h2) & mask;
      |           ~~~^~~~~
```
2020-03-27 18:37:19 +01:00
Matthew Flatt
4a2cb6f577 bc: fix optimizer bug
Local-variable type information was not properly removed from
information threaded through optimization.

Closes #3081
2020-03-24 08:51:37 -06:00
Matthew Flatt
9222a135c3 cs: reliable GC callbacks on major GCs
A Chez Scheme garbage collection involves a rendezvous among threads
that are used to implement places and futures (and potentially other
things that create Chez-level threads). The thread that is used to
drive the garbage collection was not formerly specified, and callbacks
like the GC icon in DrRacket can only be run in the initial thread.
When a major collection was run in a non-initial thread, the callback
was simply skipped.

The Racket branch of Chez Scheme now drives a collection in the
initial thread whenever that thread is active. In Racket CS, the
initial thread can be inactive if it's waiting for external events,
and a place can meanwhile trigger a GC. Now, when the Racket CS GC
callback is called for a major collection in any thread other than the
initial one, it defers the major collection to an asynchornous
callback in the main thread (and meanwhile performs a minor
collection).

So, a major collection might now be delayed by just a little while if
the main thread is inactive, such as when it's waiting for external
events, but callbacks like the GC icon in DrRacket will be reliably
invoked for major collections.
2020-03-23 17:50:04 -06:00
Paulo Matos
4a62408b71
Fix typo in comment 2020-03-23 16:58:33 +01:00
Sorawee Porncharoenwase
3c966bc297 Unbreak syntax/to-string tests
It's still unclear what the specification of syntax->string regarding whitespace
before closing parens should be. The implementation also has not dealt with
the issue. This PR therefore removes whitespace before closing parens from
the tests.

Once the discussion at
https://github.com/racket/racket/issues/3071#issuecomment-601984438
has reached a conclusion and implemented, we can add these tests back.
2020-03-22 20:46:12 -04:00
lkh01
d9c064d06c make syntax->string work with unquote, quasiquote, etc. 2020-03-22 15:05:01 -04:00
lkh01
40c589ef8a do not overwrite whitespace after a quote 2020-03-22 15:05:01 -04:00
lkh01
2a8e10b31a account for difference between quote and ' in syntax->string 2020-03-22 15:05:01 -04:00
Matthew Flatt
9effeef7ab cs: fix stencil-vector HAMT for 32-bit platforms 2020-03-17 18:24:30 -06:00
Matthew Flatt
3390896a59 schemify: clean up unnecessary lets in interpreter
Collapse `let` with unused binding to `begin`, and then
collapse resulting nested `begin`s.
2020-03-17 18:24:30 -06:00
Sam Tobin-Hochstadt
c7a9690143 Fix recursive make invocation.
Eliminates warning in DrDr.
2020-03-16 13:35:59 -04:00
Matthew Flatt
8f256c9261 cs: fix error-print-width handling when output just fits the limit
For example, if the limit is 5, then "abcde" should print as "abcde",
not "ab...".
2020-03-13 16:12:34 -06:00
Sorawee Porncharoenwase
74c0844101 Also fix ~.a in 3m 2020-03-13 15:20:10 -06:00
sorawee
8f286fc810 Fix #2986: error-print-width 3 shouldn't error 2020-03-13 15:20:10 -06:00
Matthew Flatt
c52d45613b minor whitespace corrections 2020-03-13 11:32:49 -06:00
Matthew Flatt
f1a177e880 cs: fix applicable struct implemented with applicable struct 2020-03-13 11:14:39 -06:00
Matthew Flatt
edfdcb0b6d add call-in-continuation
The `call-in-continuation` function generalizes applying a
continuation to values by accepting a thunk that is called in the
restored continuation. In other words, insteda of having to use the
pattern

 ((call/cc (lambda (k)
             .... (set! saved-k k) ...
             (lambda ()
               original-result))))
 ...
 (saved-k (lambda () new-result))

The extra call and thunk on the capture side can be omitted:

 (call/cc (lambda (k)
            .... (set! saved-k k) ...
            original-result))
 ...
 (call-in-continuation saved-k (lambda () new-result))

At the Chez Scheme level, a `call-in-continuation` in tail position
within a function can avoid forming a closure for its second argument.
The `call-in-continuation` function at the Racket CS level doesn't yet
provide that benefit.

The `call-in-continuation` operation is called `continuation-slice` in
Feeley's "A Better API for First-Class Continuations".
2020-03-13 09:46:12 -06:00
Matthew Flatt
9ef2124a38 speed up keyword expansion
Expansion of a procedure with keywords is quadratic due to generating
a nested sequence of `let`s, but speed it up by roughly a constant
factor by using a dintinct symbol for each nested layer.

Related to #3070
2020-03-13 09:46:12 -06:00
Matthew Flatt
f98d0a5cc1 cs: use call-in-continuation
Using `call-in-continuation` to apply a thunk within a continuation
slightly simplifies and speeds up parts of the implementation of
delimited continuations.
2020-03-13 09:46:12 -06:00
Matthew Flatt
601ffc9b36 avoid compiler warnings 2020-03-07 14:42:41 -07:00
Matthew Flatt
fab04633f3 makefile: add DISABLE_STATIC_LIBS 2020-03-07 14:24:50 -07:00
Matthew Flatt
0de88f203d struct: don't generate excessive struct-field-index code
The expansion of `struct` created far too much code to parameterize
`struct-field-index`, making expansion of a `struct` form with just
100 or 200 fields take a noticeably long time to expand.
2020-03-07 10:45:33 -07:00
Matthew Flatt
00b6803e36 cs: enable embedding in other applications
The "Inside: Racket C API" manual now has a CS part and a BC part.
2020-03-07 06:39:41 -07:00
Gustavo Massaccesi
d6d30d2fcc cs: sync with Chez Scheme change fix in cptypes 2020-03-07 08:07:30 -03:00
Matthew Flatt
e2c9544ed5 bc: fix hash-set key replacement for eq? values 2020-03-06 11:15:50 -07:00
Matthew Flatt
b4dd4684d9 cs: fix problem getting structure hash codes 2020-03-05 11:28:28 -07:00
Sam Tobin-Hochstadt
8a63d80379 Preserve undocumented args syntax class attribute.
PR #2678 unintentionally removed this attribute, but it was used
at least by "collections-lib" and "static-rename-lib".

cc @sorawee @lexi-lambda @jackfirth @rmculpepper
2020-03-04 15:05:16 -05:00
Sorawee Porncharoenwase
3043dbd35c Expose function-header's name, document attributes, fix links 2020-03-04 13:22:19 -05:00
Sorawee Porncharoenwase
1b4126d1e5 Fix a typo, add examples, switch to non-experimental form 2020-03-04 13:22:19 -05:00
sorawee
29c518abbc
Allow multiple catalogs in raco pkg install and friends
Allow `--catalog` to be specified multiple times.
2020-03-04 07:02:45 -07:00
Ben Greenman
258eee40ce
contract: use impersonator prop. for impersonator-unconstrained-domain->/c (#3055)
rename the contract property from a chaperone prop to an impersonator
prop (looks like this was an old copy/paste error)
2020-03-03 15:50:19 -05:00
James Bornholt
ac41c8a361 Make get-pure-port redirection case-insensitive
GitHub's CDN seems to have recently started returning the `Location` header for a redirect with a lowercase `l`, which breaks the redirect logic. The HTTP spec says that header names are case-insensitive, so we need to look for either version.
2020-02-25 13:38:44 -05:00
Matthew Flatt
fb620d5556 cs: constrain register-process-global to intended behavior
Make `register-process-global` check for byte strings, and avoid
retaining the byte string that it's given (in case that changes, for
example).

Closes #3053
2020-02-24 07:23:59 -07:00
Matthew Flatt
ef856eda76 cs: fix separator for embedded boot files 2020-02-22 17:32:51 -07:00
Matthew Flatt
06cbc94ced sync with updated Chez Scheme 2020-02-22 13:23:52 -07:00
Matthew Flatt
a68c8eadc6 cs: fix hash{,eq,eqv} on an odd number of arguments
Closes #3051
2020-02-21 21:26:18 -07:00
Matthew Flatt
dad9995f56 cs: add glib logging hook
Building glib-specific support into the main Racket executable is
unsatisfying, but it's consistent with Racket BC, and the alternative
is especially tedious to deal with places and namespaces and
allocation.
2020-02-20 14:52:30 -07:00
Matthew Flatt
fe64841290 cs: fix error conversion condition-who is a string
For example, `(string->symbol 10)` raises a Chez Scheme condition with
the string "string->symbol" instead of 'string->symbol.
2020-02-19 20:04:33 -07:00
Matthew Flatt
906af72f82 dump-memory-stats: report bytes used for still-marshaled bytecode 2020-02-19 17:33:49 -07:00
Ben Greenman
5377d00c90 pkg/lib: change pkg-stage contract to return set
Before: contract expected list but the function returns a set
After: contract expects a set

fix #3029
2020-02-17 16:51:17 -05:00
Matthew Flatt
3519f8f3fc racket/class: mark internal wrapped-object as authentic
Combined with a schemify improvement that inlines imported predicates
to expose the record-type test to Chez Scheme, this chage enables
cptypes to prune useless inlined `wrapped-object` selector branches.
That improvement, in turn, reduces code size and redundant checks on
objects that have contracts.
2020-02-17 10:54:05 -07:00
Matthew Flatt
c7059c7c94 cs: encode procedure methodness statically
When a `lambda` form is marked as a method (for arity error reporting)
through a property, translate that to a static flag on the procedure,
instead of a call to `procedure->method`.

The only way we have to attach static information is through the
procedure name, so the encoding already in place for "no name" and
"path-based name" is extended to support a method flag.
2020-02-17 09:02:04 -07:00
Matthew Flatt
5412a4c5fa schemify: remove procedure-naming lets
Since procedures have names that are attached more directly by the
schemify pass, remove simple `let-values` forms wrapping procedures.
This shortcut improves the result of the lifting pass in some cases.
2020-02-17 09:02:04 -07:00
Matthew Flatt
e1c1269939 cs: improve chaperoned structure-property access
Avoid looking up the property twice.
2020-02-17 09:02:04 -07:00
Matthew Flatt
cdd0659438 cs: fix GC:major logging on exit
Also, add `PLT_GCS_ON_EXIT` to force 2 major GCs on exit, which
is useful for checking peak and end memory use.
2020-02-15 09:11:44 -08:00
Matthew Flatt
e90df3f2f2 adjust build of libssl for x64-bit Mac OS 2020-02-12 13:49:21 -07:00
Matthew Flatt
760b2924c6 expander: fix typo
Misplaced paren created a misapplication of `weak-box-value`.
2020-02-11 06:37:08 -07:00
Matthew Flatt
7279a59c27 cs: improve make-struct-type on large field counts 2020-02-11 05:43:08 -07:00
Matthew Flatt
56fe13e6f7 cs: small interpreter clean-ups 2020-02-10 20:11:18 -07:00
Matthew Flatt
5e45dd2e1c cs: use anonymous-field record types
Record types with unnamed fields can be significantly more compact,
excdeption in combination with the constrain the the fields all
contain Scheme objects. Saves 2% for DrRacket's initial footprint.
2020-02-10 19:12:00 -07:00
Paulo Matos
fb63f399ef
Add option --enable-werror (#3038)
This adds configure option `--enable-werror` to `./configure` script which adds `-Werror` to build time CFLAGS.
2020-02-10 20:07:20 +01:00
Matthew Flatt
e8fa0613db cs: fix internal issues in struct [property] layer 2020-02-09 18:27:14 -07:00
Matthew Flatt
fd9a5f0357 cs: clean up and improve dump-memory-stats 2020-02-09 11:34:44 -07:00
Matthew Flatt
c5dc0841c1 cs: mark some parameters a always-succeeds 2020-02-08 14:02:15 -07:00
Matthew Flatt
a3f1ab8b60 cs: tweak for chaperoned structure reference
No need for `|#%app|` on chaperoned operation.
2020-02-08 10:13:44 -07:00
Matthew Flatt
7f729a1a2b cs: fix structure property accessor & predicate names 2020-02-08 09:06:57 -07:00
Matthew Flatt
e4c5d54e37 cs: avoid locks on struct-related tables
Avoing a lock speeds up predicates like `struct-predicate-procedure?`,
which speeds up creation of struct chaperones.
2020-02-08 08:20:06 -07:00
Matthew Flatt
1900c0e57a cs: faster struct impersonation 2020-02-08 07:42:58 -07:00
Matthew Flatt
615e4f707a cs: sync with Chez Scheme change for trap check, again
We had to give back some space savings to avoid potential problems
with allocating in the event callback and running out of stack
space[?] when passing an argument. We get to keep most of the
improvement though.
2020-02-07 16:20:21 -07:00
Matthew Flatt
595b62a038 cs: change code generated for defining module variables
Makes a small difference in code + relocation sizes (about 1%)
2020-02-07 08:57:49 -07:00
Matthew Flatt
df039c1b73 cs: sync with Chez Scheme change for trap check
Less code for a trap check saves about 5% code space for DrRacket,
which is about 2% of the overall starting footprint.
2020-02-06 18:54:35 -07:00
Matthew Flatt
65d77ee00c build 64-bit Mac OS native libraries against the 10.9 SDK 2020-02-06 15:12:47 -07:00
Leo Shen
08d33a773d net/http-client: add support of deflate content encoding 2020-02-06 11:16:32 -07:00
Matthew Flatt
ce85e3c66d ffi/unsafe: fix _enum for non-fixnums
Use `assv` instead of `assq`, because an `_enum` variant's value might
be a non-fixnum integer.

Closes #3036
2020-02-05 06:20:37 -07:00
Matthew Flatt
f615be26a3 cs: fix log-level? and related
Broken cache clearing caused out-of-date results to be returned
sometimes.
2020-02-04 18:04:52 -07:00
Matthew Flatt
e45d0ab9d8 add 'GC:major logging
Racket CS already had a form of 'GC:major logging, but normalize it
and add it to traditional Racket.
2020-02-04 17:36:51 -07:00
Matthew Flatt
4ed253d66e fix line counting with mixed CR and LF
A CR by itself could be incorrectly treated as preceding a later LF,
which would form a CRLF combination if they had been adjacent.

Closes #3033
2020-02-03 17:21:51 -07:00
Matthew Flatt
654f821919 correct pretty-print and improve consistency
Fix a regression in 712494312a, and change other other two printers to
be more consistent for

 #lang racket
 (struct s () #:transparent)
 (define a (s))
 (pretty-print (list (cons a 0) (cons a 0)))
2020-02-03 17:21:51 -07:00
Jon Zeppieri
c358df6de4 [CS] regexp-replace: handle #f submatches
A regexp can match while having sub-patterns that are not used in
the match. In regexp-replace, the "insert" argument can refer to
these unused sub-matches. If a function is given for the "insert"
argument, it will receive these unused submatches as #f values.
If a string or byte-string is given, then any reference to an
unused sub-match (by means of a back-reference) is treated as the
empty string or byte-string.

Fixes #3032.
2020-02-03 17:21:38 -07:00
Matthew Flatt
c81228f31e cs: more clearing of a terminated thread
In particular, clear out the `suspend+resume-callbacks` field so that
retaining the thread object does not retain those callbacks.
2020-02-01 08:15:50 -07:00
Matthew Flatt
67595cc255 cs: include accounting time in reports GC time
When logging GC debugging, a pecentage after the time for a GC reports
what fraction was extra steps after GCing proper, especially the extra
step of memory acounting when that is enabled.

Also, avoid Chez Scheme gensyms even more. Otherwise, using low-level
facilities like `dump-memory-stats` can force the unique name of a
gensym used for a structure type, which causes it to be permanent,
which could be exactly what you don't want when debugging a
memory-rentention problem.
2020-02-01 07:30:00 -07:00
Matthew Flatt
eeb73a6c05 expander: avoid keeping thread in registry lock
Weakly retain the lock holder in a namespace registry. Otherwise, it
can retain a thread that should have been unreachable.
2020-02-01 07:14:49 -07:00
Matthew Flatt
2c9bf94451 cs: faster struct hashing and struct->vector
Take advantage of `$record-type-field-count` to replace
`record-type-field-names`, which isn't constant-time.
2020-01-31 13:29:07 -07:00
Matthew Flatt
9a9a5eef3b cs: improve jitify letrec output 2020-01-31 06:12:42 -07:00
Matthew Flatt
cbcd9505aa racocs decompile: handle linklets in 'interpret mode 2020-01-31 06:10:33 -07:00
Matthew Flatt
4acf864b0e delay cross-system-library-subpath call
In `compiler/private/mach-o` --- which is reachable via `racket` due
to being a dependency of `setup/dirs` --- delay the call to
`cross-system-library-subpath` until needed.
2020-01-31 05:23:18 -07:00
Matthew Flatt
8da6e9bd6b cs: use black hole for unsafe-undefined representation 2020-01-30 20:18:12 -07:00
Matthew Flatt
ad9dc342f8 cs: suppress reundant letrec-variable checking
The schmiefy pass already ensures that variables are defined before
use, so skip cpvalid in Chez Scheme. The difference is tiny, though.
2020-01-30 18:59:02 -07:00
Matthew Flatt
37ce9478cd move symbol->immutable-string and keyword->immutable->string out of racket/base
Move them to new `racket/symbol` and `racket/keyword` libraries to
avoid conflicts with existing packages.
2020-01-30 15:53:16 -07:00
Matthew Flatt
fa6e7101df adjust inliner to avoid infinite inline
Fixes optimization for an expression like

 (define (f x)
   (lambda (y)
     (letrec ([recursion (f x)])
       (+ x y))))

by adjusting the inlining hueristic to support less inlining on a
second pass of `letrec` right-hand sides.

Closes #3027
2020-01-30 08:31:04 -07:00
Matthew Flatt
fb95e9312f racocs decompile: show machine code or assembly
When the "disassemble" package is installed, use it to disassemble the
machine code in a Racket CS linklet.
2020-01-29 20:01:24 -07:00
Matthew Flatt
69932f6f67 add ffi/unsafe/vm
Provide `vm-primitive` and `vm-eval` to regularize access to VM-level
primitives. Document some of the issues for interoperating across the
Racket and (Chez Scheme) VM layers.

The library could have been implemented with just `compile-linklet`
and `instantiate-linklet`, but using an underlying `primitive-lookup`
function is a little nicer.
2020-01-29 11:07:40 -07:00
Matthew Flatt
c48afdb16b repairs for arithmetic-shift
Produce 0, -1, or out-of-memory for bignum shifts. For large fixnum
shifts, check memory limits.

The repairs are mostly for Racket CS, but traditional Racket
incorrectly reported out-of-memory for 0 shifted by a positive bignum.
2020-01-26 09:18:14 -07:00
Gustavo Massaccesi
e72848fa1f fix typo in cs/README.txt 2020-01-25 16:05:52 -03:00
Matthew Flatt
9d43b62282 cs: use fxlogtest instead of (fx= 0 (fxand ...))
For the stencil-vector HAMT implementation, the difference
can be 5-10% improvement on microbenchmarks.
2020-01-24 17:33:47 -07:00
Matthew Flatt
7c06d6d4ab bump version to sync with Chez Scheme change
A more compact representation for return points tends to reduce code
by about 10%. For DrRacket, that translates to a 5% decrease in
overall footprint.
2020-01-24 17:26:13 -07:00
Matthew Flatt
dc2aa03e4e update Windows and Mac OS build instructions
Explain how to deal with the "racket-lib" that is normally included
with a source distribution, but that doesn't have dependencies
specific to Windows or Mac OS.
2020-01-23 19:07:59 -07:00
Matthew Flatt
8d6bdafb45 cs: use unsafe application after schemify
Since schemify adds its own checking for procedureness in an
application, always compile the application as unsafe at the Chez
Scheme level. This simple change saves about 5% in code size for
DrRacket, which is a 1-2% footprint saving overall.
2020-01-23 17:20:15 -07:00
Matthew Flatt
b7fcf4112a update "racket/HISTORY.txt" for v7.6 2020-01-23 13:01:26 -07:00
Matthew Flatt
17aae65664 fix 'inferred-name handling for keyword-supporting define
Closes #3009
2020-01-20 13:44:15 -07:00
Matthew Flatt
848d2148b0 cs: cooperate with improved cross-library inlining
An improvement to Chez Scheme allows more function from the Rumble and
other built-in layers to be inlined into compiled Racket code, and a
new `$app/no-inline` primitive enables improved control over how slow
paths are integrated.
2020-01-19 09:43:44 -07:00
Matthew Flatt
712494312a improve consistency of printers and prop:custom-write
The pretty printer and built-in printer for traditional Racket did not
consistently provide the current quoting mode while checking for
unquoting and cycles. All printers, including the Racket CS printer,
are improved for a structure type that has
`prop:custom-print-quotable` as 'always, in which case we know that
unquoting- and cycle-checking time that the components will be in
quoted mode.

The pretty printer also made three passes through a value to check for
cycles, compute cycles, and compute unquotes, and those are now fused
into a single pass like the Racket CS printer. The built-in printer
for traditional Racket still makes up to two passes, but it now
behaves more like other printers by recurring immediately on nested
calls via `prop:custom-write` instead of accumulating them for after
the `prop:custom-write` callback returns.

The documentation clarifies that synthesizing new values during
printing can interefere with cycle checking and unquoting, but the
printers now react to that behavior more consistently.
2020-01-15 07:21:19 -07:00
Brian Wignall
738d2b7a81 Fix typos (#3005) 2020-01-14 11:49:23 +01:00
Matthew Flatt
15d107d373 cs: repairs for equal?/recur, especially on hash tables 2020-01-12 09:37:01 -07:00
Matthew Flatt
96ac646284 sync with Chez Scheme report for popcount on Windows 2020-01-11 16:43:45 -07:00
Matthew Flatt
33f8173970 cs: switch to stencil-vector HAMT
With recent improvements, the run-time performance of vector-stencil
HAMTs for immutable hash tables seems close enough (on
microbenchmarks) to the Patricia-trie implementation to be worthwhile,
since they use less memory. Performance remains better in most cases
than the traditional Racket implementation.

The table at the end of this message summarizes relative performance
on microbenchmarks. Overall, though, immutable hash-table operations
are already so fast that these difference very rarely translate to
measurable differences in overall run times --- not even for the macro
expander, which relies heavily on immutable hash tables to represent
scope sets.

Stencil-vector HAMTs tend to take about 1/3 the space of Patricia
tries, and those space savings can turn into run-time improvements in
applications by reducing GC time. I've observed a 10% reduction in
compile time for some programs. When building a full Racket
distribution, run time shrinks by about 2 minutes out of 80 minutes,
probbaly because just average memory use goes down by 10%. DrRacket's
initial memory footprint goes down by about 37M out of 657M (a 5%
savings).

Mincrobenchmark relative performance, normalized to previous Racket CS
implementation (measured on 2018 MacBook Pro, 2.7 GHz Core i7; Chez
Scheme can substitute POPCNT instructions at link time):

 patricia = previous Racket CS implementation as a Patricia Trie
 stencil = new Racket CS implementation as a stencil-vector HAMT
 racket = traditional Racket implementation

                           patricia  stencil  racket
       set-in-empty:eq#t:  ==|       ==|      ==|=
           set-many:eq#t:  ==|       ==|==    ==|========
  set-many-in-order:eq#t:  ==|       ==|      ==|====
           set-same:eq#t:  ==|       ==       ==|=
         set-in-empty:eq:  ==|       ==       ==|=
             set-many:eq:  ==|       ==|==    ==|========
    set-many-in-order:eq:  ==|       ==|=     ==|=====
             set-same:eq:  ==|       ==       ==|=
        set-in-empty:eqv:  ==|       ==|      ==|==
            set-many:eqv:  ==|       ==|==    ==|=========
   set-many-in-order:eqv:  ==|       ==|=     ==|=====
            set-same:eqv:  ==|       ==|      ==|=
      set-in-empty:equal:  ==|       ==|==    ==|===
          set-many:equal:  ==|       ==|==    ==|=====
 set-many-in-order:equal:  ==|       ==|=     ==|===
          set-same:equal:  ==|       ==|=     ==|===
                ref:eq#t:  ==|       ==|      ==|=
           ref-fail:eq#t:  ==|       ==|      ==
                  ref:eq:  ==|       ==|      ==|=
             ref-fail:eq:  ==|       ==|      ==
                 ref:eqv:  ==|       ==|      ==|====
            ref-fail:eqv:  ==|       ==|      ==|
               ref:equal:  ==|       ==|      ==|===
         ref-large:equal:  ==|       ==|      ==
          ref-fail:equal:  ==|       ==|      ==|===
    ref-large-fail:equal:  ==|       ==|      ==
            removes:eq#t:  ==|       ==|===   ==|===========
         add+remove:eq#t:  ==|       ==|=     ==|=======
              removes:eq:  ==|       ==|====  ==|============
           add+remove:eq:  ==|       ==|=     ==|=======
             removes:eqv:  ==|       ==|===   ==|=============
          add+remove:eqv:  ==|       ==|      ==|========
           removes:equal:  ==|       ==|==    ==|=======
        add+remove:equal:  ==|       ==|=     ==|======
         iterate-keys:eq:  ==|       ==|      ==|=
       iterate-vals:eq#t:  ==|       ==|=     ==|=
         iterate-vals:eq:  ==|       ==|=     ==|=
  iterate-unsafe-keys:eq:  ==|       ==|      ==|=======
iterate-unsafe-vals:eq#t:  ==|       ==|      ==|
  iterate-unsafe-vals:eq:  ==|       ==|=     ==|
             for-each:eq:  ==|       ==|      ==|==========
    subset-lil-shared:eq:  ==|       ==|      ==|=
  subset-lil-unshared:eq:  ==|       ==|      ==|==
       subset-lil-not:eq:  ==|       ==       ==
subset-med+lil-shared:eq:  ==|       ==|====  ==|=
subset-med+med-shared:eq:  ==|       ==|=     ==|=
      subset-big-same:eq:  ==|       ==|      ==|===============
subset-big+lil-shared:eq:  ==|       ==|===   ==|====
subset-big+med-shared:eq:  ==|       ==|==    ==|===
  subset-big-unshared:eq:  ==|       ==|      ==|==
2020-01-11 13:42:33 -07:00
Matthew Flatt
e71963c48b openssl: condition versionless based on current, not cross target 2020-01-10 14:16:30 -07:00
Matthew Flatt
76726ee928 cs: improve stencil-vector HMAT hash-keys-subset? performance
Also, improve some hash benchmarks.
2020-01-10 10:46:55 -07:00
Matthew Flatt
d5930a18c6 configure: fix --disable-mac64 mode as cross-compile mode 2020-01-09 07:24:27 -07:00
Matthew Flatt
8c5d580d5a cs: fix cross-compile build steps 2020-01-08 06:41:23 -07:00
John Clements
4bdad475e1 Post-release version for the v7.6 release 2020-01-07 13:02:31 -08:00
Matthew Flatt
a60f173b46 hash benchmarks and stencil-vector HAMT experiment
This commit adds an (unused) implementation of immutable hash tables
for Racket CS that trades some run-time performance for an especially
compact representation --- similar to the traditional Racket
implementation of immutable hash tables. It uses a new "stencil
vector" datatype at the Chez Scheme level, which overlays the bitmap
needed for a HAMT node with the Chez-object type tag (and also
provides an update operation that avoids unnecessary memory work).

Compared to the current Racket CS implementation, the stencil-vector
HAMT implementation of an immutable hash table takes only about 1/3
the space on avergae, which translates to a overall 5% savings in
DrRacket's initial heap. It also makes a full Racket build slightly
faster by reducing avergage memory use by 5-10%.

But the run-time performance difference is significant, especially for
the `hash-keys-subset?` operation (at least in microbenchmarks), and
also for addition and iteration. Maybe there's an overall better point
that reduces memory use of the current Patricia trie implementation
without sacrificing as much performance.

Besides the benchmarks and stencil-vector HAMT implementaiton, there
are small changes to the way hash tables cooperate with `equal?`,
which makes it a little easier to plug in different implementations.
2020-01-06 07:07:48 -07:00
Matthew Flatt
f0a63b5921 rktio: repair for building without ptherad support 2020-01-06 04:09:26 -07:00
Tommy McHugh
fc258725ba added struct/derived, tests, and doc updates 2020-01-04 09:24:10 -05:00
Matthew Flatt
8ae53d9e8b fix _bytes/nul-terminated for NULL results
Closes #2995
2020-01-02 08:46:34 -07:00
Matthew Flatt
e97639e525 cs: faster string-copy!
Similar to e087059f21.
2020-01-01 15:00:23 -07:00
Matthew Flatt
e88c2b18e6 fix license blurb in "racket/src/README.txt" 2020-01-01 12:22:34 -07:00
Matthew Flatt
ba83d95339 cs configure: avoid --enable-shared problems
Building with shared libraries is not currently supported, because the
Chez Scheme build is not set up to work in that mode, and because
"stand alone" executable handling at the Racket level does not support
Racket CS shared libraries.

Also, there's no benefit to shared libraries. Racket executables get
the benefit of sharing because they all run through the same
executable. Meanwhile, there's not (yet?) a supported C API to make
something like "libracketcs.so" useful.

Related to #2993
2019-12-31 08:03:01 -07:00
Tommy McHugh
0d1a85237e Implemented struct/contract and testing for struct/contract 2019-12-30 19:01:26 -06:00
Matthew Flatt
af3c22dd11 cs: mark some internal representations as sealed
This change makes a small but measurable difference for mpairs, at
least (about 5% on the mpair-intensive "lists.rkt" benchmark).
2019-12-30 08:15:23 -07:00
Matthew Flatt
ce4ad668b6 cs & thread: move retry callback to cancel result
Adjust part of the internal scheduling protocol to make a retry
callback generated by another callback that sets up the retry. This
helps clarify the protocol and avoids allocating a closure that is
rarely used.
2019-12-29 18:56:42 -07:00
Matthew Flatt
755e914c7c cs & thread: allow evt-chaperone to hide other membership
Make Racket CS consistent with traditional Racket in the way
`chaperone-evt` on a thread hides threadness, etc.

Hiding properties like threadness is not ideal and does not seem
entirely consistent with `chaperone-of`, but allowing things like
threads and semaphores to be chaperoned creates non-trivial expense
internally. It would have been better to have event constructors for
threads and such to (and then the consyructed events could be
chaperoned without imposing a cost on the original data structure).
2019-12-29 19:19:09 -06:00
Matthew Flatt
b8a4e0535f thread: small simplification in scheduler 2019-12-29 11:35:06 -06:00
Matthew Flatt
c8f44d6597 cs & thread: remove redundant internal atomically 2019-12-29 07:08:15 -06:00
Matthew Flatt
e087059f21 add unsafe-bytes-copy!
Also, improve checking and performance of safe `bytes-copy!` in Racket
CS.
2019-12-28 10:55:57 -06:00
Matthew Flatt
085dd494d7 cs: speed up hash-map and hash-for-each on mutable hash tables
Specialize internal iteration to avoid the overhead of going though
the `hash-iterate-...` interface for each step.
2019-12-28 09:17:41 -06:00
Matthew Flatt
8b3fd15803 cs: simplify mutable hash table iteration
Remove some complexity that originally handled `eq?` unreliability on
flonums, which is no longer needed.
2019-12-28 09:00:20 -06:00
Matthew Flatt
2fcdd7c292 cs: improve equal?-based immutable hash
Check leaf hash code before a more general (and potentially much
slower) equality check.
2019-12-28 08:05:22 -06:00
Matthew Flatt
330ae24ce1 cs: tweak immutable hash-ref implementation
Force inlining of value and key accessors. Keeping the `define` with a
loop body --- that is, not making the individual function a macro ---
allows the Rumble `define` to avoid a closure allocation for the loop.
2019-12-28 06:23:25 -06:00
Matthew Flatt
c6e9d6cfd4 cs: unbreak racket with no command-line arguments 2019-12-26 07:04:35 -06:00
Matthew Flatt
e6e28fa8b7 cs: further corrections to racket command-line argument handling 2019-12-26 07:02:32 -06:00
Shu-Hung You
ccbd93e49c Stop -v from changing init-lib config 2019-12-26 07:02:24 -06:00
Matthew Flatt
15d7c439df fix name on port sent through place channel 2019-12-26 05:04:08 -06:00
Matthew Flatt
90abbb912d cs: guard internal hash traversals against GCed keys
Hash iteration can fail if a GC collects a key in between
`hash-iterate-next` and `hash-iterate-key` (and similar). Use the
optional extra argument internally to detect and handle that case.
2019-12-26 05:04:08 -06:00
shhyou
9db9991df6 Fix racket help string typo 2019-12-24 21:14:35 -06:00
Matthew Flatt
3710f45eba racket/dict: reduce assoc? tests
THe internal `assoc?` predicate is relatively expensive, so remove
redundant uses. Also, uses a cache to make it a little cheaper for
muliple uses of dictionary functions on a moderately sized list.
2019-12-24 07:18:03 -06:00
Matthew Flatt
4d001eb259 cs: further tune list?
Experiments suggest that 64 pairs is a better threshold to start
caching than 32 pairs.
2019-12-23 12:20:43 -06:00
Matthew Flatt
723232081c cs: faster list? 2019-12-23 05:36:08 -07:00
Paulo Matos
11e7598021
Pass ubsan flags to rktio build (#2987)
We have also removed ubsan flags from CPPFLAGS - since these are
compile flags, not preprocessing flags.

To pass the flags to rktio, we split the use of CFLAGS and CPPFLAGS
in rktio and ensure that flags in rktio do not update flags if make
is called in sub-make form (in a standard racket build, the rktio make
is called as a sub-make from the main racket make).

Fixes #2984

* Avoid export on variables in Makefiles

Instead pass the variables explicitly to the make call.

* Fix variable syntax

* Double quote variables

* Put ubsan back in CPPFLAGS

* Remove conditional assignment

This is not necessary if passing variables straight into sub-make
2019-12-23 09:18:34 +01:00
Matthew Flatt
f95abbbf85 cs: remove "GRacket3m.exe" from Racket CS build
When "GRacket3m.exe" is present, then "DrRacket3m.exe", etc.,
created created.
2019-12-22 11:07:17 -07:00
Matthew Flatt
f95beb40ad cs: check for too-large file-position argument 2019-12-22 10:07:30 -07:00
Matthew Flatt
41cc442779 fix extraction of numbers into a 64-bit value on 32-bit platforms 2019-12-22 09:50:08 -07:00
Matthew Flatt
71fb5e0f6a schemify: expose more functions to lifting
This improvement affects the interpreter's implementation, for
example.
2019-12-22 08:35:54 -07:00
Matthew Flatt
73ed7141aa cs: fix local struct for interpreter mode
Keep in `make-struct-type` form for performance and to get names right.
2019-12-22 08:35:54 -07:00
Matthew Flatt
8a4f21c7c8 cs: avoid unnecessary procedure unnaming in core 2019-12-22 08:35:54 -07:00
Matthew Flatt
c8c3647da5 cs: interpret short-lived compile-time code
Instead of compiling the right-hand side of a `let-syntax`, interpret
using the schemify layer's safe-for-space interpreter. Similarly,
interpret the right-hand side of `define-syntax` when it is evaluated
during the enclosing module's expansion (compiling it for use when the
enclosing module is instantiated for expanding other modules).

This is an old idea, and it's effective in some cases: `racketcs -cl
racket/base` or `racketcs -cl racket` takes 20% less time with this
change. Various obstacles kept us from trying this earlier; most
significantly, the gap to finish the safe-for-space interpreter was
small enough to make it work. It's not clear that the result is an
improvement for `raco setup`, though.

The interpreter is not fast (it's about 1/4 the speed of the
traditional Racket interpreter), so there's room for improvement,
but even a slow interpreter pays off for building.
2019-12-22 08:34:41 -07:00
Matthew Flatt
53d7387f6c fix compilation manager for machine-independent conversion
When recompiling modules from machine-independent mode to
machine-specific mode, dependencies of the module to be recompiled
must be checked explicitly, but using `module-path-index-resolve` is
not a good strategy, because it doesn't load transitive dependencies.
That can create a failure later when a transitive dependency is needed
for compilation and it isn't loaded because the dependent module was
already loaded.

Relevant to #2928
2019-12-19 17:35:22 -07:00
Matthew Flatt
6a023cddfa improve internal organization of the compilation manager 2019-12-19 12:55:56 -07:00
Matthew Flatt
02b534d571 update source "foreign.rktc"
Copies change in 91fa5b6490 to original source.
2019-12-19 08:29:52 -07:00
Paulo Matos
91fa5b6490
Drop use of deprecated ffi_prep_closure (#2988)
Use ffi_prep_closure_loc instead.

Fixes #2985
2019-12-19 16:09:37 +01:00
Matthew Flatt
31636870a9 place channels: clean up allocation arena after failed message 2019-12-19 06:31:42 -07:00
Brian Wignall
ffa6d2ef74 Fix typos, via a Levenshtein-style corrector (#2982) 2019-12-19 08:28:13 +01:00
Matthew Flatt
a135a868a8 cs: fix check for escaping procedure name 2019-12-18 06:42:33 -07:00
Matthew Flatt
bf1eb4351b cs: avoid procedure names generated by schemify
Also, escape names that may look like internal encodings.
2019-12-17 20:28:39 -07:00
Matthew Flatt
27eb177b9d add {symbol,keyword}->immutable-string and string-append-immutable
There could be many more functions that produce immutable strings
directly, and we want the default functions to do that in some future
language. For now, these three rae the most immediately useful for
avoiding unnecessary allocation in Racket CS.
2019-12-17 19:41:41 -07:00
Matthew Flatt
2270513c27 cs: fix procedure-extract-target for applicable struct result 2019-12-17 17:13:07 -07:00
Matthew Flatt
63bc848f79 expander: another approach to fixing nested instantiation
Mostly reverts ee4ceb7ae4 and tries a different approach. The prevoius
approach did not handle the case where the module begin instantiated
was tiggered by a module at a different (higher) phase.

Closes #2981
2019-12-17 14:02:45 -07:00
Sam Tobin-Hochstadt
6b1dad21eb Trim requires.
Eliminates another ~300 instantiations from `racket -cl racket/base`.

small-scheme.rkt is no longer used in `racket/private`.

c.rkt was an accidentally-committe file.
2019-12-17 13:02:47 -05:00
Matthew Flatt
81d73d9849 adjust raco pkg tests to work with Racket CS overlay
Commands that use `raco` need to be `racocs`, etc.
2019-12-17 08:38:04 -07:00
Matthew Flatt
d7f2bd3e15 cs: eval multiple expressions provided with -e 2019-12-17 07:30:47 -07:00
Matthew Flatt
899aa24756 cs: avoid problem waking up on TCP connect completion
Maybe there's a problem in `rktio_poll_add_connect` that I just can't
see, or maybe it's a Mac OS bug, but `rktio_poll_add_connect` doesn't
seem to reliably wake up the process when the TCP connection becomes
ready. Traditional Racket happens to avoid the problem by registering
the connection file descriptor with the semaphore table; doing that
for Racket CS also avoids the problem there.
2019-12-17 07:08:57 -07:00
Matthew Flatt
61000a454e cs: cooperate with immutable strings for symbols in Chez Scheme
Take advantage of new guarantees/support for immutable strings within
a Chez Scheme symbol representation. Consistent use of immutable
strings at the boundary avoids potential non-determinism.
2019-12-16 18:14:16 -07:00
Matthew Flatt
c7388f9fa8 places: repair clean-up after serialize failure 2019-12-16 12:33:14 -07:00
Sam Tobin-Hochstadt
f7c39512ab Modules with tests for unsafe mode can be cross-phase persistent.
Also, mark several more modules as cross-phase persistent.
2019-12-16 13:58:35 -05:00
Matthew Flatt
2d695be78c racket/promise: repairs for custodian change
Closes #2973

Note that the test is in the "lazy" package, commit 2cc3a24343.
2019-12-16 08:58:08 -07:00
Matthew Flatt
15c0e34bed cs: fix default constructor name and initial accessor/mutator name 2019-12-16 08:39:56 -07:00
Ryan Culpepper
6380df8aca
update expander logging (#2968)
This simplifies the expander logging in some places and adds logging for arming/disarming and scope changes (eg syntax-local-introduce) so the macro stepper can better track term identity.

This relies on corresponding changes to the racket/macro-debugger repo.
2019-12-14 01:27:24 +01:00
Brian Wignall
bcd8de5c9a Fix typos 2019-12-13 06:31:50 -07:00
Matthew Flatt
bf41fee58d fix argument check for instantiate-linklet
Closes #2962
2019-12-12 12:08:08 -07:00
Sam Tobin-Hochstadt
ce3992dbf3 Revert "Fix gen:dict methods for alists with duplicate keys (#2846)"
This breaks existing packages; see https://github.com/greghendershott/aws/issues/64
for an example.

Unfortunately, we probably have to live with this limitation of the
interface because of existing code.

This reverts commit 966399dec6.
2019-12-11 15:59:07 -07:00
Matthew Flatt
a191f77c15 rktio: fix Android workaround
When dynamic-library support moved to rktio, only one of two references
to (an arbitrary exported) function was updated.

Closes #2947
2019-12-11 15:21:17 -07:00
Matthew Flatt
843824c94e build with musl
Skip libunwind support for musl-based Linux environments, and avoid
`__FLOAT_BITS`, etc., in xform.
2019-12-11 14:32:56 -07:00
Fred Fu
4405ed669f add struct-type-property-predicate-procedure? 2019-12-10 10:01:11 -07:00
Paulo Matos
529c0e93a8
Correct which racket is built for CS bootstrap (#2952) 2019-12-10 09:17:43 +01:00
Matthew Flatt
a319b7e073 cs: wake up main thread blocked on fsemaphore
If a future posts to an fsemaphore that the main thread is waiting on
but went to sleep, then be sure to wake up the main thread.

Relevant to #2957
2019-12-09 07:18:16 -07:00
Matthew Flatt
6db1bdda1b cs: fix touch on a future blocked on a fsemaphore
Relevant to #2957
2019-12-09 06:25:39 -07:00
Matthew Flatt
db626bde3d schemify: don't copy uninterned symbols across module boundary
As pointed out by @gus-massa at racket/ChezScheme#15
2019-12-08 06:22:20 -07:00
Matthew Flatt
fc9ccb8e8f cs: unbreak boot file concatenation 2019-12-06 19:04:53 -07:00
Matthew Flatt
16f1ae7895 cs: add "repeats N more times" printing for error traces 2019-12-06 16:29:17 -07:00
Matthew Flatt
2e53a4c4ff schemify: deterministic order for some cross-inline info 2019-12-06 16:20:52 -07:00
Matthew Flatt
baab2b9974 cs: avoid full paths attached to functions
Source locations are attached to functions for backtraces. With
traditional Racket, those source locations are connected to the
machinery of `current-write-relative-directory` and
`current-load-relative-directory` to avoid absolute paths, but that
machinery is difficult to integrate into the Racket CS compilation
model. So, since they're "just" for stack traces, save only a couple
of elements of the path.
2019-12-06 16:20:52 -07:00
Matthew Flatt
a1567eb416 schemify: repair for JIT pass 2019-12-05 17:25:51 -07:00
Matthew Flatt
d7052da691 schemify: more determinism for lifted procedures
A further repair to 6f919635da.
2019-12-05 15:56:32 -07:00
Matthew Flatt
898517107f schemify: purge all gensyms
Although some of them probbably do not matter (while some certainly
do), avoid various possible problems by always using a locally
determinsitic replacement for `gensym`.
2019-12-05 14:41:33 -07:00
Matthew Flatt
d5ab0fce05 schemify: avoid gensym for struct-type representation
A gensym can end up in known-value information, which makes compiled
files non-deterministic.
2019-12-05 09:37:39 -07:00
Matthew Flatt
f5e6ce4282 schemify: name raw accessor/mutators
Inferred names show up as part of the compiled code, so make sure
they're normalized instead of gensyms.
2019-12-05 08:46:15 -07:00
Matthew Flatt
6f919635da schmeify: improve determinism by ordering lifted procedures 2019-12-05 07:06:28 -07:00
Matthew Flatt
1083aa1317 cs: improve function and module name
The former "path.rkt" module handles more than just paths.
2019-12-05 05:50:07 -07:00
Matthew Flatt
c93693169a cs: fix handling of an empty command-line argument 2019-12-05 05:43:31 -07:00
Matthew Flatt
1f92e98590 cs: fixes for uninterned symbols in compiled code
Use newly added support for uninterned symbols (as opposed to gensyms)
in the Chez Scheme layer. Using uninterned symbols reduces
non-determinsitsm in the build.

The change to use Chez Scheme uninterned symbols exposed problems with
the way that Racket-level uninterned symbols (formerly implemented
with gensym) are handled in ".zo" files. The problem is that some
uninterned symbols are marshaled with `racket/fasl`, which is not
consostent with those that are marshaled by Chez Scheme's `fasl`. This
patch fixes those problems by ensuring that uninterned symbols are
always lifted to the level of a Chez Scheme `fasl` for a complete
linklet bundle.
2019-12-04 21:11:42 -07:00
Matthew Flatt
4a36512570 cs: fix $value handling in fallback interpreter
Closes #2951
2019-12-04 07:06:50 -07:00
Matthew Flatt
1c74f8c956 improve names in keyword-function stack traces
Change the way names are generated for pieces of the implementation of
a keyword-argument function. These functions are not accessible as
values, so the names don't matter for printing a function, but the
names can show up in stack traces.
2019-12-02 07:03:09 -05:00
Alexis King
e9fb60588b Fix fcontrol with prompt tag 2019-11-30 05:34:32 -06:00
Matthew Flatt
406fe85144 cs: fix defined-name reporting 2019-11-29 16:48:52 -07:00
Matthew Flatt
ec9c30d2f1 cs: improve error message for define-values
Report the first variable of the `define-values` form, like
traditional Racket does.
2019-11-29 15:09:32 -07:00
Matthew Flatt
fa2ef64adb schemify: adjust simple? for multiple returns
The check for whether an expression is "simple" at the schemify layer
didn't take into account the expected arity.
2019-11-29 15:09:32 -07:00
Matthew Flatt
338955046d configure: repair for --enable-embedfw
`-S` needed for `strip` with some(?) versions of the Mac build tools.
2019-11-28 16:32:22 -07:00
Brian Wignall
9474b1a1e8 Fix spelling typos 2019-11-28 07:51:39 -07:00
Matthew Flatt
a410905c99 cs: module in some error messages only when enabled
Check `(error-print-source-location)` before adding a module name in
an error message about use/set before definition.
2019-11-28 05:51:48 -07:00
Matthew Flatt
8b00249265 schemify: another variable-order repair
Continues 70459f4105.
2019-11-28 05:39:11 -07:00
Matthew Flatt
2f4e4c5e6a configure: add --enable-embedfw for Mac OS
Building with `--enable-embedfw` creates executables that link
statically to the Racket runtime system, instead of linking to a
Racket framework, and that embed boot files in the case of Racket CS.

Executables built this way are meant to cooperate better with code
signing.

Related to #2910
2019-11-27 13:15:19 -07:00
Matthew Flatt
85459e5fef openssl: repairs related to listen on port number 0
Allow 0 as the port number in `ssl-listen`, and fix
`ssl-addresses` to work on a listener. Update a test
to use these features so that it won't conflict with
other tests that listen on TCP addresses.
2019-11-27 13:15:19 -07:00
lkh01
627d164a46 make syntax->string work with pairs and _
fixes #1628 and #1629
2019-11-27 13:57:45 -05:00
Matthew Flatt
ad7511dd29 place: fix place-kill for Racket thread simulation
Where true places are not supported, `place` is simulated
using Racket threads, and `place-kill` did not kill off the
simulated place well enough.

Relevant to #2930
2019-11-27 06:21:56 -07:00
Matthew Flatt
70459f4105 schemify: preserve variable assignment order at module end
A sequence of definitions (or `define-values`) at the end of
a module could get reordered. That only matters for the order
of checks for attempting to assign to a constant, though.
2019-11-26 16:16:34 -07:00
Matthew Flatt
80a29553c9 schmify: remove some unnecessary wrap tests
In many places, we know that we're dealing with plain pairs.
2019-11-26 16:16:34 -07:00
Matthew Flatt
0e87b8a73f cs & io: fix ellipses printing in structs that are partially opaque 2019-11-26 09:17:02 -07:00
Matthew Flatt
98f0c16b8c cs & io: name for default error value conversion handler 2019-11-26 08:55:35 -07:00
Matthew Flatt
e15a6f99d4 cs: more consistent arity errors
Suppress the compiler's conversion of statically obvious arity errors
to an expression that reports a custom error with the an S-expression,
since that interferes with Rumble's normalization of error messages.
2019-11-26 08:44:39 -07:00
Matthew Flatt
79981af50b cs: fix build-time arity check
Bootstrap properly to avoid problems on updates and version changes.
2019-11-26 08:44:39 -07:00
Matthew Flatt
afff5ca7ac cs: adjust default prompt abort handler arity error message 2019-11-26 08:44:39 -07:00
Matthew Flatt
6389b18b01 cs: fix prompt handler for module/eval prompt and multiple values 2019-11-26 08:44:39 -07:00
Matthew Flatt
256f57bfd8 openssl: adjust to make XonX mode work for Catalina
Same repair as #2859, but for XonX mode.
2019-11-26 04:47:01 -07:00
Matthew Flatt
1048341c62 cs & io: fix mode argument when print-as-expression is #f 2019-11-25 20:05:23 -07:00
Matthew Flatt
4c981258f6 cs: improve location info in backtrace
Provide paths instead of strings, and include position and span
information.
2019-11-25 19:00:33 -07:00
Matthew Flatt
254f6a4f14 cs: fix 'nonatomic allocation in 32-bit mode 2019-11-25 16:23:52 -07:00
Matthew Flatt
f3cfac8981 cs: fix popcount in data/bit-vector for 32-bit mode
Related to #2925
2019-11-25 15:06:09 -07:00
Paulo Matos
b1b8beece5
Use AC_CHECK_MEMBERS to check for dirent name length flds (#2923)
If `struct dirent` has `namlen` field, define `HAVE_DIRENT_NAMLEN`.
If the field is instead `namelen`, define `HAVE_DIRENT_NAMELEN` (case of QNX). 

Use this checks in `rktio_fs.c` and simplify `platform.h`.
2019-11-25 16:35:10 +01:00
Matthew Flatt
219bac7fe7 cs configure: propagate preprocessor flags to rktio 2019-11-24 08:10:47 -05:00
Matthew Flatt
cd4ce30ca6 avoid compiler warning 2019-11-24 06:58:02 -05:00
Matthew Flatt
ebbf578b6c cs: fix memset address handling 2019-11-23 20:19:50 -05:00
Matthew Flatt
e0851e6753 cs: range check on seconds->date 2019-11-23 20:19:39 -05:00
Matthew Flatt
c611f126fd JIT: fix 32-bit non-Mac stack alignment
Fix function-call setup to align the stack to a 16-byte boundary on
all platforms.
2019-11-23 17:33:08 -05:00
Matthew Flatt
0bb23c3998 cs: improve checking for "uuid.h" 2019-11-23 17:27:24 -05:00
Paulo Matos
aecee7ff30
Fix typos on windows build README (#2919) 2019-11-23 22:00:21 +01:00
Matthew Flatt
d1bfa6a203 cs: fix error reporting for struct selectors
Fix error reporting for non-inlined struct selectors to use Racket
style instead of Chez Scheme style.

Closes #2926
2019-11-23 15:39:27 -05:00
Matthew Flatt
7eb1ef9250 cs: fix printing on struct type with custom write
Don't try to use a struct type's custom-write procedure on the struct
type itself.

Relevant to #2926
2019-11-23 15:32:10 -05:00
Matthew Flatt
cd048cb1d0 repair arity problems
Fix many incorrect arity declarations and actual arities in Racket CS,
and fix several incorrect arities in traditional Racket. Building
Racket CS now checks the information in "racket/src/cs/primitives"
against both Racket variants to make sure that they're all consistent.

Closes #2924
2019-11-23 15:32:10 -05:00
Matthew Flatt
91190bee63 continuation-prompt-available?: repairs CS and non-CS Racket
Racket CS did not support the optional second argument for
`continuation-prompt-available?`. Traditional racket did not produce a
sensible result for the prompt tag that is used to delimit a
composable continuation or in some cases for the default continuation
prompt tag.
2019-11-23 14:56:17 -05:00
Reuben Thomas
7e3a8c9a3b In-place build: cope with default setting of prefix
configure scripts look for and read a local configuration file given by the
environment variable CONFIG_SITE. This can set variables such as prefix.

Racket’s build system was assuming that prefix would be set to NONE unless a
--prefix command line argument was given. But it could be set by a
CONFIG_SITE configuration file instead.

Hence, for in-place build add an explicit --disable-useprefix option, to
cause any prefix setting to be ignored, and use that in the top-level
Makefile.

Regenerate the configure scripts to get the updated code.
2019-11-18 18:25:37 +01:00
Reuben Thomas
fb9a4a219d Remove erroneously checked-in unused autoconf files 2019-11-18 18:25:37 +01:00
Sam Tobin-Hochstadt
532e649bfd
Clarify embedded executable issues (#2908) 2019-11-15 21:02:20 -05:00
Matthew Flatt
ee4ceb7ae4 expnder: fix problem with nested instantiation
A use of `local-expand` and other things in a module's phase-1
instantiation could trigger a nested attempt to instantiate a module.
2019-11-14 09:18:30 -07:00
Matthew Flatt
0cd7cdaa1f repair bytes-utf-8-ref for #\xFFFF result 2019-11-13 19:33:58 -07:00
Matthew Flatt
ea7452a3ed copy MIT and Apache license files in place on install 2019-11-12 20:15:54 -07:00
Matthew Flatt
52b01ef88b racket/runtime-path: add support for 'share paths
Support include-if-exists for files in the "share" directory analogous
to the include-if-exists support for files in "lib".
2019-11-12 20:10:06 -07:00
Matthew Flatt
3192c02b80 cs: fix struct-type-make-constructor
Support the optional name argument and fix the default name.

Closes #2905
2019-11-12 14:29:06 -07:00
Matthew Flatt
46a73b3d36 expose custom-{write,print-quotable}-accessor as accessor
Revert the part of 39a96dd699 that hides the provenance of these
accessors. Although exposing the fact that the predicates are for
structure properties constrains some internal representations, that
constraint seems unlikely to matter, and exposing the procedures as
property predicates is more consistent with the documentation and the
implementation (especially for Racket CS).

Closes #2904
2019-11-12 14:29:06 -07:00
Paulo Matos
b6627956b6
Improve gcc detection in configure script (#2897)
Improve gcc detection in configure script

We have been detecting gcc by the CC variable but this fails under
ubuntu for example where you might specify CC='gcc-8' to ./configure. 
Also consider clang impersonator to be gcc.

Related to #2890
2019-11-12 19:26:36 +01:00
Winny
3cb41850fa Separate GCC and GNU Make detection (#2902)
Related to #2890.

This ensures when GNU Make is `make`, the `version.mak` file is used
regardless of `CC`.
2019-11-12 10:19:19 +01:00
Matthew Flatt
19411c0dec configure: fix schver.h parsing
Related to #2890
2019-11-11 07:29:35 -06:00
Matthew Flatt
5eb04dfa9e add continuation-mark-set->iterator
Support continuation-mark inspection proportional to the amount that
needs to be inspected, instead of having to build a list of length
propotional to the size of a continuation.

In Racket CS, use iteration to improve exception-handling chaining.
Traditional Racket already used similar functonality internally.
2019-11-10 19:56:58 -06:00
Sam Tobin-Hochstadt
11d8f5c4ce
Mention relicensing in HISTORY.txt. (#2895)
* Mention relicensing in HISTORY.txt.
2019-11-08 10:32:16 -05:00
Matthew Flatt
d14940d22d racket/HISTORY.txt: update for v7.5 2019-11-07 10:14:37 -07:00
Matthew Flatt
470e82a65d adjust / on complex inexact numbers
Add a special case for a real divided by a complex, and remove
(probably) misguided special cases for inexact zero real and imaginary
parts. These changes bring complex `/` further in line for Racket and
Racket CS.

Related to racket/typed-racket#868
2019-11-06 05:33:25 -07:00
Matthew Flatt
ebd7cec834 expander: fix higher-phase variable/syntax provide tracking
The check for whether a provided identifier is syntax or a variable
cuold incorrectly inspect a module that is not yet prepared for the
relevant phase.
2019-11-05 19:36:41 -07:00
Jay McCarthy
2edea7db0d Fix typo 2019-11-02 13:45:16 -04:00
Sorawee Porncharoenwase
73250ae23e only do it for attributes 2019-11-02 10:52:10 -04:00
Sorawee Porncharoenwase
45968e8a3c Fix #2885: convert number entity to character 2019-11-02 10:52:10 -04:00
Matthew Flatt
e8f5501e29 module->exports: add information about defined name
Include the defined name (in addition to the provided name) in the
result of `module->exports` and `module-compiled-exports` --- but for
backward compatibility, only if the new optional `verbosity` argument
is 'defined-names.
2019-10-31 19:35:29 -06:00
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
Matthew Flatt
fe708871bd cs: avoid a leak due to prefab declarations 2019-05-26 11:56:25 -06:00
Matthew Flatt
f0c39b1f81 cs & threads: fix weak reference from custodian
Using a will executor to turn a reference from weak to strong still
seems like an ok idea, but it needs to be a regular will executor,
because a custodian-registered value is likely to involve have a
nested self-reference.
2019-05-25 18:31:15 -06:00
Matthew Flatt
e43bfd5767 cs: fix compression-conversion build step to support LZ4 2019-05-25 07:36:06 -06:00
Matthew Flatt
fb8368e373 cs: fix handling of non-typical make-struct-type forms
Some checks were missing to guard the transformation of a `struct`
expansion into a Chez Scheme `define-record-type` expansion.
2019-05-25 07:36:06 -06:00
Matthew Flatt
b33075f4c5 raco setup: fix target machine reporting 2019-05-25 07:36:06 -06:00
Matthew Flatt
3d3f1a408c get-lib-search-dirs: repair for cross-compile mode
More generally, repair the internal `exe-relative-path->complete-path`
function to work when the current directory is not the original
current directory and `racket` is started with a relative path.
Currently, it happens that `exe-relative-path->complete-path` is
called with a potentially different directory only by
`get-lib-search-dirs`.
2019-05-25 07:36:06 -06:00
Matthew Flatt
5896462e1a cs: uncompress boot files
When the compression format changed to LZ4, which is much faster to
decompress than zlib, the configure script changed to enable
compression by default. Bytecode tends to benefit all around from
compression, but the boot files take 20ms or so longer to load --- not
a lot of time when loading typical amounts of code, but a signficiant
cost for a minimal startup. This commit allows compression to be
controlled separately for boot files, and it configures them as
uncompressed by default.
2019-05-23 13:58:05 -06:00
Matthew Flatt
d9c8ef964c generate version string from individual numbers
Thanks to @sorawee for pointing me to
  https://stackoverflow.com/a/5459929/718349
2019-05-22 16:48:25 -06:00
Matthew Flatt
b219f92113 fix version number
Correct mistake in prvious commit.
2019-05-22 15:12:59 -06:00
Matthew Flatt
9178169370 bump version number
Syncing with the main Chez Scheme branch changes the header on
compressed bytecodes, so force recompilation of Racket CS ".zo"s.
2019-05-22 13:43:01 -06:00
Matthew Flatt
a23e0a3a57 cs: fix checking and arity of unsupported extfl functions 2019-05-22 10:36:42 -06:00
Matthew Flatt
ba0934521e cs: rewrite division-by-zero error message 2019-05-22 10:36:42 -06:00
Matthew Flatt
ceef969d48 cs: remove trailing space in error message 2019-05-22 08:37:22 -06:00
Matthew Flatt
55c8c12f2f planet: adapt to work with Racket CS overlay build 2019-05-22 08:30:41 -06:00
Matthew Flatt
0b74787419 cs: fix chaperone-of? for hash tables with nested chaperones 2019-05-22 08:30:20 -06:00
Paulo Matos
e2ab4869d7
Remove unnecessary MZ_USE_JIT (#2602)
* Remove irrelevant #ifdefs MZ_USE_JIT

Bonus points - fixes a compiler warning on aarch64 and a typo.

* Fixes a compiler warning on aarch64 for unused current_linklet_native_lambdas
2019-05-22 16:25:04 +02:00
Paulo Matos
ce76c673b1
Simplify conditionals after removing dead store of has_space (#2489)
* Simplify conditionals after removing dead store of has_space

The conditional simplification looks good to me. The biggest issue
here was to understand if when `pipe_quote` is true, we can and should
go to the else clause. Actually the more I look at it the more I think
this uncovers and earlier bug where if pipe_quote is true, result and
total_length are left at NULL and 0 respectively after the block.
2019-05-22 15:30:44 +02:00
Matthew Flatt
cd31b308af cs: sync error message for undefined identifier 2019-05-22 07:01:48 -06:00
Matthew Flatt
266c5eeb9b threads: fix for multiple threads with the same wakeup time 2019-05-21 13:57:42 -06:00
Matthew Flatt
7067ac8bfa cs: fix weak reference for GC-callback registration 2019-05-21 10:48:23 -06:00
Matthew Flatt
97672bb00c change datum->syntax treatment of code inspectors
Change `datum->syntax` so that it limits the transfer of a code
inspector from a source syntax object; the code inspector is kept only
if a macro is being expanded and the macro has the same code inspector
(or, more generally, the weaker of the two code inspectors is
preserved).

This change is a kind of defense-in-depth to prevent the use of
unarmed syntax with `datum->syntax` to access unexported bindings from
the module where a syntax object originates.

The general approach is Ryan's idea. This particular implementation is
a simplification of the general idea, and we'll see whether it's
worakble and sufficient.
2019-05-21 09:59:19 -06:00
Matthew Flatt
ed5bb40109 cs: implement compile-enforce-module-constants 2019-05-21 09:59:19 -06:00
Matthew Flatt
b268f77ae9 cs: fix vector-set! and set-box! impersonation
Use the result from an interposition to install into the vector or
box, instead of the original value.
2019-05-21 09:59:19 -06:00
Matthew Flatt
541a8e870f cs: fix struct constructor result for object-name 2019-05-20 06:48:08 -06:00
Matthew Flatt
55728352f4 schemify: optimize local struct declarations
Rewrite locally declared structure types to expose them to the
compiler in the same way as module-level declarations.
2019-05-20 06:48:08 -06:00
Paulo Matos
6e7920e204
Enable ubsan configure argument for CS (#2658)
* Refactor --enable-ubsan to m4 macro and include it from racket and cs
* Regenerate configure scripts
* upload ubsan artifacts even if it fails
2019-05-20 11:41:22 +02:00
Alexis King
18e897bfb8 expander extract: Improve purity analysis for struct type properties
The changes in aab63ad3 introduced a dependency on
racket/private/promise, which the analysis was not capable of dropping
due to the use of the `prop:force` property. This caused trouble for the
thread layer, since it introduced a reference to `error`, which is
defined in the io layer. This change adds some additional detection for
struct type properties with guards that accept procedures of particular
arities, which allows `prop:force` to be marked as pure.

Also, a typo in the thread layer’s Makefile meant globals weren’t
actually getting tracked, so this fixes that, too.
2019-05-19 10:48:04 -05:00
Alexis King
aab63ad31d Add for[*]/foldr[/derived] and reimplement for[*]/stream using it
`for/fold` is a left fold, which is normally what you want in a
call-by-value language such as Racket, but it makes efficient lazy
iteration difficult. This commit adds a new `for/foldr` iteration form
(along with `for*/` and `/derived` variants) that provides a right fold
operation that offers complete control over precisely how lazy the
iteration ought to be.

In simple microbenchmarks, reimplementing `for/stream` to use
`for/foldr` instead of `for` plus a generator can be almost 40x faster
on large streams.
2019-05-19 10:47:54 -05:00
Matthias Felleisen
52bde149f3 where to find the docs and the tests 2019-05-18 12:57:00 -04:00
Matthew Flatt
cc73ec8d69 reader: see new parameter values in read/recursive
When `read/recursive` is used, do not inherit parameter values
recorded by an enclosing `read`, and instead look them up again.
This change restores behavior of the old reader.

Closes #2661
2019-05-18 12:52:45 -04:00
Matthew Flatt
39fe53f5d5 reader: fix number->string case insensitivity
For example, `1+2I` and `+INF.FI` should parse as numbers.

Closes #2660
2019-05-18 12:22:01 -04:00
Matthew Flatt
236e2768f8 cs: fix structure-preicate-procedure? for some cases
Fix `structure-preicate-procedure?` on a predicate returned by a
`make-struct-type` call that isn't effectively inlined by schemify.
2019-05-18 12:22:01 -04:00
Matthew Flatt
2c16beb942 cs & threads: fix plumber flushing interleaved with addition
A plumber is supposed to gather all callbacks before running any of
them so that callbacks added by a callback are not run.
2019-05-18 12:21:51 -04:00
Matthew Flatt
7f92443a5f adjust printing of renamed procedures
When ">" appears in a procedure name, or when other characters appear
that would normally need to be escaped in a symbol, don't add escapes
since `#<....>` isn't readable anyway. This change makes renamed
procedures print in a consistent way with primitive procedures.

Similarly adjust the printing of structure type names.

Closes #2646
2019-05-18 09:55:23 -04:00
Matthew Flatt
a56c984db0 avoid incorrect unix-style inference
Closes #2659 by both recognizing `lib64` as a default path and by
having `--enable-origtree` override inference and specified when
running `configure` through the root makefile.
2019-05-18 07:56:02 -04:00
Matthew Flatt
cc487a4d9a cs: fix incorrect impersonator discard in chaperone-of? 2019-05-18 06:39:37 -04:00
Matthew Flatt
b3f66a4973 repair prop:impersonator-of interaction with {impersonator,chaperone}-of?
Relevant to #2644
2019-05-18 06:39:37 -04:00
Alexis King
6ae082fccd class/c: Swap after, not before, adding #:important blame context
Swapping the blame before adding #:important context associates the
important party with the negative party for the purposes of picking
“contract violation” versus “broke its own contract” messages in error
reporting. Therefore, only swap after adding the context.

fixes #2531
2019-05-17 19:57:26 -05:00
Matthew Flatt
ddb944d583 improve precision of / on complex numbers with small parts
Closes #2654
2019-05-14 07:57:03 -06:00
Matthew Flatt
0d55a05b46 cs: fix a case in unsafe-add-collect-callbacks
Fix a function-call shape that is used for GTK+2.
2019-05-12 14:45:26 -06:00
Matthew Flatt
ff95f1860a io: fix hostname lookup for tcp-listen
Need to lookup with "passive" flag. Some platforms/configurations
apparently don't care, but some do.
2019-05-11 18:56:57 -06:00
Paulo Matos
a672ac9907
Fix simple typo
s/emable/enable/
2019-05-11 17:48:01 +02:00
Matthew Flatt
59d5300f77 makefile: fix configure dependencies
Reconfigure if "cfg-racket" changes without "configure" changing.
2019-05-10 21:21:54 -06:00
Lukas Lazarek
001eeded9f racket/contract: Fix (box/c #:immutable #f) failing on mutable boxes 2019-05-10 21:05:23 -05:00
Matthew Flatt
bfe649bcc7 adjust GC behavior to be more usable without generational collection
Instead of limiting the nursery size and performing a full GC every
time a small nursery is full, allow the nursery to be proportional
to the total heap size if generational GC is disabled.
2019-05-10 19:45:05 -06:00
Paulo Matos
7c3a207f36 Add configure option --enable-generations (enabled by default).
This option allows the user to enable or disable (with
--disable-generations or --enable-generations=no) generations in
3m. Disabling generational collection is, in most cases, a bad
idea, but it may be necessary on a platform where signal handling
doesn't work well enough to support a write barrier that is
implemented with page protection.
2019-05-10 19:44:46 -06:00
Matthew Flatt
eeaac9c142 avoid unspecified NULL passed to memcpy
Closes #2632
2019-05-10 19:35:38 -06:00
Matthew Flatt
bb7836e734 cs: support --enable-natipkg 2019-05-10 17:35:53 -06:00
Paulo Matos
75cc43aa56
In autoconf 2.70 variable runstatedir was added - ignore (#2606)
Ignore new autoconf variable added in 2.70.
The interesting thing is that debian decided to backport this variable
to their 2.69 release so in some 2.69 autoconf this variable does not
exist but in debian ports 2.69 generates this variable. It is
nonetheless not useful for Racket, so add to ignore list.
2019-05-10 18:19:49 +02:00
Matthew Flatt
d5a46eb39d cs: repair build without --enable-racket
When using a built-for-bootstrapping Racket to build Racket CS, the
intermediate module loading module mode should be `--boot` instead of
`--chain`. The repo's top-level makefile takes care of that already,
but not `configure`-generated makefiles as may happen in a build from
a source distribution.
2019-05-10 07:20:31 -06:00
Robby Findler
2c3fce244c added #:unprotected-submodule 2019-05-08 20:32:04 -05:00
Matthew Flatt
b7d738d59a cm: fix lock more
Still trying to get it right for the repair started in 70e0cac062 and
continued in ef1004fdc0.
2019-05-06 20:17:38 -06:00
Matthew Flatt
93d84170d0 read: fix #e after #x
Corrects a bug in 0549bfb1e5 where `#x` causes the `e` in `#e` to be
interpreted as 14 instead of the character `#\e`.
2019-05-06 08:14:20 -06:00
Matthew Flatt
bed23e221e update racket HISTORY.txt for v7.3 2019-05-06 07:34:55 -06:00
Matthew Flatt
83ad6bd7c1 cs: fix banner and make startup use it
The string returned by `banner` was missing a "v" and a "." compared
to the traditional result. Avoid duplicating the string in "main.sps".
2019-05-05 17:34:04 -06:00
Matthew Flatt
151b5755c5 cs: repairs for inaccessible custodians and custodian boxes
Allows an inaccessible custodian to be GCed, promoting any values that
it manages to its parent custodian. Also repair memory accounting for
custodian boxes.

For values referenced by a custodian, the nature of the custodian's
weak references is slightly different on Racket CS. The reference is
weak enough that the value can be finalized via will (e.g., to close
an unused port), but it's not weak enough to allow weak boxes, weak
hash table keys, or ephemeron keys to be cleared. That's a consequence
of using ordered finalization instead of finalization/weakness levels.
This difference could be avoided at the cost of an extra wrapper for
any finalized value and a discipline of using such wrappers as the
user-visible reference for all custodian-managed values, but semi-weak
references so far appear to be practical and a better compromise.
2019-05-03 19:16:45 -06:00
Matthew Flatt
9951efc891 cs: fix unsafe-thread-at-root to use the root custodian
Otherwise, a finalization thread can get shut down, resulting in a
leak.
2019-05-03 15:00:33 -06:00
Matthew Flatt
ef1004fdc0 cm: fix lock
Commit 70e0cac062 neglected to use `#:for-lock? #t` as intended.
2019-05-03 12:57:58 -06:00
Matthew Flatt
f52fdfdd6e expander: preserve inlining annotations in machine-independent bytecode 2019-05-03 10:36:42 -06:00
Matthew Flatt
920c899ba8 thread: adjust use of later will executor for custodian
The use of a will executor for a custodian is a bit of a hack, and it
doesn't want the "keep live until executed" constraint. So, add an
optional internally.
2019-05-03 06:28:25 -06:00
Matthew Flatt
e13fac3ccf foreign: document internal make-late-will-executor
Also, rename from "stubborn" to "late" internally to be more
consistent and avoid overloading "stubborn" in the allocator.
2019-05-03 06:20:11 -06:00
Matthew Flatt
032479cf2c keep late will executors live with pending wills
If a late will executor has pending will, then it needs to stay
live until the enclosing place has terminated (and post-custodian
callbacks are run). Otherwise, `ffi/unsafe/alloc` can lose values
that it expects to finalize, and it reports an "internal error".

The late will executor for `register-finalizer` from `ffi/unsafe`
was kept live in traditional Racket, but only as an accident of
custodian shutdown in a terminating place: the shutdown process skips
threads, since that work is technically not necessary. Relying on that
coincidence is asking for trouble, though, so implement retention more
deliberately.
2019-05-03 05:39:15 -06:00
Matthew Flatt
358764faac cs: fix retention of late will executors
A late will executor must stay live as long as it has finalizations
registered.
2019-05-03 05:38:54 -06:00
Matthew Flatt
8f5f0a4330 cs: implement foreign-call locks 2019-05-02 20:09:43 -06:00
Matthew Flatt
d5243820f6 cs & schemify: faster ptr-ref and ptr-set! on primitive types
Recognize `(ptr-ref <ptr> _uint8)`, etc., and turn it into a more
direct `(ptr-ref/uint8 <ptr>)`, etc. This improvement speeds PNG
loading by a factor of 10 to 20, for example, because the
implementation expects the pattern to be recognized.
2019-05-02 17:31:40 -06:00
Ben Greenman
a13070f302 racket/contract: improve fast-append
test whether the 2nd arg is null once, rather than N times
2019-05-02 11:35:55 -04:00
Ben Greenman
721ef2050f racket/contract: move comment
Move a comment closer to the code it talks about
2019-05-02 11:35:55 -04:00
Matthew Flatt
5b929a7621 io: fix port custodian unregister
Make unregister match the register change in 11789ff8b0.
2019-05-02 07:26:20 -06:00
Matthew Flatt
651fc3ae5e ffi/unsafe/com: use ffi/file instead of C API 2019-05-01 14:43:36 -06:00
Matthew Flatt
92c12de018 cs: implement prop:exn:srclocs in exn:fail:read 2019-05-01 14:43:36 -06:00
Matthew Flatt
fb968db7a5 cs & thread: detect plumber-flush errors on place exit 2019-05-01 13:46:46 -06:00
Matthew Flatt
cfeef54a28 cs & threads: run post-custodian shutdown actions on place exit 2019-05-01 13:22:47 -06:00
Matthew Flatt
193bec6b7d cs & threads: more place-message repairs for graphs 2019-05-01 09:24:39 -06:00
Matthew Flatt
9268dcaad3 cs: better handling for contended hash-table locks
When the number of places approaches the number of available
processing cores, then a spin lock isn't good enough for a small
number of contended hash tables (maybe just one of them). When
contention is discovered, fall back to a mutex-based lock.
2019-05-01 09:24:39 -06:00
Alexis King
1101461434 rktio: Make sure not to close subprocess standard in/out/err
When spawning a new subprocess, it's possible that one or more of the
new process's standard input, output, or error descriptors use file
descriptor 0, 1, or 2, even if they don't correspond to any of the
parent process's original standard input, output, or error descriptors.
This can happen if the parent process closes one of its standard
descriptors, and the operating system reuses the file descriptor number
for a new descriptor.

Therefore, be more careful about closing and copying file descriptors in
the child process before calling `exec`. Specifically, move file
descriptors out of the way as needed so they aren't clobbered, and
accommodate cases where multiple standard streams may share the same
file descriptor in the parent process.

fixes #2634
2019-05-01 09:10:33 -05:00
Matthew Flatt
f3de3e4584 cs & threads: repairs for places
Includes a repair for handling vectors and prefab structs that are
involved in cycles.
2019-04-30 20:28:38 -06:00
Matthew Flatt
635c64e8bb racocs make: repair --no-deps destination 2019-04-30 19:00:52 -06:00
Matthew Flatt
1de69c4d37 cs & thread: repair retention of subcustodians
A subcustodian was incorrectly registered as weak for its parent,
which means that an unreferenced custodian could get lost when
shutting down an ancestor.
2019-04-30 18:10:17 -06:00
Matthew Flatt
dcb0f422a9 cs & io: fix shared byte strings over place channels 2019-04-30 17:46:10 -06:00
Matthew Flatt
f5836d7a30 racket/rerequire: repair for Racket CS 2019-04-30 17:46:10 -06:00
Matthew Flatt
5f53c91c6e cs: repair make-sibling-inspector 2019-04-30 17:46:10 -06:00
Matthew Flatt
164442ab26 fix place-message-allowed? on an empty vector 2019-04-30 17:46:10 -06:00
Matthew Flatt
436f3d8f64 io: fix handling of sharing in place messages 2019-04-30 17:46:10 -06:00
Matthew Flatt
11789ff8b0 io: fix socket/fd port custodian registration
Register the port, not the file descriptor, especially since a TCP
connection can have ports that share a file descriptor. Also, I think
a weak reference in the custodian doesn't work as intended (visible
through finalization) if the file descriptor is referenced with a
callback that closes over the port.
2019-04-30 14:40:17 -06:00
Matthew Flatt
cf08436e05 cs: fix custodian shutdown of TCP to use shutdown
In other words, send an EOF over TCP on custodian shutdown.
2019-04-30 14:40:17 -06:00
Matthew Flatt
258fb8fafd cs: use print-as-expression in default print handler 2019-04-30 14:40:17 -06:00
Matthew Flatt
a3fcaf92df racket/class: remove excessive syntax-protect
No `syntax-protect` is needed for `define/private`, etc., because no
new identifiers or expressions are introduced. Adding extra dye packs
can interfere with other macros that pull apart syntax (although maybe
the macros shouldn't do that without using `syntax-disarm`).
2019-04-30 09:07:59 -06:00
Matthew Flatt
dd22b8b599 io: correct custodian assumption
A custodian doesn't provide any order on shutting down the objects
that it manages (I was confused about some past experiments), so
avoid that assumption.
2019-04-29 17:39:24 -06:00
Matthew Flatt
b3b240ebc7 rktio: correct problem with change to growable poll set 2019-04-29 16:09:48 -06:00
Matthew Flatt
c4f44eaedd cs: fix cross-build bootstrap
Fix the relevant makefile target.
2019-04-29 13:29:09 -06:00
Matthew Flatt
bd5677da70 Revert "cs: fix cross-build bootstrap"
This reverts commit e13fcd6226.

Wasn't the right change, because the modified targets aren't used for
a cross build.
2019-04-29 13:29:09 -06:00
Ryan Culpepper
77a54c1af6
ffi-lib: log success, log failures with candidates tried (#2566) 2019-04-29 16:52:23 +02:00
Matthew Flatt
535bfcb0c3 cs: repair shared poll set initialization
Esspecially affects filesystem change events on Mac OS and BSDs.
2019-04-29 07:41:11 -06:00
Matthew Flatt
5c7d7aae68 rktio: fix fd leak in filesystem-change-evt with kqueue
Affects Mac OS and BSDs.
2019-04-29 07:41:11 -06:00
Ryan Culpepper
cbfaf428d2 syntax/parse: add describe frame if opaque even if no description
fixes #2627

Also fix a bug where eh-alternatives were mistakenly marked opaque.
2019-04-29 09:00:19 +02:00
Matthew Flatt
8f0fb72160 repair chaperone handling in potential place messages
Closes #2630
2019-04-28 10:27:34 -05:00
Matthew Flatt
e13fcd6226 cs: fix cross-build bootstrap 2019-04-27 19:53:21 -05:00
Ben Greenman
1a4192f697
typo: reword install/clone error message (#2609) 2019-04-27 11:43:21 -04:00
Alexis King
930046e729 wrap-expr/c: Add #:phase argument to control phase of introduced syntax
closes #2455
2019-04-26 12:34:27 -05:00
Ryan Culpepper
1481f3e8d9 sqlite3: fix reporting of insert-id 2019-04-26 13:35:08 +02:00
Matthew Flatt
8d77b8403c cs-boostrap: repairs to work in Racket CS 2019-04-25 20:45:42 -06:00
Matthew Flatt
01eec4ef9a expander: more reserved names to accomodate schemify
Compiling the Chez Scheme bootstrap library in Racket on Chez Scheme
is a good way to discover missing reserved symbols.
2019-04-25 20:04:14 -06:00
Matthew Flatt
c59ba15522 cs: unbreak async foreign callbacks
Adds a changed missed in 1624193210.
2019-04-25 19:52:00 -06:00
Matthew Flatt
776996fe24 cs: implement unsafe-{file-descriptor,socket}->semaphore
Use `unsafe-{file-descriptor,socket}->semaphore` internally to
make scheduling scalable for threads blocked on sockets, like
traditional Racket.
2019-04-25 19:29:33 -06:00
Matthew Flatt
05fe76f49a repair module name resolver
Revert an accidental change in 2d3ee903ec.
2019-04-25 17:19:47 -06:00
Matthew Flatt
2d3ee903ec cs: implement filesystem change events 2019-04-25 16:12:01 -06:00
Matthew Flatt
20672cd60a make Chez Scheme bootstrap work as a "cs-bootstrap" package 2019-04-25 10:09:26 -06:00
Matthew Flatt
1624193210 reduce overhead and precision of per-thread cpu times
Getting the current CPU time is relatively expensive, so get it only
on thread swaps where a thread used its full quantum or 1/100 swaps
otherwise. This approximation should work because thread-specific CPU
times are rarely requested, and they make the most sense for threads
that don't constantly swap out due to synchronization.
2019-04-25 08:23:32 -06:00
Matthew Flatt
84deff1d02 cs: more explicit handling of acessor/mutator errors
Formerly, an expression like `(arity-at-least-value 7)` could crash,
because the `arity-at-least-value` accessor is created in unsafe mode,
and the slow path to accessor errors attempted to use the accessor to
provoke an error message. Instead of using a potentially unsafe
accessor, have the slow path raise an error explicitly with
`raise-argument-arror`. That change has the added benefit of making
error messages mach traditional Racket (at least for structure types
that are not declared as "authentic").

The problem was exposed by tests added in 55dcdf5538.
2019-04-24 16:50:49 -06:00
Matthew Flatt
a600991ff7 cs: fix typo in error-message constructor 2019-04-24 15:42:26 -06:00
Matthew Flatt
92e937032d cs: repair number->string on most negative fixnum 2019-04-24 15:40:58 -06:00
Matthew Flatt
fa1861869e cs: use continuation marks for module context
Instead of a separate hash table mapping continuations to
linklet-instance names, use a continuation mark. That's faster,
because capturing a continuation means copying part of it on continue.
2019-04-24 15:05:46 -06:00
Matthew Flatt
688f03e208 cs: avoid some hashtable overhead during linklet instantiation 2019-04-24 12:54:38 -06:00
Matthew Flatt
a0b1791a9d declare deserializaton helper linklet as consistent
Declaring as consistent avoids some application indirections on Racket
CS, for example.
2019-04-24 12:33:00 -06:00
Matthew Flatt
42009925dc cs: reduce allocation on linklet instantiation
Avoid some closure creations and `append`s. The performance
improvement is very small, but measurable.
2019-04-24 11:03:04 -06:00
Matthew Flatt
d69f5cf00f cs: restore cross-module optimization
A backwards `if` in a7988c3813 disabled cross-module optimization.
2019-04-24 10:39:05 -06:00
Matthew Flatt
20e669f478 adjust local-require to help Check Syntax
Currently, Check Syntax has trouble correlating `require` forms and
references to imports that go through a macro-introduced rename
transformer. For example, there's no binding arrow from the final
`starting` to the `racket/list` in

 #lang racket/base
 (require (for-syntax racket/base))

 (define-syntax-rule (define-as-first mod starting)
   (begin
     (require (only-in mod
                       [first initial]))
     (define-syntax starting (make-rename-transformer #'initial))
     starting))

 (define-as-first racket/list starting)
 starting

But change the last two `starting`s to `initial`, and the binding
arrows work.

Until a general repair is in place for Check Syntax, this commit
adjusts 38d612dba6 to use the original export name for an immediate
binding, which acts as a hint to the current Check Syntax
implemenration.
2019-04-24 07:59:06 -06:00
Philip McGrath
c838d01c09 typo: inatll -> install 2019-04-24 06:12:19 -06:00
Matthew Flatt
31101c57db bytecode compiler: fix coordinate problem in letrec check
Example provided by Jay
2019-04-23 18:19:42 -06:00
Alexis King
72ab50a993 Establish free-id=? equivalences in intdefs with local bindings in scope
fixes #2594
2019-04-22 22:50:16 -05:00
Alexis King
38d612dba6 local-require: Remove last remaining use of syntax-local-get-shadower 2019-04-22 22:49:14 -05:00
Matthew Flatt
701a86b863 source "README.txt" corrections related to Racket CS builds 2019-04-22 19:06:24 -06:00
Matthew Flatt
e001f3b3cb include ChezScheme sources in a source distribution
Note that the source-distribution client must have a
"build/ChezScheme" checkout created, maybe by building as a 'cs
variant. A pruned version of that checkout is then included with other
sources. The resulting source distributon then works for building
either Racket variant.

Adapt the configure scripts and makefiles to use a "ChezScheme"
directory that is bundled with sources.
2019-04-22 16:56:17 -06:00
Matthew Flatt
21ad81b4fc cs bootstrap: move struct declaration to centralized module
Keep together declarations that need to match the Chez Scheme
implementation.
2019-04-22 07:24:38 -06:00
Gustavo Massaccesi
55dcdf5538 fix jit-inlining of struct primitives
Some expressions like (date-day) gave usually an arity error, but when they
were inlined by the JIT the arity check was wrong, so they produce a segfault
or a nonsensical result.
2019-04-20 20:09:57 -03:00
Matthew Flatt
4b586eeadf cs: faster Chez Scheme bootstrap
Improve record encoding to make it more exposed to the compiler.
2019-04-20 13:27:02 -06:00
Matthew Flatt
8c8979369f cs: switch Chez Scheme download to racket/ChezScheme at GitHub 2019-04-20 08:32:36 -06:00
Matthew Flatt
e2de99f0b9 cs: adjust build to use Racket bootstrap of Chez Scheme 2019-04-20 08:25:20 -06:00
Ben Greenman
f26b793e9a recursive contract: add else-branch to a cond
Raise an exception if none of the other cases match, instead of
returning `(void)` where a contract is expected
2019-04-19 20:43:44 -05:00
Matthew Flatt
e337c65204 implement bootstrap of Chez Scheme using Racket
Provide a way to build Chez Scheme from source using Racket. In the
short run, this lets us distribute source that ultimately depends only
on a C compiler (since a variant of Racket can be built from source
using just a C compiler).
2019-04-19 13:45:50 -06:00
Matthew Flatt
7e9d167101 expander: fix namespace-require/copy for some require specs 2019-04-19 13:44:14 -06:00
Ben Greenman
6d7550125f typo: change error messages for vectorof contract
- change an 'an' to 'a'
- remove 'immutable' where expecting either mutable or immutable (don't
  bother to specify which, because `vector-common.rkt` doesn't bother)
- remove extra ','
2019-04-18 07:15:08 -05:00
Matthew Flatt
e1ad8d4721 cs: fix path on discovered Chez Scheme library name
Corrects 8a368cac99.
2019-04-12 06:56:07 -06:00
Matthew Flatt
615677299e switch Mac OS back from poll to select
The `poll` system call doesn't work right for fifos, so switch
back to `select`, but use a new strategy to size fd_set buffers
instead of trying to use `getdtablesize` (because the result
of `getdtablesize` can change dynamically on Mac OS).

Also, add a check for input at the rktio level when trying to read
from devices other than regular files. Otherwise, Racket CS (which
doesn't have some redundant polling that is in traditional Racket)
sees spurious EOFs for unconnected fifos.

Closes #2577
2019-04-10 12:34:40 -06:00
Matthew Flatt
4c53b514cf cs: correction on compiler flags for object-name
Repairs a mistake in 40b8b5c675.
2019-04-10 07:55:24 -06:00
Matthew Flatt
8a368cac99 cs: fix discovery of Chez lib name on Windows 2019-04-10 07:52:11 -06:00
Paulo Matos
9e8b9d8959
Remove value store in ready_pos but unread (#2588)
* Remove value store in ready_pos but unread

* Move declaration of ready_pos to where it is used

* Make discard of return value of tcp_check_accept explicit

* Split declaration and var assignment to comply with xform
2019-04-10 14:14:57 +02:00
Paulo Matos
5a3d7b87e4
Remove dead assignment to ch (#2589)
Remove dead assignment to ch and make discard return value explicit
2019-04-10 08:37:37 +02:00
Paulo Matos
2919d21d1d
Remove dead assignment to target_offset (#2590) 2019-04-10 08:34:06 +02:00
Paulo Matos
93224561f8
Fix --enable-cify option (#2598)
I guess, a previous copy-paste AC_ARG_ENABLE meant that cify never had
its own option.
2019-04-10 08:32:52 +02:00
Matthew Flatt
40b8b5c675 expander extract: improve pure-function analysis
Improve the analysis enough to handle changes to
`make-keyword-procedure` (in 47467a1dba) and restore the Racket CS
build.
2019-04-09 16:12:31 -06:00
Gustavo Massaccesi
9f9b3f4443 cs: fix check of Chez Scheme version
Merge to v7.3
2019-04-09 18:03:57 -03:00
Matthew Flatt
ef49ccf87a cs: fix chaperone-struct on accessor/mutator taking a position
Closes #2570
2019-04-09 11:53:27 -06:00
Matthew Flatt
247c985702 cs: faster (current-memory-use 'cumulative)
A slow `(current-memory-use 'cumulative)` could causes misleading
results in `PLT_EXPANDER_TIMES` output for frequent actions.
2019-04-09 11:53:27 -06:00
Matthew Flatt
d61f56c77f cs: imprve fixnum hashing
Avoid collision for 0 and -1, for example.
2019-04-09 11:53:27 -06:00
Matthew Flatt
cc45dc044d cs: faster number->string on fixnums 2019-04-09 11:53:27 -06:00
Alexis King
1bf416a776 Make equal? on classes and objects see through class contracts
Making `equal?` do the right thing on classes turned out to be easy---it
just involved adding a straightforward `prop:equal+hash` property to the
`class` struct—but making it work properly for *objects* was the tricky
part. The trouble is that `equal?` on objects that don’t implement the
`equal<%>` interface is just ordinary structure equality, which can be
relevant if objects are inspectable. Writing `(inspect #f)` in a class
body is like making a struct `#:transparent`, and it has all the same
ramifications for equality.

The trouble is that `class/c` creates new wrapper classes, and every
class has its own struct type. Since the default behavior of `equal?` on
structs is to *never* be equal to structs of different types, even
subtypes, an object created from a contracted class can never be
`equal?` to an object created from the same class without contracts.

The solution is to add a `prop:equal+hash` property to `object%` itself
that emulates the default behavior of `equal?`, but sees through class
contract wrappers. Since struct type properties are inherited by
subtypes, this property will be present on all objects, and it only
needs to be attached once.

fixes #2279
2019-04-09 12:27:27 -05:00
Alexis King
47467a1dba Avoid creating procedures with internal source locations as names
Mainly, this improves `make-keyword-procedure`: when applied to a single
argument, it now uses `procedure-rename` to ensure the resulting
procedure has the appropriate name. A couple other changes also guard
against the case where a lambda expression has no inferred name and no
source locations information, which would lead to the source locations
in the implementation being used, instead.
2019-04-09 12:27:11 -05:00
Matthew Flatt
0d2dd8f578 cify: fix multiple-value return where braces are needed
Merge to v7.3
2019-04-08 13:15:19 -06:00
John Clements
5ce11626ef Post-release version for the v7.3 release 2019-04-08 10:55:30 -07:00
Paulo Matos
b9b6d97b30
Make second argument of scheme_os_getcwd a size_t (#2584)
By being an unsigned type, we ensure that when 0 is passed we know
that there's no smaller number. This aids the static analyzer.
2019-04-08 17:25:43 +02:00
Matthew Flatt
e6aef1093b expander: fix submodule order nondeterminism
The nondeterminstic order could lead to a mismatch that caused
Racket CS to crash on submodule tests.
2019-04-08 07:23:47 -06:00
Matthew Flatt
d87be8789e cs: use new $record-ref, etc., primitive
Also, speed up hashing and logging a little by adjusting semaphores to
succeed with `$record-cas!` when no waiting is necessary.
2019-04-08 11:13:01 +02:00