Commit Graph

6065 Commits

Author SHA1 Message Date
Matthew Flatt
4c836a1dd1 rktio: always set signal mask to empty after fork
Saving and restoring the signal-mask state does not work right, since
rktio itself may block SIGCHLD in some cases, and it doesn't seem
useful/right to preserve the mask after fork.
2021-02-12 16:50:32 -07:00
Matthew Flatt
3e2245d40e rktio: unbreak for Windows 2021-02-11 17:39:07 -07:00
Matthew Flatt
eba9be1b39 cooperate with nohup
If SIGHUP is initially ignored, don't set a SIGHUP handler.
2021-02-11 15:27:29 -07:00
Matthew Flatt
2cbaeb7865 Unix: restore all signal handlers after creating a subprocess fork
For each signal handler that is changed, save its state, and restore
the state in a child process after a `fork` and before an `execve`.
Also save and restore the signal mask.

This change requires cooperation from various subsystems, which often
takes the form of a callback registered with the subsystem to be
called before adjusts a signal handler.

Closes #3609
2021-02-11 15:27:29 -07:00
Anish Athalye
c07e9cde09 Improve errors for forbidden ops on weak sets
Forbidden set operations on weak sets produced slightly confusing error
messages:

    > (define s (weak-set))
    > (set-add s 42)
    ; set-add:
    ; expected: (not/c set-mutable?)
    ; given mutable set: (weak-set)
    ; argument position: 1st
    > (set-mutable? s)
    #f

Invoking an operation that required an immutable set gave a message
saying that a `(not/c set-mutable?)` was expected, but a `weak-set` is
not recognized by `set-mutable?`, which only recognizes mutable sets
with strongly-held keys. Changing `set-mutable?` to recognize weak sets
seems undesirable.

This patch changes the error message so that the above example produces
the following error:

    > (define s (weak-set))
    > (set-add s 42)
    ; set-add:
    ; expected: (not/c (or/c set-mutable? set-weak?))
    ; given mutable set: (weak-set)
    ; argument position: 1st
2021-02-11 12:41:46 -05:00
Matthew Flatt
0137c1c545 Chez Scheme: repair expected-error log 2021-02-10 07:55:23 -07:00
Bogdan Popa
f3793bb4d7 xexpr: micro-optimize xexpr-write
This improves write performance by between 15% and 40% on large xexprs.
2021-02-10 09:09:39 -05:00
Matthew Flatt
9f6f988150 Chez Schme: change struct predicate implementation
Instead of keeping a rectord type's ancestry in a vector ordered from
subtype to supertype, keep the vector the other way around, and
include a record type at the end of its own vector. This order makes a
more direct test possible when checking for a known record type,
especially one without a supertype, and it's generally easier to
reason about.

The revised compilation of record predicates trades some speed in one
case for smaller generated code and speed in other cases. The case
that becomes slower is when a predicate succeeds because the record is
an immediate instance of the record type. The cases that go faster are
when a predicate fails for a non-instance record or when a predicate
succeeds for a non-immediate instance. It's possible that an
immediate-instance shortcut is worthwhile on the grounds that it's a
common case for a predicate used as contract, but we opt for simpler
and less code for now, because the difference is small.

Also, add `record-instance?`, which in unsafe mode can skip the check
that its first argument is a record, and cptypes can substitute
`record-instance?` for `record?` in some cases. This change was worked
out independently and earlier by @yjqww6, especially the cptypes part.

Related to #3679
2021-02-10 06:53:53 -07:00
Matthew Flatt
3a49533ff5 fix accidental change 2021-02-07 13:45:54 -07:00
Matthew Flatt
8a08704012 cs: support Android on 32-bit and 64-bit ARM
Various configure and makefile improvements apply more broadly to
environments that, say, lack iconv or target 32-bit ARM without Thumb.
2021-02-07 10:49:25 -07:00
Matthew Flatt
342bd6645c update cross-build info for Racket CS 2021-02-07 07:09:08 -07:00
Matthew Flatt
d07d256f18 racket/src/configure: correct default when CS and BC are both enabled 2021-02-06 10:51:24 -07:00
Matthew Flatt
41623f3027 Chez Scheme: move write-barrier fixnum guard outside write fence
On an Apple M1, an example like

      (let ([v (make-vector 1000000)])
        (for* ([_ (in-range 100)]
               [i (in-range 1000000)])
          (vector-set! v i (+ 1 i))))

would generate tightly interleaved fence and store operations, which
seems to make the processor unhappy so that the code run 40x slower
than it should.

A key part of the example is that `(+ 1 i)` defeats cp0-level
inference that the result will be a fixnum. A dynamic fixnum test
avoids adding the update to a remembered set as part of the write
barrier, but the memory fence needed for ARM must be before the store,
while the fixnum test was after the store. This change bundles the
write fence and remember-set update under a `fixnum?` guard, so they
happen to gether or not at all --- at the small cost of generating the
store instruction(s) in two branches. In the example above, neither
the fence nor remember-set update happen, but changing `(+ 1 i)` to
`(quote x)` triggers both, and performance is still ok.
2021-02-03 10:30:24 -07:00
Matthew Flatt
0a945cd5f7 fix continuation-marks on thread without prompt
Closes #3675
2021-02-03 07:14:07 -07:00
yjqww6
5c6d7a3934
ChezScheme: use types to eliminate some dirty stores 2021-02-03 06:16:16 -07:00
Matthew Flatt
f968945e26 cs & schemify: with-continuation-mark optimization
Remove a `with-continuation-mark` that is redundant because its both
is another `with-continuation-mark` with the same key. That's useful
for reducing a pattern that appears after some `if`-removing
optimizations on code with errortrace-generated annotations.
2021-02-01 09:05:56 -07:00
Matthew Flatt
53b3cc5eb4 makefile: make just nmake make
Use a comment trick to make `nmake` see a different default target
than `make`, which will save a small amount of hassle from forgetting
to type `nmake win`.
2021-02-01 09:05:56 -07:00
Ryan Culpepper
ee43d982e4 db: fix for disconnect during query in OS thread
This change allows a query that is run in an OS thread to succeed even
when the connection is custodian-disconnected. Previously, the part in
the OS thread would complete, and then the operations needed to
package the result would fail. This fix moves some of those operations
to the OS thread and makes read-tx-status work when disconnected.
2021-01-31 07:13:03 +01:00
Sorawee Porncharoenwase
0101f584fb struct*: fix incorrect struct-info extraction
Also add tests for `struct-copy` and `struct*` for cases
where struct-field-info is not available

Fixes #3662
2021-01-30 08:16:11 -07:00
Ryan Culpepper
c9861931ad db: use ffi/unsafe/os-async-channel
Also:
- use one OS thread per connection instead of one per query
- when using OS thread, finish disconnect in OS thread
2021-01-30 08:54:40 +01:00
Matthew Flatt
4e76091c64 add ffi/unsafe/os-async-channel 2021-01-29 12:54:23 -07:00
Matthew Flatt
24f539087f ffi/unsafe/schedler: add unsafe-make-signal-received 2021-01-29 11:09:22 -07:00
Matthew Flatt
f685a27b41 cs & thread: add missing check on thread-suspend
Also, fix non-atomic check for shut-down custodian in `thread-resume`.

Closes #3660
2021-01-29 07:05:58 -07:00
Matthew Flatt
b55f268510 cs: fix list-{ref,tail} error messages
Closes #3661
2021-01-29 07:05:47 -07:00
shuhung
a7fef69f33
cs: print extra ellipses if the context is truncated 2021-01-29 05:36:43 -07:00
Matthew Flatt
1fea5f8e3f cs: don't display via prop:exn:srclocs when context length is 0
It's not clear that supressing source locations with the context
length is set to 0 is the right choie, but it's consistent with BC.
2021-01-27 14:47:58 -07:00
Gustavo Massaccesi
0ff8d18be5 cs: reimplement the predicate lattice in cptypes
Clean up the implementation. For example predicate-union was
calling predicate-implies? like 20 times. With the new
implementation this can be done in a single pass.

Also, this changes the results of the functions for 'bottom and
#f so they behave like sets. So this removes some special cases
and makes the functions more consistent.
2021-01-27 15:47:35 -03:00
Ryan Culpepper
ad6bbe9809 db: add option to run query in separate OS thread 2021-01-27 14:58:18 +01:00
Matthew Flatt
e110b07cc8 racket/fasl: use current-directory for relative-path unmarshaling
Relative-path handling for `fasl->s-exp` was meant to be like code
unmarshaling, but it did not fall back to `(current-directory)` when
`(current-load-relative-directory)` is #f. There's some risk to
changing the behavior of `fasl->s-exp`, but better matching the intent
seems at least as likely to fix problems as create them. One problem
it fixes is in CS code marshaling.

Closes racket/drracket#421 (again)
2021-01-26 11:29:43 -07:00
Matthew Flatt
91060487ca sync pre-built files
Needed a rebuild after changes to avoid naming via keyword arguments.
2021-01-26 11:29:43 -07:00
Matthew Flatt
18954fdc70 Chez Scheme: fix compilation problems for MinGW 2021-01-26 05:59:03 -07:00
Alexis King
c54ab626f7 Ensure block does not evaluate define-syntaxes RHSs multiple times
As described in #3635, there isn’t currently any good way to use
first-class definition contexts without evaluating define-syntaxes RHSs
multiple times. For macros like `class` and `unit`, it’s unclear if that
can be avoided, but for `block`, the first-class definition context
turns out to not be necessary.

This commit changes the implementation strategy used by `block` to a
trampolining macro rather than a first-class definition context. This
has the nice side-effect of avoiding the issue described in #3198, too.
2021-01-25 15:51:53 -06:00
shhyou
7894e97fd2 Stop keyworded functions from changing args' name 2021-01-25 06:55:31 -07:00
yjqww6
ef165fedda cs: add pariah for slow path of define-inline 2021-01-25 06:52:10 -07:00
Bogdan Popa
dcb7257d3f cs,alloc: close off sweep_next chain along with thread local segment 2021-01-25 06:51:18 -07:00
Matthew Flatt
87bf20c581 Windows: turn on string pooling for CS executables
Visual Studio 2015 duplicates the "Replace me for EXE hack" string in
the GRacket executable, which breaks the hack. Adding the /GF compiler
flag counteracts that duplication, and it's consistent with
`<StringPooling>true</StringPooling>` in the BC projects.
2021-01-23 16:04:40 -07:00
Matthew Flatt
442d7d2d00 Chez Scheme: repair for reify-cc register saving on arm32
This repair is simpler approach than the original, and it makes the
manual register allocation a little less fragile.
2021-01-23 10:46:01 -07:00
Matthew Flatt
00ce8904c7 repair prop:exn:srcloc handling
For CS, the default error display handler was not using `prop:exn:srcloc`.

For BC, a bad `prop:exn:srcloc` that returned a value other than a
list of srclocs coudl cause a crash.

Related to #3645
2021-01-23 09:33:48 -07:00
Bogdan Popa
3baed0966d build: fix make install for cross builds
W/o this change, some targets (like `copytree-run`) fail because they
try to run the target Racket executable instead of the host.
2021-01-23 06:42:00 -07:00
Matthew Flatt
c084ead2f3 Chez Scheme: fix continuation-attachments compilation
On AArch{32,64}, compiling `call-setting-continuation-attachment` in a
non-tail position could run out of registers for saving/restoring
around th intrinsic to reify the continuation.

Closes #3646
2021-01-23 06:35:48 -07:00
Matthew Flatt
be42b9a24a Chez Scheme: always disable X11 support on Mac OS 2021-01-22 09:35:59 -07:00
Matthew Flatt
9c8d7b3ebf bump version for Chez Scheme sync
After pulling in patches that change the Chez Scheme version to 9.5.5
(with not much changing besides the version, since we've pulled other
patches), update the Racket version number to reflect the change to
compiled files.
2021-01-22 08:47:16 -07:00
Bob Burger
53dcd3c439 update release notes 2021-01-22 08:36:06 -07:00
dyb
2613740431 9.5.5 changes: - updated version to 9.5.5 BUILDING NOTICE makefiles/Mf-install.in scheme.1.in c/Makefile.a6nt c/Makefile.i3nt c/Makefile.ta6nt c/Makefile.ti3nt mats/Mf-a6nt mats/Mf-i3nt mats/Mf-ta6nt mats/Mf-ti3nt workarea c/scheme.rc s/cmacros.ss release_notes/release_notes.stex csug/copyright.stex csug/csug.stex bintar/Makefile rpm/Makefile pkg/Makefile wininstall/Makefile wininstall/a6nt.wxs wininstall/i3nt.wxs wininstall/ta6nt.wxs wininstall/ti3nt.wxs - newrelease no longer logs as updated files with no actual changes newrelease 2021-01-22 08:36:03 -07:00
dyb
6c1d6b49dc updated version to 9.5.4 BUILDING NOTICE makefiles/Mf-install.in makefiles/Makefile-csug.in scheme.1.in c/Makefile.a6nt c/Makefile.i3nt c/Makefile.ta6nt c/Makefile.ti3nt mats/Mf-a6nt mats/Mf-i3nt mats/Mf-ta6nt mats/Mf-ti3nt workarea c/scheme.rc s/7.ss s/cmacros.ss release_notes/release_notes.stex csug/copyright.stex csug/csug.stex bintar/Makefile rpm/Makefile pkg/Makefile wininstall/Makefile wininstall/a6nt.wxs wininstall/i3nt.wxs wininstall/ta6nt.wxs wininstall/ti3nt.wxs 2021-01-22 08:35:47 -07:00
dyb
aa2208eb04 fixed S_condition_wait Y2038 bug; rounding ns to ms on Windows - now using 64-bit arithmetic for seconds in S_condition_wait to prevent a potential 2038 bug, at least on platforms where time_t is 64 bits. also now rounding rather than truncating nanoseconds in the coversion to milliseconds on Windows. thread.c 2021-01-22 08:35:37 -07:00
Matthew Flatt
13ee990165 rktboot: adjust for newer nanopass 2021-01-22 08:35:29 -07:00
dyb
416a6790c3 added textual-output-port checks for record-writer write argument print.ss, record.ms, root-experr* 2021-01-22 08:35:20 -07:00
Jarhmander
14a685af77 use Unicode for Windows error messages (#521) 2021-01-22 08:35:09 -07:00
Jarhmander
f74a9dea56 use lowercase winbase.h for Windows (#520) 2021-01-22 08:35:02 -07:00
Matthew Flatt
e4518f662d allow #f argument to continuation-mark-set->{list[*],iterator}
There's a small performance advantage in avoiding a call to
`(current-continuation-marks)`. CS already allowed #f, but did not
handle it correctly.
2021-01-20 07:44:11 -07:00
Matthew Flatt
3ca0799714 cs: fix system.rktd 'link entry on Unix 2021-01-18 08:21:45 -07:00
Bogdan Popa
6b0b3e0a1e
ios: constrain recent allocation segments generation, fix for tarm64->tarm64 cross-compilation
Includes new `force-host-out?' arg to `compile-to-file'.
When the host and target machines match during
"cross"-compilation (eg. M1 Mac to iOS), we still need to generate
host .so files so that the build works out.
2021-01-18 07:53:54 -07:00
Bogdan Popa
764b552ac5 bc: fix build for iOS
`MAP_JIT' is available but does not work and `pthread_jit_write_protect_np'
is not available at all on iOS.
2021-01-18 07:50:37 -07:00
Bogdan Popa
c1159fb02e
cs: add support for cross-compiling to iOS
Includes documentation notes about cross-compiling CS for iOS
and makefile improvements.

The changes also include improvements to `raco exe`.
Racket CS cannot currently read fasl files for platforms other than
the host, but `compiler/embed` has to be able to read compiled code in
order to figure out what code needs to be embedded into an output
image and which runtime paths need to be included.  This change makes
it so that host code is used to figure all of that information out,
but that code is then replaced by target machine code before it is
written to the output image. The new logic only applies when the
right cross-compilation flags are set (per `cross-multi-compile?`).
2021-01-17 08:16:02 -07:00
Matthew Flatt
b09e10d066 cs: prevent a future from waiting on a semaphore
A `semaphore-wait` or `semaphore-post` has a shortcut that uses a CAS
operation, which means that a future could affect a semaphore if it's
allowed to take that shortcut. But futures aren't supposed to succeed
in that way, because thread-level synchronization should generally
suspend a future. Disallow the shortcut when in a future.
2021-01-15 16:00:25 -07:00
Matthew Flatt
e56d8c5ded cs: fix make-ctype on converter that accepts extra arguments
Related to #3457
2021-01-15 12:49:54 -07:00
Gustavo Massaccesi
9079d1b3d7 cptypes: fix arity in primitive reduction 2021-01-13 10:46:14 -03:00
Matthew Flatt
c64bf5d961 expander: repair for cross-module inlining during recompilation
When recompiling from machine-independent form to an VM- and
platform-specific form, cross-module inlining could fail due to an
module path index being resolved in the wrong mode (loading versus
non-loading).

As a concrete example, "racket/draw/private/bitmap.rkt" tended to be
recompiled in a way that did not inline `_ubyte` as `_uint8`, which in
turn made `ptr-set!` and `ptr-ref` operations much slower, which would
make certain bitmap operations drastically slower.

Related to racket/drracket#350
2021-01-12 20:15:38 -07:00
Matthew Flatt
7a52e81c33 raco setup: don't count stdout/stderr output as failure
Although compiling modules really should not write output, one problem
is that `parser-tools/yacc` has long reported shift/reduce conflicts
to stderr.

Only parallel mode was treating stdout/stderr output as failure, which
made `raco setup` inconsistent. Make parallel mode allow output, like
sequential mode does.

Related to #3457
2021-01-12 06:46:34 -07:00
Matthew Flatt
36e04fdbcd Racket HISTORY.txt notes for v8.0 2021-01-09 09:53:38 -07:00
John Clements
259f92a5a4 Post-release version for the v8.0 release 2021-01-08 12:40:02 -08:00
Matthew Flatt
1d0fd9c40b cs & thread: fix thread termination with pending timeout callback
In other words, follow a note on line 77 of "atomic.rkt":

     ;; There's a small chance that `end-atomic-callback`
     ;; was set by the scheduler after the check and
     ;; before we exit atomic mode. Make sure that rare
     ;; possibility remains ok.

That note was originally written in the context of changes for
futures, but it also applies to plain old thread scheduling, where
`engine-timeout` can be installed as a callback, but it's not allowed
if an engine isn't running.
2021-01-08 13:23:19 -07:00
Matthew Flatt
f347fe299a cs & io: fix atomic-mode step in sync/enable-break 2021-01-08 13:23:19 -07:00
Sorawee Porncharoenwase
c81b628282 Rename define-simple-macro to define-syntax-parse-rule
This PR is based on @lexi-lambda's #1310.
It resolves the conflicts in the mentioned PR and
adjusts the version so that it's up-to-date.
2021-01-07 17:32:25 +01:00
Sorawee Porncharoenwase
5ee0f73957 further simplification 2021-01-07 09:52:16 -05:00
Sorawee Porncharoenwase
64067704bc reduce unnecessary vector-ref 2021-01-07 09:52:16 -05:00
Sorawee Porncharoenwase
6ace62a717 list: optimize in-combinations and combinations
This PR in a sense reverts f83cec1b04 and attempts to directly fix
the bug that the commit tries to address with an approach similar to the
original one.

The problem with the aforementioned commit is that, Gosper's hack
only works efficiently when the length of `l` is small enough that
the number representation can fit into a fixnum
(so that all bit operations take constant time).
When the length of `l` is large, the number representation could
become a bignum with length proportional to the length of `l`.
This is not ideal because it causes the time complexity of the algorithm
to be `O({|l| choose k} |l|)` instead of `O({|l| choose k} k)`, which
would be a significant performance degradation when `|l|` is much
larger than `k`.
2021-01-07 09:52:16 -05:00
sorawee
d40c4d31c7
bc and cs: make srcloc->string compatible
Currently, in Racket BC, the following program:

```
(srcloc->string (make-srcloc "x.rkt" #f #f 90 #f))
(srcloc->string (make-srcloc "x.rkt" #f 80 #f #f))
(srcloc->string (make-srcloc "x.rkt" #f #f #f #f))

(srcloc->string (make-srcloc "x.rkt" #f 80 90 #f))
(srcloc->string (make-srcloc "x.rkt" 70 #f 90 #f))
(srcloc->string (make-srcloc "x.rkt" 70 80 #f #f))
(srcloc->string (make-srcloc "x.rkt" 70 80 90 #f))
```

results in:

```
"x.rkt::90"
"x.rkt::80"
"x.rkt::-1"
"x.rkt::80"
"x.rkt:70:90"
"x.rkt:70:80"
"x.rkt:70:80"
```

This output is very confusing and inconsistent.
When we see "x.rkt::90", we can never be sure if it's a srcloc
whose position is 90, or a srcloc whose column is 90.
The same applies for "x.rkt:70:90".

Moreover, the srloc "x.rkt::-1" is weird and is arguably incorrect
(see #1371).

For CS, the output would sometimes contain `#f`, and that is fixed
here by not trying to add position information when it's not available.
2021-01-07 07:44:29 -07:00
Matthew Flatt
bdc43a891a cs: force all foreign callbacks to be in atomic mode
Non-atomic mode is questionable at best with BC, and more so with CS.

With BC, a thread swap at least copies the fragment of the C stack
that is between a foreign call and a callback; that can work with some
C libraries, but it goes wrong often enough that it really shouldn't
be relied on. On the plus side, if it's going to go wrong, at least it
tends to go wrong right away (i.e., something in the C frame tends to
get broken in normal runs).

With CS, the C stack is not captured as part of a thread, and so
non-atomic mode 's even more broken. Non-atomic mode could work if you
know that no other thread is running that can involve foreign calls
and callbacks, but that assumption is usually not a good one. Worse,
when things finally go wrong, it's likely several scheduling steps and
thread interleavings away from the problem (e.g., #3459).

There's a chance that this change will stop some existing programs
from working ok on CS. It's more likely to make existing programs work
as intended on CS; the common case is that atomic mode is technically
needed even though non-atomic mode happened to work in practice with
BC.
2021-01-07 05:39:35 -07:00
yjqww6
e71c217758
cs: inline non-authentic struct predicate 2021-01-06 13:29:07 -07:00
Sorawee Porncharoenwase
f41b180b48 fix typos in datum->syntax error message 2021-01-06 14:12:12 -05:00
Pavel Panchekha
b56276c670 Allow variables in unquote-splicing terms
I think that in general, `null-terminated?` should admit all patterns
that _could_ match a list, instead of just the ones that _only_ match
a list. That means that `(app f)` patterns and many others should also
be valid, though those are harder to implement, so I haven't tried
those yet.
2021-01-04 18:42:30 -06:00
Matthew Flatt
4c6bb055b0 cs: fix transparent internal structure types
Commit d96273bc0a broke internal "system" structures in the expander
that need to be transparent.
2021-01-04 06:28:32 -07:00
Matthew Flatt
d96273bc0a object-name: return #f for some built-in kinds of values
This change is mostly for making CS consistent with BC, but in the
case of `(object-name #'x)`, it also makes BC consistent with BC
before the macro-expander rewrite.

Closes racket/pconvert#9
2021-01-03 09:49:01 -07:00
Matthew Flatt
ecd2234d56 syntax/module-reader: make language name after meta-reader syntax-original?
Thanks to Robby for the test.
2021-01-02 16:44:28 -07:00
Matthew Flatt
7438586cf0 cs & thread: fix atomic timeouts
Commit 9a3eb15d8b broke atomic-timeout handling. As aresult, for
example, using the scroll thumb on Mac OS could freeze DrRacket as
long as something is running for a canvas refresh.
2021-01-02 08:22:14 -07:00
Matthew Flatt
f299c4304d Chez Scheme: save an instruction on record predicates
Combine separate subtraction and comparison instructions into one in
the case of non-sealed record types.
2020-12-31 07:43:46 -07:00
Matthew Flatt
30eb35b99c cs & schemify: improve folding of procedure? and procedure-arity-includes? 2020-12-30 17:14:43 -07:00
Matthew Flatt
23300fd18d cs: use nongenerative records in core 2020-12-30 15:34:46 -07:00
Matthew Flatt
e604c2deb9 Chez Scheme: change record-type predicate to constant-time
Change the representation of records to keep an ancestor vector
instead of just a parent, so a record-type predicate (for a non-sealed
type) can be constant-time.
2020-12-30 14:02:38 -07:00
Matthew Flatt
a8819af26a cs & schemify: further refinments to left-to-right and letrec
More cases where the code can be mostly left alone, and then cp0 and
company can make further improvements.
2020-12-30 09:23:29 -07:00
David Van Horn
001ad13297
Check numeric argument to real->decimal-string
Closes #3565
2020-12-30 05:09:14 -07:00
Matthew Flatt
15bda57d77 cs & io: fix UDP receive poller registration
Closes #3590
2020-12-30 05:05:28 -07:00
Matthew Flatt
dbe36162ac cs: fix some predefined struct-operation procedure names
Closes #3592
2020-12-30 04:54:06 -07:00
Matthew Flatt
c7ca4414ca cs & io: small clean-ups to seconds->date
Streamline some things that probably needed to be different along the
way.
2020-12-30 04:49:48 -07:00
Matthew Flatt
4b7b1872dc version bump for seconds->date change 2020-12-30 03:44:14 -07:00
shuhung
4b4ed24c65
Implement seconds->date in the io layer 2020-12-30 03:41:33 -07:00
Matthew Flatt
4936977c56 cs & schemify: prevent reorder of allocation and continuation capture 2020-12-29 16:23:47 -07:00
Matthew Flatt
95e5acdb0d Chez Scheme: enable more let lifting
For example, allow
  (cdr (let ([x (f)]) (cons x x)))
to be turned into
  (let ([x (f)]) (cdr (cons x x)))
and then just
  ($value (f))
2020-12-29 14:07:43 -07:00
Matthew Flatt
ea96e2d304 add unsafe-set-immutable-{car,cdr}!
Reluctantly, with intentionally oxymoronic names, and with the key
caveat: using these requires making correct assumptions about Racket's
implementation.

With BC, a related assumption was that `unsafe-set-mcar!` and
`unsafe-set-mcdr!` mutate pairs, but that's not the case with CS. So,
adding these functions supports a kind of portability between BC and
CS.
2020-12-29 08:55:40 -07:00
Matthew Flatt
becf34a79b expander: fix check on syntax-local-lift-provide
Closes #3589
2020-12-28 14:07:10 -07:00
Matthew Flatt
70a600e1b5 build-instruction typos and clarifications 2020-12-27 19:08:19 -07:00
Matthew Flatt
8869f0eb9e Chez Scheme: remove a debugging leftover
A do-nothing loop, which was probably a debugging check at some point,
wasn't correct and could break vfasl loading.
2020-12-26 10:14:57 -07:00
Matthew Flatt
4d7f52e7dd expose WTF-8 converters on all platforms 2020-12-25 08:00:32 -07:00
Matthew Flatt
dd1061f069 cs & io: fix conversion from UTF-8-ish
The UTF-8-ish decoder incorrectly allowed a surrogate pair encoded as
two unpaired surrogates, and it treated an unpaired surrogate at the
of a stream as complete instead of a potential error.

Related to #3578
2020-12-24 15:43:59 -07:00
shhyou
6e58310176 Use foreign function from MSVCRT on Windows 2020-12-24 10:14:41 -07:00
Bogdan Popa
f4cd7ab8a0 pkg: improve CI template for new packages
Related to #1500.

This improves the following aspects of the CI config:

* The config now tracks the current stable version of Racket so
package authors don't have to remember to upgrade the config on new
releases.  This is a double-edged sword, because it makes it easy to
use features of new Racket version and potentially break
backwards-compatibility by accident.  Running CI against a set of
static Racket versions doesn't have this problem since any such change
would end up failing.  Maybe a better change here would be to
interpolate the current `(version)` into the CI file instead.

* The job is now set to fail on the first error it encounters on the
assumption that most packages fail due to internal issues and not due
to mismatches between Racket versions.  The intent with this change is
to use fewer resources overall when possible.  Additionally, the
packages' dependencies are now validated during the setup step.

* Lastly, the install step now avoids building documentation for
dependencies, which can shave off significant amounts of time.
2020-12-23 10:25:24 -05:00
David Van Horn
c93837c2ce Fix rationalize with +nan.0 tolerance
Calling `rationalize` with `+nan.0` as the second argument was causing
a "no exact representation error."  This commit changes it to produce
`+nan.0`.

There was an unexercised set of tests for `rationalize` in the test
suite which, once called, demonstrate the bug.

Those tests also specify that `rationalize` should produce an exact
result when the first argument is exact and the second is an infinity.
That's not what the implementation does; it coerces the result to
inexact.  I changed the test cases to match the implementation, which
is consistent with other Schemes (Chez, MIT) and standards (R6RS).
2020-12-23 08:20:31 -07:00
Sam Tobin-Hochstadt
6369646116 Order keys when writing JSON output.
More significant on Racket CS because ordering is often different
than creation order.

Closes #3537.
2020-12-23 10:01:08 -05:00
David Van Horn
72a852ca43 cs: fix {u,s}16vector-{ref,set!} when memory is not bytes?
When a {u,s}16vector points to memory that's not bytes (e.g. from ffi)
then referencing or setting the memory results in a Chez error:

```
foreign-set!: unrecognized type 'int16
```

The fix is to change the type argument to `'integer-16` and
`'unsigned-16`.
2020-12-23 07:49:23 -07:00
Matthew Flatt
cc9fc20a07 raco dist: signing repairs for ARM Mac OS 2020-12-22 15:55:47 -07:00
Matthew Flatt
d7e9628caf clean up some debugging leftovers 2020-12-22 13:07:15 -07:00
Matthew Flatt
a450246ee7 mach-o: infer machine type instead of depending on cross information
Directly inferring the machine type works more easily for some Racket
CS build steps.
2020-12-22 12:58:17 -07:00
Matthew Flatt
15ab674ef8 ffi/unsafe/objc: repair use of objc_msgSendSuper_stret
TTo keep stack alignment correct, the `objc_msgSendSuper_stret`
function needs to be used with a structure return type on i386,
instead of making the implicit return-pointer argument explicit.
(For BC, libffi apparently makes the wrong style work anyway.)
2020-12-22 10:51:54 -07:00
Matthew Flatt
b8f0c96756 Chez Scheme: repair i386 Mac OS __collect_safe ABI
A wrapper to align the stack during activation was dropped if the
return type was `void` for a foreign callable, and a callee-popped
argument was not handled right for a foreign call.
2020-12-22 10:51:45 -07:00
Matthew Flatt
33fd201947 Chez Scheme: revert incorrect cp0 simplification
It's not necessarily ok to inline a function wrapper by
`make-wrapper-procedure`, because the wrapper might get mutated. We
could add immutable wrapper procedures, but we can also just revert to
a previous approach for code that needed the optimization.
2020-12-21 16:46:21 -07:00
Matthew Flatt
0041354e1f fix some uses of peek-bytes-avail! that do not expect specials
Closes #3572
2020-12-21 08:06:43 -07:00
Matthew Flatt
c93e4f1328 cs: repair ctype alignment
Currently, this repair matters only for PPC32 Mac OS, which is the
only place where alignment of some primitive atomic type is not the
same as its size.
2020-12-21 07:31:09 -07:00
Matthew Flatt
8cd96ec5df bc: repair for foreign callbacks
Fix an array whose size needs to be connected to the number of
arguments to `ffi-callback-maker`.
2020-12-20 20:35:49 -07:00
Matthew Flatt
763c5465f6 revert argument change in #%foreign exports
The changed functions are documented and turn out to be used by the
`gui` package.
2020-12-20 16:51:22 -07:00
Matthew Flatt
c006fa902f ffi/unsafe: add #:varargs-after to function-type options
Needed on ARM Mac OS to call a function like `fcntl`.
2020-12-20 13:32:36 -07:00
Matthew Flatt
6033237ed6 Chez Scheme: generalize __varargs to (__varargs_after <n>)
The non-standard ARM Mac OS ABI doesn't just use a different
convention if the function has varargs: it puts each vararg in a
different place than a non-vararg argument of the same type and
position. So, `foreign-procedure` and `foreign-callable` need to know
where varargs start. A `__varargs` declaration is shorthand for
`(__varargs_after 1)`.

For PPC32 Mac OS, we retain the trick that makes varargs foreign calls
work without a `__varargs` declaration, but `(__varargs_after <n>)`
fixes up callable support --- in the extremely unlikely case that
someone needs general varargs callables on PPC32 Mac OS.
2020-12-20 11:21:20 -07:00
Matthew Flatt
0ce89f53c4 Chez Scheme: repair for call-with-values ... values cp0 conversion
Closes #3576
2020-12-20 09:09:54 -07:00
Matthew Flatt
72d278cb84 cs: take advantage of new lifting in Chez Scheme
Since Chez Scheme now performs the kind of closure conversion that
Racket does --- ensuring that a closure is not allocated if it is
bound to an identifier that is used only in application positions ---
the variant in schemify is not longer run. The hacky macro-based
lifter in the "rumble" layer can also go.

The lifting pass is still preserved in schemify, because it is still
useful to cify. It's not clear whether interpreter mode (which is used
during macro expansion for compile-time code that doesn't cross a
module boundary) is better off with or without schemify's lift, but
it's gone for now.
2020-12-20 08:18:51 -07:00
yjqww6
97d9825801
ChezScheme: Add a pass to lift well-known closures 2020-12-20 08:00:52 -07:00
Matthew Flatt
f62e97d8b6 Chez Scheme: repair for 32-bit Windows makefile 2020-12-19 20:37:13 -07:00
Matthew Flatt
4d0aa443b1 cs & thread: fix problems with sync and breaks
This commit fixes two bugs:

 * `sync/enable-break` didn't implement the guarantee that an event is
   selected or a break exception raised, but not both; the problem was
   in the handling of making the break-enable state ignored after
   committing to an event

 * `sync` didn't cancel asynchronous pending commits when a break is
   received at certain points; the bug in `sync/enable-break` masked
   this bug for existing test cases

Closes #3574
2020-12-19 16:06:16 -07:00
Matthew Flatt
c05d0a6fa5 Chez Scheme: repair to support vfasl boot in Rosetta
When Rosetta 2 runs x86_64 code, it doesn't enforce W^X, but the
`read` system call still refuses to write into executable memory.
2020-12-19 10:53:47 -07:00
Matthew Flatt
ec064bee31 cs: improve error reporting for FFI conversions
Match the error messages from BC.
2020-12-19 08:28:15 -07:00
Matthew Flatt
585f9d8201 mach-o: fix linkedit vm length when ad hoc signing 2020-12-19 07:08:59 -07:00
Sam Tobin-Hochstadt
0e4f57f44c Enable inlining for define-inline calls as arguments.
A seemingly-unintentional choice made the following not behave
as expected:

    (define-inline (f x) (+ x 1))
    (f (f 2))

because the `(f 2)` was not inlined.

Reported by @mflatt and Liwei Chou.
2020-12-18 13:53:09 -05:00
Matthew Flatt
b7c0130a75 cs: new vfasl writer to support cross compilation
Replace the vfasl writer (which was in C) with a new implementation
(in Scheme). The main result is that the vfasl writer can be used in
cross-build mode.

Racket uses the vfasl format for its boot images, because they can
load faster --- cutting the Chez Scheme plus boot files startup time
in half, which saves about 40msec on a typical machine. That's not
enough to matter for something like DrRacket, but it can matter for
small Racket scripts. Formerly, cross builds disabled vfasl
generation.

A vfasl file is roughly an image of code and data as it will appear in
memory, and a relatively fast linking step makes the image work in a
running process. The old implementation was in C because it reused GC
structures and code, treating fasl creation as copying objects into a
vfasl image instead of a new generation. The new implementation is
more like a fasl reader, loading objects into a vfasl image instead of
the live heap. The two implementations are about the same amount of
code and both involve a certain amount of repeated implementation
(i.e., imitating a collection or fasl load), but the Scheme
implementation is more flexible and works for cross compilation.
2020-12-18 07:36:25 -07:00
Ryan Culpepper
a08a6b4904 fix custodian-managed-list: omit custodian-boxes 2020-12-17 14:32:25 +01:00
Matthew Flatt
bcfbf2249e cs: avoid race with GC in (current-memory-use 'cumulative)
Thanks to Alex Harsanyi for reporting the problem.
2020-12-15 19:09:56 -07:00
Matthew Flatt
4590c51d32 cs: declare a no-return call 2020-12-14 19:04:02 -07:00
Sorawee Porncharoenwase
eff84fa302 cs: kill accidentally added debugging print 2020-12-14 19:03:03 -07:00
Matthew Flatt
0a28dd1064 cs: adjust result-arity error messages
Relevant to #3325
2020-12-14 16:10:14 -07:00
Matthew Flatt
f76b814dd7 cs: tweaks for mpairs 2020-12-14 15:10:38 -07:00
Matthew Flatt
0561d71e60 reader: fix imprecision reading some flonums
Reading `1.0e45` produced a different (and less precise) result than
`1e35`. The problem was in the reader's fast path for simple flonum
conversions, where it converts the mantissa and exponent separately
and then combines them. 10^44 is not represented exactly as a flonum,
so there's imprecision when multiplicy it by 10 versus multiplying
1e45 by 1.

Closes #3548
2020-12-14 13:41:11 -07:00
Matthew Flatt
986c73244e racket/port: fix spinning by peeking-input-port on blocked input 2020-12-14 10:13:18 -07:00
Matthew Flatt
a959c7f988 cs: enable GC during atomic callbacks
Callbacks from C generally need to be in atomic mode, but they don't
need to have interrupts disabled at the Chez Scheme level, because
that disables GC.

Without this change, dragging a scrollbar or resizing the window in
DrRacket would suspend GCs as long as the mouse button is pressed ---
which could allocate arbitrary amounts of memory fairly quickly
meanwhile.
2020-12-14 07:17:24 -07:00
Matthew Flatt
635005e882 Chez Scheme: unbreak $app/value rendering for expand/optimize 2020-12-13 19:59:19 -07:00
shuhung
2c26dc1e1a
Format the name of continuation prompt tags
This change recovers Racket-BC style formatting
of continuation prompt tags for Racket CS.
2020-12-13 16:29:14 -07:00
Matthew Flatt
b4a3c7d3da Chez Scheme: unbreak app rendering for expand/optimize
Also, fix some cp0 tests for interpret mode.
2020-12-13 11:06:53 -07:00
Matthew Flatt
1e19e660c9 expander: track core #%datum expansion in 'origin 2020-12-12 20:23:35 -07:00
Matthew Flatt
400f4fa4fb expander: 'implicit-made-explicit property on introduced #%app, etc. 2020-12-12 11:02:58 -07:00
Matthew Flatt
79ccd514c3 Chez Scheme: allow some extra inlining of system primitives
Cross-library inlining is willing to inline a procedure body that
refers to a system primitive, but wasn't willing to propagate a
system primitive directly. Enable that, and use it to simplify
`unsafe-struct` inlining.

Related to #3546
2020-12-12 10:30:40 -07:00
Matthew Flatt
e7cef677ad expander: attach original property to #%app made explicit
Copy any syntax-original property from the parentheses assodictaed
with a `#%app` made explicit, so that originalness is tracked in
the 'origin property.
2020-12-12 08:50:03 -07:00
Matthew Flatt
426b6adc79 bc: sync expanded expander 2020-12-12 08:50:03 -07:00
Matthew Flatt
6603fe3ad4 cs: improve single-value and no-return tracking
New `#%app/no-return` and `#%app/value` functions at the Chez Scheme
level allow schemify to communicate that function calls will not
return or will return a single value. The schmeify pass may have this
information because a Racket-level primitive is declared that way
(such as `error` or `raise-argument-error` for no-return, or most
functions for single-valued) or because single-valuedness is inferred.

There's currently no inference for no-return functions, because those
are relatively rare. An `#%app/value` is used by schemify only for
imported, non-inlined functions, since cp0 can already deal with local
functions and primitives.

There's a start here at adapting the "optimize.rktl" test suite for CS
--- and that effort triggered these improvements plus some other
low-hanging fruit. But a lot more is needed to adapt "optimize.rktl"
and to make some additional optimizations happen.
2020-12-11 13:29:35 -07:00
Matthew Flatt
d228aeb060 cs: fix name of pending-unmarshal procedures
The new encoding of struct constructors and predicates collided with
the encoding of another kind of procedures --- ones that are
unmarshaled on demand in especially large modules. The resulting
symptom was that `object-name` was broken for on-demand procedures.
2020-12-09 12:54:43 -07:00
Sam Tobin-Hochstadt
1173006212 Create racket/place/dynamic to reduce dependencies.
Also adjust implementation of th-places slightly to avoid startup
time dependencies.
2020-12-09 11:50:24 -07:00
Matthew Flatt
5986bc9250 Chez Scheme: adjust optimizer test for profiling mode 2020-12-09 09:45:38 -07:00
Matthew Flatt
e02c417de0 cs: change struct procedure representation and inlining
Avoid a global table to register structure procedures, and instead use
a wrapper procedure. At the same time, adjust schemify to more
agressively inline structure operations, which can avoid a significant
performance penalty for local structure types.

Closes #3535
2020-12-09 07:53:52 -07:00
Matthew Flatt
0de549800e Chez Scheme: repair cp0 record optimization 2020-12-09 07:53:51 -07:00
Matthew Flatt
535fa16813 Chez Scheme: make inlining see through make-wrapper-procedure
For example,

 (let ([f (make-wrapper-procedure (lambda (x) x) 2 'metadata)])
   (f 5))

optimizes to just 5.
2020-12-09 07:53:51 -07:00
yjqww6
cbd7a2b2af add cross-library inlining support for procedure with improper formals 2020-12-09 07:53:45 -07:00
Matthew Flatt
d7a226053e cs & schemify: repair treatment of property procedures
A procedures that is a value for a structure-type property was not
always inspected correctly. For example, if such a procedure was the
only one to mutate a module variable, then the variable might not be
detected as mutable.
2020-12-07 20:40:27 -07:00
Matthew Flatt
3c382284a4 cs: better equal-secondary-hash-code
Since CS doesn't use secondary hash code internally, the
`equal-secondary-hash-code` function wasn't really implemented.
Implement it reasonably for applications that might use it to
implement other data structures.

Testing exposed other problems related to error reporting for a broken
hash-function result and for using values within immutable hash
tables.

Closes #3536
2020-12-07 20:40:27 -07:00
Matthew Flatt
a2a456cd2d Chez Scheme: fix a test for weak memory ordering 2020-12-07 16:20:54 -07:00
Bogdan Popa
ad284de366 assemble-distribution: convert string relative bases to paths
Fixes an issue where the distribution assembler expects these to be
`path?`s.

I originally considered making this change in the ctool command in
`cext-lib` instead, but then I noticed the documented contract for
`assemble-distribution` is `(or/c #f path-string?)`.
2020-12-07 16:17:04 -07:00
yjqww6
c71e6289af add #%$app/no-inline to some raise functions 2020-12-07 05:03:06 -07:00
yjqww6
d81fa3bba0 get rid of rtd-mutables for non-prefab struct 2020-12-07 05:02:47 -07:00
Matthew Flatt
a31a5a6d37 cs makefile: repair for cross-compile for Mac OS (on Mac OS) 2020-12-06 07:57:25 -07:00
Matthew Flatt
ef0b97c65e Chez Scheme: fix error escape during fasl read with W^X
Go back to execution mode when fasl-read escapes with an error.
2020-12-05 19:24:20 -07:00
Matthew Flatt
0e08807d3f Chez Scheme: adapt AArch64 ABI for Mac OS
Apple doesn't follow quite the standard ABI when there are enough
arguments involved to use the stack.
2020-12-05 19:20:57 -07:00
Matthew Flatt
ebffdb1600 fix AArch64 Mach-O update for cross-compile 2020-12-05 17:02:15 -07:00
Matthew Flatt
24076aa4f1 Chez Scheme: update list of supported platforms 2020-12-05 16:12:33 -07:00
Matthew Flatt
daee6485d2 bc: repairs for AArch64 Mac OS 2020-12-05 12:43:45 -07:00
Matthew Flatt
96dd901780 repair Mach-O ad hoc signing 2020-12-05 09:40:38 -07:00
Matthew Flatt
10ea287f3b cs: repair for build's GRacket install step 2020-12-04 17:23:43 -07:00
Matthew Flatt
aa2f163f15 ad hoc signing of generate executables for AArch64 Mac OS
AArch64 Mac OS will not run an unsigned executable. But it will happily run an
executable with an "ad hoc" signature, which is little more than a sequence of
SHA-256 hashes of the file content.
2020-12-04 13:41:10 -07:00
Matthew Flatt
4e05a0d058 repairs for AArch64 Mac OS
Still needed: code signing for installed dylibs and generated executables.
2020-12-04 11:05:40 -07:00
Matthew Flatt
908156b92f repairs to build and run on AArch64 Mac OS 2020-12-03 14:25:18 -07:00
Matthew Flatt
977494552e cs & io: fix use and initial value of print-reader-abbreviations
Meanwhile, new tests highlight how the `pretty-print` family of
functions is inconsistent with the non `pretty-` variants (worth
changing, considering backward compatbility?).
2020-12-02 16:53:14 -07:00
Matthew Flatt
918716fa3e add makefile dependency 2020-12-02 14:55:21 -07:00
Matthew Flatt
ef664169e1 ffi/unsafe/objc: method installed by method_setImplementation as atomic
Just in case.
2020-12-02 13:01:30 -07:00
Matthew Flatt
abc4a1fe8a Chez Scheme: repairs for callables on ppc32 and varargs for ppc32osx
Fix list of preserved registers, and make not-declared-as-varargs
calls work as varargs on Mac OS for many useful situations.
2020-12-02 12:56:51 -07:00
Matthew Flatt
fe966b9280 rktio: fix sha_256 for big-endian platforms
The macro for big-endian reads was confused. Just remove the special
case.
2020-12-02 07:43:04 -07:00
Cameron Moy
a7038173aa fix contract on impersonate-async-channel 2020-12-02 07:42:27 -07:00
yjqww6
cec3041f24 cp0: improvements for $record-ref and record? 2020-12-02 07:34:55 -07:00
Matthew Flatt
08fc3b17c7 Chez Scheme: add "auto.bootquick" makefile target
The "auto.bootquick" target maps to "<machine type.bootquick" for
whatever machine type would be inferred by `configure`.
2020-12-01 19:48:42 -07:00
Matthew Flatt
3ab6fd66ca Chez Scheme: Mac OS PPC32 ABI
The Mac OS ABI is completely different from the Linux ABI for PPC32.
2020-12-01 19:29:47 -07:00
Sorawee Porncharoenwase
0711dd7974 Use unsafe-vector-ref in the loop 2020-11-30 10:56:08 -05:00
Sorawee Porncharoenwase
ed6f990e87 match: eliminate vector refs due to ``_ ddk''
Currently, the pattern matcher always call `vector->list`
on the input vector if a ddk is detected.
However, when there is exactly one ddk and users wish not to
bind an identifier to the ddk, the whole conversion is not needed.
Instead, we can selectively `vector-ref` the prefix and the suffix
of the vector and match them directly against patterns.

Also strengthen an existing test.
2020-11-30 10:56:08 -05:00
Matthew Flatt
ea620f2a4a Chez Scheme: add PPC Mac OS 2020-11-30 07:29:33 -07:00
Matthew Flatt
6e0c9c00b9 Chez Scheme: larger range for relative return address
A 16-bit range is not large enough for "nanopass/pass.ss".
2020-11-30 07:29:33 -07:00
yjqww6
20be8ffc03
RacketCS: preserve immutability when encoding structs as chez records 2020-11-30 07:29:25 -07:00
Matthew Flatt
f74a758051 rktio: bring back old CPU-count code for PPC Mac OS 2020-11-29 16:08:30 -07:00
Matthew Flatt
b12b3ed49e patch libffi3.3 for PPC Mac OS 2020-11-29 16:04:15 -07:00
Matthew Flatt
a940c7a43b Chez Scheme: repair pb code endian swap 2020-11-29 15:09:05 -07:00
Matthew Flatt
638f6f2b44 bc: fix unsafe-mode handling of bitwise-{and,ior,xor}
They were being converted to fixnum operations in unsafe mode, but
the intent was to use fixnum operations only when the argument are
known to be fixnums.
2020-11-29 10:52:28 -07:00
Michael Ballantyne
785ad3daea fix syntax-local-eval when intdef argument given 2020-11-29 07:07:37 -07:00
Matthew Flatt
3085780849 Chez Scheme: repair to code vs. non-code chunk handling
The daily build plot showed much higher peak memory use due to some
missing pieces for the split.
2020-11-29 06:03:55 -07:00
Matthew Flatt
1bf4086dae makefile: strip any code signature in "collects-path.rkt"
The latest Mac OS tools automatically sign code when linking, and
"collect-path.rkt" break that signature by changing the executable.
Avoid that problem by removing the signature, first. (Leave it to
distribution tools to install a new signature.)
2020-11-28 16:57:59 -07:00
Matthew Flatt
67a8690021 mach-o: accomodate AArch64 2020-11-28 16:57:59 -07:00
Matthew Flatt
bd193e46f1 bc: W^X for AArch64 Mac OS 2020-11-28 16:57:59 -07:00
Matthew Flatt
64378caa1d Chez Scheme: distinguish code and non-code allocation segments
Code segments are executable and potentially non-writeable in a thread
--- except when specifically enabled, at which point code segments are
made non-executable for that thread. Non-code segments are always made
non-executable.
2020-11-28 16:57:59 -07:00
Matthew Flatt
3b262edfa0 changes to compile for Mac OS AArch64
These changes allow cross-compilation of Racket for AArch64.  Whether
the build actually runs is another question.
2020-11-27 19:46:07 -07:00
Matthew Flatt
1e8bf3cfaa skip "pb/.git" in a source distribution
Closes #3508
2020-11-27 11:00:12 -07:00
Matthew Flatt
7375316478 raco pkg: handle EOF reply to interactive question
Closes #3523
2020-11-27 10:50:16 -07:00
Matthew Flatt
1828ff5697 bc: add CPPFLAGS to libffi's test for X32 2020-11-25 20:22:59 -07:00
Sam Tobin-Hochstadt
8f3ea45de1 Remove more deprecation warnings in libffi.
Similar to f2d7f1d822
2020-11-25 15:19:28 -05:00
Matthew Flatt
7a1b10897f remove accidentally added files 2020-11-25 05:29:07 -07:00
Gustavo Massaccesi
76c45cc3e4 Add special case in cpnanopass for (eq? (ftype-pointer-address x) 0) 2020-11-24 13:55:00 -07:00
Florian Weimer
6bdf095944 NOTICE: Mention LZ4
Commit 8858b34bd92ac8d2b6511dc9ca17ebfa06a1bd93 ("Add LZ4 support and
use it by default for compressing files") added LZ4 support and the
lz4 submodule, but did not update the NOTICE file, unlike zlib support
is handled.
2020-11-24 13:54:34 -07:00
Matthew Flatt
f2d7f1d822 libffi: avoid compilation warning on Mac OS 2020-11-24 13:09:54 -07:00
Matthew Flatt
e07dbc39d8 Chez Scheme: more implementation notes 2020-11-24 09:52:18 -07:00
Bogdan Popa
ec1f11e18e match: implement and*' in terms of andmap' 2020-11-24 10:00:43 -05:00
Bogdan Popa
7bb2cad8db match: improve elimination of unused bindings 2020-11-24 10:00:43 -05:00
Bogdan Popa
88db31f46d match: preserve stx loc of original app expr 2020-11-24 10:00:43 -05:00
Bogdan Popa
bdef494c8c match: preserve source location in constant-pat predicate applications 2020-11-24 10:00:43 -05:00
Bogdan Popa
0f5ba032bf match: ensure entire `body' is traversed when eliminating unused temps 2020-11-24 10:00:43 -05:00
Bogdan Popa
21cd97f2b2 match: stop searching for unused tmps when all have been found 2020-11-24 10:00:43 -05:00
Bogdan Popa
684a1f1039 match: eliminate field refs due to _ in constructor patterns
Related to #3487.
2020-11-24 10:00:43 -05:00
Matthew Flatt
403ef87ec2 bc: upgrade to libffi 3.3 2020-11-24 07:19:41 -07:00
Matthew Flatt
31d0c07d37 rktboot: fix confusion between compile-time and run-time fixnums 2020-11-23 09:55:39 -07:00
Matthew Flatt
318d3e0a9f Chez Scheme: implementation notes on adding functions
Also, explain primitives and entries, which helps make sense of
definitions like

 (define set-car!
   (lambda (p v)
     (#2%set-car! p v)))
2020-11-23 08:32:22 -07:00
Matthew Flatt
71d86bd3a3 cs: unbreak MSVC build 2020-11-23 06:54:01 -07:00
Matthew Flatt
c52113397c Chez Scheme: add weak generic hash tables
Implement weak and ephemeron generic hashtables, and repair weak and
ephemeron `eqv?` hashtables to be weak on numbers.

Racket's implementation of weak `equal?`-based tables now uses weak
generic tables. Datum interning, which needs a weak `equal?`-based
table and was the bottleneck for unfasling literal data, is much
faster. DrRacket's footprint is 1% smaller.
2020-11-23 06:43:49 -07:00
Matthew Flatt
60e9245390 cs: tweak implementation of keyword intern table 2020-11-22 16:12:17 -07:00
Matthew Flatt
3b1f457375 tweak case fixnum-only dispatch
Use `fixnum?` instead of `fixnum-for-any-platform?` when
only fixnums-on-any-platform are relevant.
2020-11-22 15:53:44 -07:00
Matthew Flatt
8751e5b75f Chez Scheme: fix $describe-fasl-from-port with cycles 2020-11-22 15:21:44 -07:00
Matthew Flatt
3ccb523f1a Chez Scheme: unbreak eq? hash on 32-bit platforms 2020-11-22 13:06:08 -07:00
Matthew Flatt
4b39dc73be cs: restore -natipkg in system-library-subpath result 2020-11-22 11:37:00 -07:00
Matthew Flatt
5ca183a710 cs: improve eq? hashing
Use the fixnum-mixing idea of dc82685ce0 on pointers, too.

This change provides a significant improvement on the "hash-mem.rkt"
benchmark, for example, because the allocated objects have a size that
triggers a repeating pattern in the low bits of the allocated address.
2020-11-22 09:46:30 -07:00
Matthew Flatt
f07c2fea71 cs: simplify and improve handling of literals
Use data instead of code to shrink ".zo" sizes by 10-30%.

When Racket code contains a literal that cannot be serialized directly
by Chez Scheme (such as a keyword or an immutable string that should
be datum-interned), the old approach was to generate Scheme code to
construct the literal through a lifted `let` binding. To handle paths
associated with procedures, however, Chez Scheme's `fasl-write` had
been extended to allow arbitrary values to be intercepted during fasl
and passed back in to `fasl-read`. Using that strategy for all Racket
literals simplifies the implementation and reduces compiled code. It
also makes closures smaller, while increases the number of
relocations. DrRacket's foorprint shrinks by about 1%, but the main
affect is on disk space for a Racket installation.
2020-11-22 06:02:40 -07:00
Matthew Flatt
b2a27ef05c cs & raco decompile: expose more fasl content
Show the machine code that constructs lifted constants for a linket.

Also, add a `--partial-fasl` option that shows fasl content in a rawer
form, which is useful for checking how content is presented and that
nothing is getting lost in other reconstructed views.
2020-11-21 07:26:08 -07:00
Matthew Flatt
a6e683cc71 bc: fix incomplete update for 'os* and 'arch reporting 2020-11-20 15:35:58 -07:00
Matthew Flatt
39d5adc745 system-type: add 'os* and 'arch modes
The 'os* mode is like 'os, but it provides a more specific result for
Unix variants, such as 'linux on Linux.

The 'os* and 'arch modes together are the information that we've
previously accessed indirectly via `(system-library-subpath #f)`.

Closes #3510
2020-11-20 15:11:52 -07:00
xxyzz
153e417862 generate GitHub Action file for raco pkg new 2020-11-20 10:15:26 -05:00
Matthew Flatt
d88ae7911d Chez Scheme: update expected-error test for cp0 repair
Commit 3b7378f071 turns out to have fixed the error message for an
existing tests (that I didn't notice was wrong before).
2020-11-20 07:41:35 -07:00
Gustavo Massaccesi
b9e1294b19 cptypes: add special case for zero? 2020-11-20 00:25:25 -03:00
Gustavo Massaccesi
cdfa80bde9 cptypes: add suport for bignum? 2020-11-20 00:23:29 -03:00
Matthew Flatt
3b7378f071 Chez Scheme: cp0 repair for fx{+,*}/overflow with identity
Using folding approach for `fx+` caused cp0 to convert `(fx+/overflow
x 0)` to `(fx+/overflow x)`, but two arguments are required.
2020-11-19 19:59:03 -07:00
Matthew Flatt
f34ff31aef cs: improve equal-hash-code
Mixing for sequences did not produce enough variety related to the
length of the sequence. For example, '(0 0) and '(0 0 0) and '(0 0 0
0) had the same hash code.
2020-11-19 19:21:34 -07:00
Matthew Flatt
d1a61e5ab5 Chez Scheme: mark fx{+,-,*}/wraparound as safe on good args
Allow cptypes to convert a `fx{+,-,*}/wraparound` call to unsafe if it
proves that the arguments are fixnums (unlike, say, `fx+`, where the
possibility of overflow remains).
2020-11-19 16:56:28 -07:00
yjqww6
6075923a45 add fast path for rename-in 2020-11-19 15:08:54 -07:00
Matthew Flatt
b5a9fbb03d cs: use wraparound functions for hashing
Change hash-code calculations to use `fx+/wraparound` and
`fxsll/wraparound` instead of `#3%fx+` and `#3%fxsll`. The resulting
code should be the same in the default unsafe compilation mode for the
Racket core, but the `wraparound` versions can be checked in safe
mode.

Also, fill in missing tests in Chez Scheme, which exposed cp0 problems
with `fx-/wraparound`.
2020-11-19 12:38:16 -07:00
Matthew Flatt
53c14c78d6 bc: fix C compiler warnings 2020-11-18 18:15:42 -07:00
Matthew Flatt
77ee4bb877 fix read-line-evt on a port that delivers bytes one at a time
Thanks to Javier Vivanco for the report.
2020-11-18 17:39:18 -07:00
Matthew Flatt
128892c996 add fx{+,-,*,lshift}/wraparound
Expose machine-level operations that stay within the fixnum range,
which can be useful for things like hash-code computations where it's
ok to just lose bits. Operations like `unsafe-fx+` turn out to do that
already in the current implementation, but with no guarantee (and with
no checking of arguments).

For Racket BC, before this commit, JIT-inlined `fxlshift` incorrectly
handled a negative second argument like `arithmetic-shift` instead of
erroring.
2020-11-18 17:39:18 -07:00
Matthew Flatt
9a3eb15d8b cs & thread: fix scheduler timer event in atomic mode
When the thread-scheduler timer fires while a thread is in atomic
mode, the thread could check for breaks even when it shouldn't. Worse,
if the atomic region was to implement terminating a thread, the path
to check for a break could end up ressurecting the thread from the
persspective of `thread-dead?`.
2020-11-18 04:10:06 -07:00
kurinoku
3f9f01e520 Fix mutator listing in struct-auto-info. 2020-11-16 12:42:07 -05:00
Matthew Flatt
5656073637 repair mismatch in fixnum mixing
Scheme code and C code did not compute the same result for negative
fixnums for 64-bit machines.
2020-11-14 12:42:34 -07:00
Matthew Flatt
dc82685ce0 fix mutable hash tables for certain likely fixnum distibutions
A mutable hash table only uses the lower few bits of a hash code,
because it masks the hash code by [one less than] the power-of-two
size of the bucket array. That truncation interacts badly with the
hashing function for fixnums, which is the identity function; if the
the lower several bits of the fixnum stay the same for many keys and
the upper bits change, then there are many hash collisions --- and
that's a relatively likely distribution.

Fix the mutable hash-table implementations by mixing the hash code to
let higher bits influence the lower bits: xor the high half of the
bits with the lower half (which doesn't lose information, because
xoring again would recover the original number), then do the same for
the high one-fourth of bits in the low half, and then (on a 64-bit
platform) the high one-eighth of the low one-fourth of the bits.

Instead if blaming the way the mutable hash-table implementations only
use the lower bits of a hash code, we could blame the hash function on
fixnums for not performing this kind of mixing. In this patch, though,
we take the view that the hash function's job is to map variation in
its domain to variation in the fixnum hash code, and then the hash
table's job is to use that fixnum effectively. That separation of
responsibilities is now documented with `gen:equal+hash`.

There are also improvements here to the hashing function for bignums
in CS and to the secondary hashung function for fixnums and bignums in
BC.

Thanks to Alex Harsanyi for reporting the problem.
2020-11-14 10:45:15 -07:00
Matthew Flatt
b37cc53b70 cs: fix {{,fx,fl}vector,string,bytes}-ref error-message rewrite
Fix the ending index, since it's inclusive.

Thanks to Matthias for the report.
2020-11-13 17:37:38 -07:00
Matthew Flatt
78b09313a0 fix Racket bootstrap for Chez Scheme for 32-bit platforms 2020-11-13 11:34:51 -07:00
Matthew Flatt
fcd9e9448c Chez Scheme: improve guidance from configure 2020-11-13 11:34:51 -07:00
Paulo Matos
355d384e3c
Changes required to compile Racket with C99+exts (#3497)
With these changes RacketCS and RacketBC can be compiled with:
     `-std=c99 -D_DEFAULT_SOURCE`

Also added some documentation on contribution guidelines.
2020-11-13 19:34:12 +01:00
Paulo Matos
83e256cce6
Ensure DEST exists before calling find (#3496)
On raw racket clones when compiling with `--enable-racket` (i.e. no
pb), there are `find` warnings that DEST does not exist and
compilation still succeeds.

This change however, ensures that we do not have build warnings and
that the symlinks are properly created.
2020-11-13 14:43:22 +01:00
Matthew Flatt
b33f26415b Chez Scheme: fix double counting of some adminstrative GC overhead 2020-11-12 18:57:09 -07:00
Matthew Flatt
5f4480e39e generics: adjust generated error messages 2020-11-11 12:54:28 -07:00
Matthew Flatt
7975bdf25d traditional Windows directory paths are limited to 247 characters
... not 259 characters, which is the limit on file paths.
2020-11-10 14:53:07 -07:00
Matthew Flatt
23710d5862 cs & io: avoid overlong Windows paths
Convert paths to "\\?\" as needed to avoid the 259-character limit on
a path length.
2020-11-10 14:53:07 -07:00
Matthew Flatt
0342804b18 rktio on windows: fix buffer size for getting OS current directory
Relevant to #3493
2020-11-10 14:00:43 -07:00
Matthew Flatt
aea024736a unbreak cify 2020-11-10 11:31:41 -07:00
Matthew Flatt
1ac6c15207 add #:unsafe option for #%declare
Finally give in and add an option to compile a module as unsafe. This
was going to be easy, since the option already exists at the linklet
level, but it turns out that a lot of plumbing was needed to propagate
the argument, and even more to preserve unsafety with cross-module
inlining.

Macros can effectively conditoinalize their expansion in unsafe mode
by generating the pattern

 (if (variable-reference-from-unsafe? (#%variable-reference))
     <unsafe variant>
     <safe variant>)

The compiler will only keep one of the two variants, because it
promises to optimize `(variable-reference-from-unsafe?
(#%variable-reference))` to a literal boolean. The expander will still
expand both variants, however, so avoid putting code in both variants
that itself can have safety variants.
2020-11-10 10:36:03 -07:00
Matthew Flatt
c85659b905 Chez Scheme: fix compiler bug introduced with unboxing
When simplifying certain expressions, a non-pointer variable was
created to hold a pointer value.
2020-11-09 13:23:39 -07:00
Matthew Flatt
c017ecbafe cs: avoid inlining error path internally 2020-11-09 11:44:12 -07:00
Matthew Flatt
91e3065991 Chez Scheme: fix typo for flvector operation 2020-11-09 11:43:36 -07:00
Matthew Flatt
a17516f5b6 rktio: repair for subprocesses on Unix witthout threads
A list of pending process records was not managed correctly when
interest in a subprocess is abandoned before the subprocess completes.
2020-11-09 09:24:05 -07:00
Matthew Flatt
a0375111a3 Chez Scheme: fix flvector-copy for 32-bit platforms
Closes #3490
2020-11-09 05:55:47 -07:00
Matthew Flatt
fe54cbc63f Chez Scheme: avoid copying huge objects during GC 2020-11-08 19:22:09 -07:00
Matthew Flatt
e40e86ae5a Chez Scheme: unbreak 32-bit build 2020-11-08 05:56:56 -07:00
Matthew Flatt
7a12b4ac93 cs & thread: repair suspending a thread that is currently in sleep
Thanks to Greg Rosenblatt for the report.
2020-11-07 17:35:30 -07:00
Matthew Flatt
7c8d9c6523 bc: avoid bad floating-point roundoff in seconds->date
Thanks, Xsmith!

Closes #3489
2020-11-07 12:52:38 -07:00
Matthew Flatt
09c9901f6b bc: don't drop operations when impersonators can interpose
For example, if the result of `(when (box? x) (unbox x))` is not used,
then the `(unbox x)` still must be done, because the box might be an
impersonator. In contrast, `(when (box*? x) (unbox* x))` can be
dropped, since `unbox*` is an authentic unbox.

This change applies to unsafe operations like `unsafe-struct-ref`,
too, and applies to struct accessors for non-authentic structure
types.

Racket CS already preserves operations appropriately.

Relevant to #3487
2020-11-07 10:53:44 -07:00
Matthew Flatt
1149bb8b2c reader: extend error message for disabled #lang
Try to give more hints to help somone who writes `#lang` twice.
2020-11-07 07:55:20 -07:00
Matthew Flatt
2b7e36b5f4 Chez Scheme: fix version mismatch for install 2020-11-07 07:54:46 -07:00
Matthew Flatt
2b945d12fb Chez Scheme: add flvectors
To make room in the type encoding, remove immutable fxvectors from
Chez Scheme --- which had been added just to go along with immutable
strings, vectors, and bytevectors, but immutable fxvectors do not seem
useful, and they have no counterpart in Racket.
2020-11-07 07:34:33 -07:00
Matthew Flatt
128174594e fix symbol prining with #\uFEFF characters
Since the reader now treats #\uFEFF as whitespace, adjust the printer to
escape \uFEFFa.

Thanks, Xsmith!

Writing an actual #\uFEFF character seems bad, even escaped, but
Racket's symbol syntax doesn't have a kind of escaping that uses
different characters than the one to be represented.

Closes #3486
2020-11-06 12:20:47 -07:00
Matthew Flatt
6b7a184297 bc: fix gcd on most negative fixnum
Xsmith found this fixnum-boundary bug.

Closes #3484
2020-11-05 17:25:30 -07:00
Matthew Flatt
add9ed72c6 bc: sync expander expansion 2020-11-05 17:24:39 -07:00
Matthew Flatt
3db7e471eb cs: faster path for a foreign call with a lock
The call is only slightly faster, but since it affects text drawing
with `racket/draw`, a slight improvement can be worthwhile for
DrRacket.
2020-11-04 16:33:18 -07:00
Matthew Flatt
1aab61340e cs: fix printed name of some fx and fl functions 2020-11-04 15:33:42 -07:00
Matthew Flatt
e50f53e990 cs: reduce allocation on foreign calls with 5-8 arguments
Extend a fast path for up to 4 arguments to work on up to 8 arguments.
2020-11-04 15:22:41 -07:00
Matthew Flatt
18ff816358 cs: performance improvements related to string encoding
Streamline rktio byte-result copying (main improvement), use fixnum
arithmetic more consistently (minor improvement), and change
`in-bytes`, etc., to avoid some checks in unsafe mode (intermediate
improvement).
2020-11-04 11:57:52 -07:00
Matthew Flatt
fc53f2998c normal-case-path: leave bad encoding bytes alone
When bytes within a Windows path cannot be converted using
`bytes->string/locale` (i.e., when the bytes do not fit a UTF-8
encoding), then leave the bytes alone, instead of triggering a failure
from `bytes->string/locale`.

Fixing this bug uncovered others: `string-locale-downcase` did not
work on an empty byte string on a little-endian machine, and
`in-bytes` and similar reported range errors in terms of "vectors".
2020-11-04 10:27:07 -07:00
Matthew Flatt
66ed5369ef Chez Scheme: accomodate new MinGW for 32-bit Windows 2020-11-03 18:09:56 -07:00
Matthew Flatt
5d53bdac0c Chez Scheme: unbreak 32-bit Windows cross-build 2020-11-03 17:32:08 -07:00
Matthew Flatt
06021193ee cs: fix (system-type 'link) 2020-11-03 15:00:55 -07:00
Matthew Flatt
689fa6e2b2 cs: adjust how boot images get to Chez Scheme
Change the way boot images are sent to Chez Scheme by the Racket CS
wrapper, especially in the case where boot images are embedded in an
executable (which is always true for a distriution build). The revised
approach avoids a little filesystem work, and it may help Chez Scheme
pull bytes in faster.
2020-11-03 13:21:24 -07:00
Robby Findler
daf142c1c0 improve the error messages for flat hash/dc contracts 2020-11-03 09:47:43 -06:00
Matthew Flatt
6e917a610e cs configure: add --disable-wpo
Builing Racket CS on a 64-bit platform requires a little more than 1.5
GB of memory due to whole-program optimization of the Racket core
immplementation. Add a `--disable-wpo` configure option, which keeps
memory use below 0.5 MB to provide the option of building Racket in a
more constrained environment.
2020-11-03 08:11:44 -07:00
Matthew Flatt
7ef4ac10d2 Chez Scheme: move C compiler default flags to configure
Instead of selecting flags through a mixture of `configure` and
"c/Mf-*", determine defaults in `configure`. If `CFLAGS` is provided,
then the defaults are not used. Flags needed for threaded mode are an
exception, and `LDFLAGS` and `LIBS` are expanded even if supplied ---
unless `--disable-auto-flags` is specified.

Closes #3467
2020-11-02 21:03:14 -07:00
Matthew Flatt
3553df0246 avoid C compiler warning 2020-11-02 08:33:49 -07:00
Matthew Flatt
0a7c4e2613 bc: fix printing of #:|.| and #:|#|.
Closes #3477

Thanks, Xsmith!
2020-11-01 06:12:31 -07:00
Matthew Flatt
f6a598a116 raco setup: add --sync-docs-only flag
The `--sync-docs-only` flag is intended for contexts like pkg-build as
a backstop against unintended and time-consuming activity when the
intent is to assemble documentation.
2020-11-01 06:12:31 -07:00
Matthew Flatt
741048eebb remove accidentally comitted debugging output 2020-10-30 17:01:43 -06:00
bdeket
8137798937
Improve (sinh x) : x around 0 (#3473)
* sinh - Taylor expansion near 0
* fast path for |z| < 1e-8 in this case the second term is already to small to matter
2020-10-30 12:36:13 -04:00
Matthew Flatt
24bd6abecb cs: _path should not force an absolute path
While sending an absolute path to a foreign library is usually the
right idea to ensure that it's relative to `(current-directory)`, the
`_path` FFI type should not do that automatically --- because
sometimes it's useful to send a relative path to a foreign library,
but most because it hasn't been defined that way in BC.
2020-10-30 08:25:43 -06:00
Matthew Flatt
507454a6d8 rktio: use tm_gmtoff instead of timezone on Linux
Closes #3474

Xsmith discovered that Chez Scheme's use of `tm_gmtoff` is better
thank rktio's use of `timezone`.
2020-10-30 07:10:32 -06:00
Matthew Flatt
de3e22f7a4 bc: fix string downcasing of U+1E9E
In building up conversion tables, information from "SpecialCasing.txt"
data was incorrectly merged with data from "UnicodeData.txt" so that
not-quite-so-special casings were fumbled. For Unicode 7.0, the bug
turned out to affect only string downcasing of U+1E9E.

Closes #3475

Thanks to Xsmith!
2020-10-29 17:32:39 -06:00
Matthew Flatt
dcaa20b411 initialize default locale
Changes to use xlocale fixed problems with places and locale settings,
but it caused the initial process-wide locale to stay with the C
locale, which is bad for things like libedit. To get the good part of
the old behavior bback, set the process-wide locale to "" on startup.
2020-10-29 15:51:08 -06:00
Matthew Flatt
d70a11236f Chez Scheme: fix flonum modulo and remainder
Use fmod() instead of trying to work around imprecision in the naive
algorithm.

Closes #3469

Great catch, Xsmith!
2020-10-27 16:58:55 -06:00
Matthew Flatt
fd2ffe3170 reference: cite Concurrent ML 2020-10-27 16:50:26 -06:00
Paulo Matos
11be8813a2
Fix CFLAGS ordering to ensure users CFLAGS take precedence (#3466) 2020-10-27 13:34:10 +01:00
Matthew Flatt
0b42a143af cs: fix shell-execute error reporting
Closes #3465
2020-10-25 20:06:03 -06:00
Matthew Flatt
c2797c0e9d bc: fix rationals as place messages
When an exact (non-integer) rational is reconstructed from a place
message, normalization could involve bignum operations --- and those
operations might use a cache, but the cache should not refer to the
pages that are specific to a place message being constructed.
Normalization isn't necessary, since the parts were already in a
rational, so the repair is just it skip it.

Relevant to #3456
2020-10-23 15:42:26 -06:00
Paulo Matos
3dc37ee035
Use locale.h if not xlocale.h header (#3461)
Otherwise we have a missing definition for locale_t when
RKTIO_USE_XLOCALE but !RKTIO_USE_XLOCALE_HEADER.
2020-10-23 23:41:41 +02:00
Matthew Flatt
5f8ad6039d cs & io: fix subprocess handling with places
A table of subprocess handles to finalize was not place-local as it
should have been. The same was true of a table of resolved IP
addresses to finalize.

Related to  #3456
2020-10-23 11:22:46 -06:00
Matthew Flatt
fb87a5032c cs: fix exit on catastrophic failure
Actuall exit, instead of calling `exit` with the wrong number of
arguments and generating an endless stream of errors.
2020-10-23 09:10:05 -06:00
Matthew Flatt
9caa0554bc Chez Scheme: fix race in a test 2020-10-23 08:28:55 -06:00
Matthew Flatt
614992a65c Chez Scheme: more repairs to avoid xlocale and an old-compiler warning 2020-10-22 16:57:47 -06:00
Matthew Flatt
0a6b8356c1 Chez Scheme: unbreak parallel GC on Arm
Thanks to @Bogdanp for the report and correct repair idea.

Closes #3455
2020-10-22 22:56:05 +00:00
Matthew Flatt
8734215827 racket/HISTORY.txt for v7.9 2020-10-22 08:38:28 -06:00
Matthew Flatt
d3ef0a0a35 cs & io: fix ~s formatting of keywords 2020-10-21 17:24:03 -06:00
Matthew Flatt
3ce134866b Chez Scheme: repair fasl of deeply nested values
The Racket variant of Chez Scheme includes special treatment of deeply
nested structures to avoid a C-stack overflow on unfasl, but the
relevant callbacks had gotten mangled.

Closes #3454
2020-10-21 13:14:54 -06:00
Matthew Flatt
c3dbc3dd2a Chez Scheme: avoid uselocale on more Solaris
A refinment to a86cf525ef, which moves the no-`uselocale`
declaration to a more reliable place.
2020-10-21 12:11:17 -06:00
Matthew Flatt
279412d316 cs & schemify: fix [non-]loop detection in lifting pass
When a would-be loop is called in a would-be loop that turns out not
to be a loop due to an intervening non-loop layer, the outer would-be
loop was not detected as a non-loop.
2020-10-21 11:42:56 -06:00
Matthew Flatt
5304ff5327 expander: fix malformed linklet
A linklet generated for deserializing syntax objects shadowed a local
variable, which is not allowed.
2020-10-21 11:02:03 -06:00
Matthew Flatt
efbb431a69 cs & schemify: another set! repair
When the mutability decision on a variable is delayed, but then the
variable is discovered to be mutable before the delay is triggered,
then mutability information could get lost.
2020-10-21 09:37:40 -06:00
Matthew Flatt
42a9e26ee9 schemify: fix handling of set! in dead code
Mutability analysis may determine that a `set!` is dead code, and then
the mutated variable might be optimized away, so don't leave the dead
`set!` behind.
2020-10-21 08:45:00 -06:00
Matthew Flatt
1dcabfada7 cs: fix handling of cross-module inline with strange srcloc
When the srcloc-enriched S-expression representation a function that
is available for cross-module inlining has a source that is not a
path, string, or symbol, then the source has to be dropped in the
module's serialized form.
2020-10-21 07:29:40 -06:00
Matthew Flatt
0ed1fc3850 cs & thread: fix atomic mode in callbacks within replace-evt
A nested evt poll did not move back to non-atomic mode when calling
event generators in the first argument of `replace-evt`.
2020-10-21 05:49:53 -06:00
Matthew Flatt
3b34b0ce02 cs: fix printer for symbols containing ; or `
Closes #3448

Thanks again, Xsmith!
2020-10-19 15:26:31 -06:00
Matthew Flatt
6c6cfd39b2 rktio: avoid nl_langinfo_l
Using `nl_langinfo_l` crashes the "unicode.rktl" test on Linux. I
don't know how `nl_langinfo_l` was being misused, but it's easy to
just avoid it.
2020-10-19 09:50:16 -06:00
Matthew Flatt
a86cf525ef Chez Scheme: avoid uselocale on Solaris
Although Solaris 11 and up probably have `uselocale`, just disable its
use in the expeditor on Solaris for simplicity.
2020-10-19 07:43:14 -06:00
Matthew Flatt
7411b7ffa7 rktio: detect and use xlocale 2020-10-19 07:26:40 -06:00
Matthew Flatt
1091536361 remove unneeded mutex acquire 2020-10-19 06:38:35 -06:00
Matthew Flatt
8baf16c093 cs: fix random on 4294967087
On a 64-bit machine, the problem was a `<` versus `<=`.
On a 32-bit machine where 4294967087 is not a fixnum, the
problem was in how bignums are handled.
2020-10-17 17:38:03 -06:00
Matthew Flatt
9f5c0cbb07 cs: fix names of some byte-string primitives
Closes #3441
2020-10-15 18:19:45 -06:00
Robby Findler
1aac750373 add missing paren 2020-10-15 17:12:02 -05:00
Philip McGrath
79fceea024 flat-contract-with-explanation: fix internal error
Previously, `error` would raise an `exn:fail` with the following message,
because it treated the first of the three strings as a format string
and the other two as its arguments:

> error: format string requires 0 arguments, given 2;
> arguments were:
> " is a procedure, to always escape when called"
> " (by calling raise-blame-error with the arguments it was given"`
2020-10-15 17:10:24 -05:00
Matthew Flatt
a471692ce8 raco setup: remove forced GCs and add output timestamps
The main change is to disable forced GCs during the documentation
phase in a parallel `raco setup`. Since each GC is global (instead of
place local) in Racket CS, these forced GCs created a scaling problem.
Furthermore, they're not really necessary; peak memory use tends to
remain the same without them in a parallel build, since the
".zo"-building phase doens't have extra collections and tends to
establish peak memory use.

A non-parallel build still includes explicitly forced GCs. In that
mode, the cost is modest while reducing peak use by 30%.

A new environment variable appends timestamps (in process time since
startup) for each status line, which is useful for generating more
detailed build plots.
2020-10-14 19:25:13 -06:00
Matthew Flatt
927ab67f27 Chez Scheme GC: potentially keep allocation ownership in accounting mode
Since a GC with accounting doesn't run in parallel, it discards
owner-thread information (ironically) that is used for parallel
collection. Losing ownership information could reduce parallelism in
later collections --- but only if they run without accounting.

This commit does not turn on ownership tracking, however, because
experiments suggest that it isn't worthwhile for Racket:

 * Preserving ownership information slows down a major collection in
   accounting mode by 5-10%.

 * Racket uses accounting mode only for full collections, and the loss
   of ownership information would mostly affect only later full
   collections. Since accounting momde tends to stick around, very
   little parallelism is actually lost.

 * Without further work, accounting mode cannot benefit from
   parallelization, because it works by stepping sequentially through
   accounting domains, and that aligns with thread ownership. A
   possible improvement is to look ahead in the accounting-domain
   object sequence to find one that starts in another ownership
   domain, and then constrain concurrent tracing from that object to
   keep the count private and not leave the ownership domain until the
   accounting sequence has caught up.

Besides making it easier to turn on "parallel" collection for
accounting mode, the small refactorings here make it easier to bring
more things, like guardian and weak-pair handling, into the parallel
part of a collection. So, the changes are probably worth keeping for
that purpose.
2020-10-14 11:24:52 -06:00
Matthew Flatt
331a710e22 pretty-print: fix spacing when a symbol includes a newline
Closes #3439
2020-10-13 16:04:18 -06:00
Matthew Flatt
366bdcb9e7 avoid compiler warning 2020-10-12 19:39:32 -06:00
Matthew Flatt
5c45588573 cs: provide hint to GC about places
The collector tries to use roughly the same amount of parallelism as
the number of active threads, but make sure that it doesn't fall back
to an ownership-mangling non-parallel collection if all but one place
happens to be stalled.
2020-10-12 19:24:24 -06:00
Matthew Flatt
449f01b55d Chez Scheme GC: simplify make parallel sweeper object exchange
Make the exchange of objects by parallel sweepers --- which is needed
when an object being swept by one thread refers to an object owner by
another thread --- much simpler and slightly faster.

The original design of exchanging memory regions didn't really work
out, and it had degrenerated to essentially exchanging objects.
Explicitly exchanging objects instead of regions makes the GC simpler,
because received objects can be just added to the regular sweep stack,
and less additional space<->type correspondence is needed.
2020-10-12 18:00:27 -06:00
Matthew Flatt
1a1bad4e90 expander: repair literal syntax in test position of if
Fix mishandling of an expanded `if` where the test position is a
syntax object. The expander's compiler pass from expanded objects to
linkets knows that the syntax object isn't useful, but it tried to be
helpful by preserving the syntax object's content as quoted --- and
that content turns out not to be available, so the syntax object was
replaced by #f, instead.

Closes #3436
2020-10-12 17:58:37 -06:00
Matthew Flatt
82744013d5 cs: unbreak build 2020-10-12 09:35:20 -06:00
Matthew Flatt
3566536cfe cs: more OpenIndiana repairs 2020-10-12 09:17:47 -06:00
Sergiu Ivanov
5cbff3403a
hash.rkt: Add hash-intersect 2020-10-11 13:37:02 -06:00
Matthew Flatt
9905c1c89a cs: fix srcloc->string as relative to current-directory-for-user 2020-10-11 11:40:25 -06:00
Matthew Flatt
59e31e700d more normalization of checked-in schemified code
Rename definitions that are not exported and that are not used as
inferred function names. The rename is based on a hash of the
right-hand side, instead of being just the position of the definition
in the module, and that should help further reduce diffs in schemified
output after small changes to the source.
2020-10-11 10:57:31 -06:00
Matthew Flatt
5691ade54d cs: repairs for building on Solairs / OpenIndiana 2020-10-11 09:04:21 -06:00
Matthew Flatt
77ece3feb0 cs & io: fix 'any line reading mode and buffer boundary
Closes #3434
2020-10-10 20:31:11 -06:00
Matthew Flatt
f1f4959b66 Chez Scheme: separate allocation and thread mutexes
Instead of one big lock, have one big lock and one small lock for just
manipulating allocation state. This separation better reflects the
locking needs of parallel collection, where the main collecting thread
holds the one big lock, and helper threads need to take a different
lock while changing allocation state.

This commit also includes changes to cooperate better with LLVM's
thread sanitizer. It doesn't work for parallel collection, but it
seems to work otherwise and helped expose a missing lock and a
questionable use of a global variable.
2020-10-09 17:45:48 -06:00
Matthew Flatt
274bce975a remove unintended copy of include files 2020-10-09 17:45:48 -06:00
Paulo Matos
67c00aaa7d
Fix ARMv7 build using Thumb-2 (#3431)
This ensures that the moveq instruction is inside an IT block.
Backward compatible change - still builds on ARMv6 with Thumb.

This breakage is generally not noticeable on a RPi3 because, although the
CPU is ARMv7, it is generally running an ARMv6 OS.
2020-10-09 18:10:57 +02:00
John Clements
965fa1a541 Post-release version for the v7.9 release 2020-10-08 11:58:50 -07:00
Matthew Flatt
68bb2a6973 cs: fix cpointer offset handling for C API racket_cpointer_address 2020-10-08 06:48:51 -06:00
Matthew Flatt
20f087af92 Chez Scheme: add C API functions for records and record types 2020-10-07 18:41:20 -06:00
Paulo Matos
c5e3de2a7b
Add option to enable asan compilation in CS: --enable-asan (#3428)
Add workflow `ci-asan.yml` to test CS with ASAN as well.
2020-10-07 17:18:56 +02:00
Paulo Matos
0834d28d75
Remove assignment typo (#3429) 2020-10-07 14:38:45 +02:00
Alex Knauth
003ac9b338
add keyword-apply/dict to racket/dict (#2592)
* add keyword-apply/dict to racket/dict
* add history note
2020-10-07 01:11:02 -04:00
Matthew Flatt
c471e3192b cs: fix typo in dump-memory-stats error message 2020-10-06 19:23:17 -06:00
Matthew Flatt
716e6d9435 Chez Scheme GC: fix interaction of backtrace and incremental promotion
Disable incremental promotion when backreferences are enabled,
otherwise the backreference list for a generation can have
references to younger-generation objects.
2020-10-06 15:10:29 -06:00
Paulo Matos
8a14d31f06
Fix compiler warning in 32bits due to size mismatch in ptr cast (#3427)
Casting a ptr to an integer of a different size causes a warning - this is only noticeable on 32bits. Fix this by using `TO_VOIDP` and `TO_PTR` helper macros.
2020-10-06 14:36:53 +02:00
Matthew Flatt
da6fd94fe1 expander: fix module cache when current-load-relative-directory is #f
Corrects a problem with 4525c231a7.
2020-10-05 14:15:52 -06:00
Sam Tobin-Hochstadt
73053d7a60 Disable implicit for-clause optimization with syntax property.
Related to #3396.
2020-10-05 13:29:52 -04:00
sorawee
812339a04b
reqprov: fix disappeared-use
This PR fixes two issues regarding disappeared-use in reqprov.rkt

1. Copy/preserve disappeared-use for all provide subforms instead
of only the first one. The following program doesn't have an arrow from
`struct-out` to `#lang racket` prior this PR, but it does after this PR.

    #lang racket
    (provide a? (struct-out a))
    (struct a ())

2. Fix incorrect `disappeared-use` for `struct-out`: it is inappropriate
to check if an identifier is bound to a struct info in provide
pre-transformer because it would not be able to handle backlinks.
This PR moves the attachment from provide pre-transformer to provide
transformer, allowing Check Syntax to draw an arrow for the identifier
`abc` in:

   #lang racket
   (provide (struct-out abc))
   (struct abc ())
2020-10-05 10:13:43 -06:00
Matthew Flatt
2a66eddcc9 schemify: fix undefined checking when constants no enforced
Related to #3325
2020-10-05 08:33:10 -06:00
Matthew Flatt
4d8851d1be rktio: add support for xlocale
Add support for using xlocale's thread-friendly API instead of
setlocale --- but it's not turned on, yet, for any platform.
2020-10-04 06:32:15 -06:00
Matthew Flatt
4525c231a7 expander: make cache accomodate optional directory path terminator
The cache is sensitive to `current-load-relative-directory`, but
normalize with `path->directory-path`.
2020-10-03 16:29:53 -06:00
Matthew Flatt
629153c4e0 Chez Scheme GC: repair for locked object in space_new 2020-10-02 17:22:27 -06:00
Matthew Flatt
cb50bab726 unbreak Windows CS build 2020-10-02 12:21:34 -06:00