Commit Graph

6065 Commits

Author SHA1 Message Date
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
Matthew Flatt
19fc04ae0e makefiles: clean out unused Git submodule targets and hooks 2020-10-02 11:17:34 -06:00
Matthew Flatt
6b4f9d6885 Chez Scheme GC: improve heap checking
Handle marked segments and check dirty bytes (for generational GC)
for typed ojbects.
2020-10-02 11:17:34 -06:00
Matthew Flatt
53ef242889 fix arity exception for a keyword procedure
Closes #3416
2020-09-30 08:05:19 -06:00
Paulo Matos
5db75a92ae
Small fixes to enable LTO compilation (#3418)
Small fixes to enable LTO compilation

To do this in racket/src:
  ./configure CFLAGS="-O3 -march=native -flto"
              LDFLAGS="-O3 -march=native -flto"
              --prefix=...

One fix deals with variable `errnum` that might be used uninitialized.
The other is to ensure that `boot_file_data` is marked as used
otherwise, it is removed by LTO and ends up crashing build
in `embed-boot.rkt`.
2020-09-30 15:44:13 +02:00
Matthew Flatt
838b4e7896 rackt/unit: add some missing syntax-track-origins 2020-09-29 20:17:36 -06:00
Matthew Flatt
46a191df03 expander: fix srcloc tracking for set! on rename transformer 2020-09-29 14:08:17 -06:00
Matthew Flatt
c7e6cbc001 cs: more repairs for old vector-based HAMT
Fix `hash-map` and `hash-for-each` for applicable structs.
2020-09-29 09:50:29 -06:00
Matthew Flatt
58deff8b6f cs: repairs for old vector-based HAMT
Sync the old implementation with some repairs for `equal?/recur` and
key replacement.
2020-09-29 08:38:35 -06:00
Matthew Flatt
c4df79b38d cs windows: add dependencies on petite.so and scheme.so
Originally, the dependency was expressed via "compile-file.ss", but
now the dependency can be more direct.
2020-09-28 19:15:33 -06:00
Matthew Flatt
075048409b bump version 2020-09-27 15:36:40 -06:00
Matthew Flatt
b203c52193 Chez Scheme GC: keep per-thread allocation more separate
Instead of having leftover Scheme threads swept by the main thread,
distribute Scheme threads among sweeper threads, and swap into each
thread's content to preserve its allocation ownership. This change
makes parallelism more consistent for different timings that end up
assigning sweepers differently.
2020-09-27 15:36:40 -06:00
Matthew Flatt
16d71ac249 Chez Scheme GC: refactor thread and allocation organization
Move per-thread allocation information to a separate object, so the
needs of the collector are better separated from the thread
representation. This refactoring sets up a change in the collector to
detangle sweeper threads from Scheme threads.
2020-09-27 15:36:40 -06:00
Matthew Flatt
c46e4f91c1 Chez Scheme GC: internal parallelism by messages instead of locks
Change the internal parallelism strategy for the GC to record an owner
for each allocated segment of memory, and have the owner be solely
responsible for copying or marking objects of the segment. When
sweeping, a collecting thread handles references to objects that it
owns or that have been copied or marked already, and it asks another
collecting thread to resweep an object that refers to objects owned by
that that thread. At worst, an object ends up being swept by all
collecting threads, one at a time, but that's unlikely for a given
object.

The approach seems likely to scale better than a lock-based approach,
even the one that used a lightweight, CAS-based lock and retries on
lock failure.
2020-09-27 15:36:40 -06:00
Gustavo Massaccesi
4fdc896412 fix typos in linklet.sls 2020-09-26 10:49:09 -04:00
Robby Findler
515012525c improve value-contract handling a little bit
That is, use pairs on the property in more places, as the pair
already was computed and the value-blame function already does
the needful when it sees a pair on the property.
2020-09-24 17:18:27 -05:00
Robby Findler
816e20b803 fix bug in ->i (neg party was getting dropped) 2020-09-24 17:18:27 -05:00
xxyzz
659741bb58
bc: declare interntional unsafe fixnum arithmetic
Eliminate overflow errors from fixnum test when racket bc compiled with
--enable-ubsan (issue #2314)
2020-09-22 07:57:32 -06:00
Matthew Flatt
d24cbd4344 Chez Scheme GC: faster record type handling
When the GC needs to copy/mark a record, it previously forced a
copy/mark on the record's type descriptor, since the copy/mark needs
information from the descriptor. But the needed information is not in
danger of being overwritten for forwading (since it's after the first
two words of the type descriptor), so it's ok to use the old reference
as-is --- at least in non-counting mode. Simplifying record-type
handling and deferring the record-type update to the sweep phase, the
same as for other components of the record type, makes the GC slightly
faster.
2020-09-22 07:52:13 -06:00
Matthew Flatt
54367de430 Chez Scheme GC: fix overhead tracking 2020-09-20 07:25:51 -06:00
Matthew Flatt
024cc90813 Chez Scheme: avoid MinGW warnings 2020-09-19 11:36:56 -06:00
Matthew Flatt
fa3b0699d3 Chez Scheme: sync pb
Also, improve internal timing instrumentation for parallel GC.
2020-09-19 11:36:56 -06:00
Matthew Flatt
4ee149d226 Chez Scheme GC: add ephemeron checking to parallel phase 2020-09-19 11:36:46 -06:00
Matthew Flatt
7738499c70 Chez Scheme GC: move dirty-sweep phase to parallel
The dirty-sweep phase handles old objects that have references to
objects that are in generations about to be collected.
2020-09-19 07:10:02 -06:00
Matthew Flatt
8f08a9ee5c cs: fix srcloc path conversion on load with no current-load-relative-directory
Fall back to `current-directory` when `current-load-relative-directory`
is #f.

This change also affects `deserialize` --- not because byte code
loading uses it directly in this case, but because they share a helper
function, which exposes the issue. This implementation change is
worrying (even though it makes the implementation match the
documentation), but unless we discover that some use of serialization
needs absolute paths deseialized as relative, is seems better to be
consistent everywhere about falling back to `currenrt-directory`. This
aspect of the change can be reverted separately (by adding more code)
if needed.

Closes racket/drracket#421
2020-09-18 14:36:48 -06:00
Matthew Flatt
1766cba6c6 cs: repair sync on empty byte-string port 2020-09-16 20:03:28 -06:00
Matthew Flatt
60b2f8e0c2 CS: fix continuation-mark-set->context results
Return function names as symbols instead of strings.

Closes #3398
2020-09-15 15:43:34 -06:00
Matthew Flatt
a74a30ee8d cs: fix supression of built-in functions in traces
Repairs 0ae3ef7b42 after the number representing the static
generation changed.
2020-09-15 15:33:49 -06:00
Matthew Flatt
c1f62ae959 Chez Scheme: fix intern of some symbols on startup
Closes #3399
2020-09-15 15:19:12 -06:00
Sorawee Porncharoenwase
cb723ad4c8 info: recognize by binding
Prior this PR:

    #lang info
    (list 1)

is accidentally considered well-formed.
This PR fixes the problem.
2020-09-15 10:45:50 -06:00
sorawee
6366874ecd
for: optimize literals
Closes #883
2020-09-15 10:43:57 -06:00
Matthew Flatt
8305e5eaef Chez Scheme: parallel garbage collection
All allocation is now thread-local, which recovers a small bit of
performance that was lost when adding thread-local allocation
alongside global allocation.

Parallelism uses thread contexts created by Chez Scheme threads (which
correspond to Racket places and future-running threads), but it
creates its own OS-level threads to perform collection. The number of
collection-helper threads is limited to the number of active Chez
Scheme threads. Only the main "sweep" pass runs in parallel --- that
is, after roots have been traversed, and before weak references and
finalization are handled --- but that's the bulk of collection work.
Also, memory-accounting collections always run as single-threaded.
2020-09-15 07:40:13 -06:00
Matthew Flatt
78fedb3b24 Chez Scheme: tweak segment test for double-pair copying 2020-09-15 07:23:54 -06:00
Matthew Flatt
f1e5f38a77 Chez Scheme: fix reducing maximum generation
Adjust recent changes to cooperrating with setting
`maximum-collect-generation` to a smaller value.
2020-09-06 06:22:41 -06:00
Matthew Flatt
78b7cc3fc9 cs: use thread-local allocation while sweeping in collector
This is a second step toward parallel collection.
2020-09-05 17:22:12 -06:00
Matthew Flatt
3f3cf5ab83 cs: more thread-local allocation
Improved support for thread-location allocation (and using more
fine-grained locks in fasl reading) may provide a small direct
benefit, but the change is mainly intended as setup for more
parallelism in the collector.
2020-09-05 08:47:07 -06:00
Matthew Flatt
b9e4b5dbb1 makefiles: enable ".boot" files in non-cross CS builds on Windows
There's a trade-off between keeping the distribution sizes small and
making ".boot" files available for convenient embedding, even though
embedding is relatively rare. For Unix platforms, since you have to
build from source to get a static library for embedding anyway, we'll
leave out ".boot" files. For Mac OS, the distribution's "Racket"
framework includes ".boot" files --- even though the framework is
itself unused for a normal distribution build, since signing and
notarization are handled by embedded the boot files in an executable,
but the framework was kept for a kind of backward compatibility. For
Windows, the Racket DLL can be used for embedding, so the ".boot"
files would be the only missing piece; also, they were already
included in a cross-built distribution.

Update "Inside" to note that ".boot" files must be built on Unix and
to clarify the location of ".boot" files on Mac OS.

Closes #3377
2020-09-03 07:31:01 -06:00
Matthew Flatt
3f0631116a Chez Scheme: improve repair for arm32 return-address reference
Since the offset is always a multiple of 4, expand the range of
compactly encoded offsets.
2020-09-03 06:46:46 -06:00
Matthew Flatt
f5895ebc97 Chez Scheme arm32: avoid bouncing in label-address assignment
The A32 instruction set has an interesting encoding of immediate
values where a larger value sometimes fits in a smaller set of
instructions. That turns out to be a bad property for loading a return
address, because it means that the as label computations push code
further away, a contracting return-address calculation can pull code
back nearer, and this push-and-pull can keep the label allocator from
arriving at a fixpoint.

This became a bigger problem with 8834597c1f, which creates
return-label references that go backwards and where the offset can be
much larger than the normal, forward references.
2020-09-02 18:37:15 -06:00
Ryan Culpepper
5c0d75fa3e datum: always force promise 2020-09-02 20:21:44 +02:00
Ryan Culpepper
45fb9b4d63 make datum variable in syntax template an error
Previously, a datum variable was treated as a constant.
2020-09-02 20:21:44 +02:00
Ryan Culpepper
25142daea5 change datum to work with syntax variables too 2020-09-02 20:21:44 +02:00
Matthew Flatt
bf1d99d9e0 expander: repair prompt that should be a barrier 2020-09-02 07:54:38 -06:00
Matthew Flatt
8ca49775b4 improve docs on issues with for bindings
See #3378: The possibility of mutation should be considered in
`:do-in` in somme rare cases, while it's not clear that there's
anything better to be done for mutation of the list accumulators in
`for/lists`. At least make the pitfalls clearer in the documentation.
2020-09-01 19:02:42 -06:00
Matthew Flatt
fb9bd97844 for/lists: repair body handling
Closes #3375
2020-09-01 19:02:42 -06:00
Matthew Flatt
f90b1f21bf makefile: more fixes for install of include files on Windows 2020-08-31 20:16:58 -06:00
Matthew Flatt
ba5cbaf2e2 Chez Scheme and rktboot: adapt to work with latest nanopass
This commit doesn't update nanopass itself, but adapts `rktboot`
so it can be used with the main Chez Scheme bbranch. It also
adjust "cpnanopass.ss" to avoid different behavior between the
old and newer versions of nanopass.
2020-08-31 12:48:10 -06:00
Matthew Flatt
60e6989620 Chez Scheme: further improve memory-use reporting
Remove counts for more GC-time administrative structures (counting
them only in the overhead).

Related to #3338
2020-08-31 12:46:37 -06:00
Matthew Flatt
c75d8d71c1 cs makefile: fix cross-compilation dependency 2020-08-31 08:59:25 -06:00
Matthew Flatt
ef9a4a4e29 cs makefiles: fix cross install for Windows to install include files
Closes #3374
2020-08-31 08:33:24 -06:00
Matthew Flatt
8834597c1f Chez Scheme: fix continuation on result-count exception
The Scheme stack pointer was left in call state when the number of
results is wrong, with the intent of exposing the enclosing function's
frame for debugging purposes, but there's no guanrantee that the
result address is still on the stack (i.e., the continuation make have
been captured). Reinstall the return address before calling the
exception handler.
2020-08-31 07:18:26 -06:00
Matthew Flatt
b83e598b20 makefile: fix gractketcgc dependency
This change was meant to be part of 979fbf551d.
2020-08-30 09:12:51 -06:00
Matthew Flatt
f1b98900f5 rumble: fix misuse of fx=
Looks like I previously changed the wrong `eq?` to `fx=`.
2020-08-30 09:11:40 -06:00
sorawee
6a685f52c6
track disappeared-use for case's else
Closes #3363
2020-08-29 06:21:05 -06:00
Matthew Flatt
c95775641d expt: improve for flonum base and exact integer exponent
Avoid coercing an integer to a flonum when doing so loses
precision. It's especially helpfu lto preserve oddness
versus evenness.

Closes #3360
Closes #3100
2020-08-28 16:18:46 -06:00
Matthew Flatt
f086075093 ffi/unsafe: fix _bitmask in non-application position
The exported `_bitmask` is a macro that picks up a compile-time name
when available, but the macro expanded inconsistently.

Closes #3367
2020-08-28 14:28:01 -06:00
Matthew Flatt
0ae3ef7b42 suppress built-in functions in stack traces
Experiment with removing built-in Racket functions in stack traces to
make the trace less noisy. "Built-in" is defined as code that exists
in the built-in modules. On CS, built-in code is detected as residing
in the static generation. (Also, on CS, the code must have a name but
no source location or detailed debugging information to be
suppressed.) On BC, a code object has a bit set if it's loaded at boot
time.

This change makes stack traces look more like Racket BC traces before
the macro expander was implemented in Racket. The frames for built-in
functions have been useful for implementing the expander and Racket
CS, but probably they're just noise for most users most of the time.

Set the `PLT_SHOW_BUILTIN_CONTEXT` environment variable to preserve
all available frames in the stack trace.
2020-08-28 13:01:47 -06:00
Matthew Flatt
95812bd7a5 cs: repair decoding of method names in stack traces 2020-08-28 11:05:15 -06:00
Matthew Flatt
a22550a963 prefer XDG paths, but fall back to old paths
Use "~/.racket" for 'pref-dir if it exists and "~/.config/racket"
doesn't, for example.

Based on discussion at #3268, especially with Ryan.
2020-08-28 09:26:40 -06:00
Ryan Culpepper
f52bff8a31 use XDG paths
'pref-dir = ${XDG_CONFIG_HOME:-~/.config}/racket/
 'pref-file = (build-path (find-system-path 'pref-dir) "racket-prefs.rktd")
 'addon-dir = ${XDG_DATA_HOME:-~/.local/share}/racket/
 'init-dir = ${XDG_CONFIG_HOME:-~/.config}/racket/
 'init-file = (build-path (find-system-path 'init-dir) "racketrc.rktl")
 'cache-dir = ${XDG_CACHE_HOME:-~/.cache}/racket/

... except actually the "~" uses PLTUSERHOME if set.

Use cache-dir as default "download-cache" parent dir.

related to #2740
2020-08-28 08:19:56 -06:00
Matthew Flatt
979fbf551d makefile: fix some dependency tracking
Add cm-accomplice tracking to the expander extractor, so changes to
"rktio.rktl" are picked up for "io".

Fix GRacket BC dependencies on rktio.
2020-08-27 17:41:02 -06:00
Matthew Flatt
d280462250 reader: treat BOM like whitespace in places where comments are allowed
Some text-editing tools on Windows include a BOM character (encoded)
at the start of a file that is intended as UTF-8. The general
recommendation for UTF-8 is to *not* include a BOM --- but, well,
Windows. When a BOM is there, meanwhile, the recommendation is to
preserve it in the stream, so always discarding an initial BOM at the
file-port level is not a good idea. A new file mode would make sense,
but distinctions like 'text and 'binary mode have turned out to be
best avoided.

Although I'm not sure it's really a good idea, treating a BOM
character as whitespace in the reader (at least in comment positions)
is an easy way around the problem for text files that are intended as
programs.

Closes #1114
2020-08-27 16:59:08 -06:00
Matthew Flatt
ace1c6a128 Mac OS: add libedit to the set of native libraries
The libedit library supplied by Mac OS is old and does not support
Unicode, so include a build that does support it.
2020-08-27 12:14:56 -06:00
Matthew Flatt
e5899bd3e6 cs: initialize locale on startup
The `current-locale` parameer value is transferred to the C lbrary via
`setlocale` on demand by Racket functions that depend on the locale,
but some libraries (like libedit) can also depend on the locale
setting. By default, the C library starts with the "C" locale, so it's
worthwhile to install the default locale on startup, even if that's
not a complete solution to support changes to `current-locale`.
2020-08-27 10:47:41 -06:00
Matthew Flatt
38570e3ea6 improve unsafe-linklet error message 2020-08-26 06:18:04 -06:00
Bogdan Popa
1177112970
rktio: get CPU count from the OS on FreeBSD and OpenBSD 2020-08-26 06:17:40 -06:00
Sorawee Porncharoenwase
66547f3aaf Change else in match to _
This fixes at least one "potential" bug in the file
`collects/pkg/private/create.rkt`, where `else` in the
`cond` is bound to `else` from `match` instead of `racket/base`.
(though it turns out that the format will always be
truthy, making the program happen to be correct.)
2020-08-25 09:37:02 -06:00
bdeket
6edc3dbfab gracket/gc2 makefile
Without this change, the below build fails for me.
This reflects the GRACKETLDFLAGS in the makefile one folder above. However I have no idea if this has wider implications...
```
mkdir build
cd build
..\configure --enable-bcdefault
make
```
2020-08-25 09:07:56 -06:00
Matthew Flatt
80ad628eef cs: avoid Chez Scheme fasl of immutable hash table
Change the ".zo" format to convert a linklet bundle hash table to a
list, which avoids probblems with stencil-vector encodings and cross
cimpilation between 32-bit and 64-bit platforms. Avoiding records,
stencil values, and hash code should make the fasled form simpler.
2020-08-23 20:20:07 -06:00
Matthew Flatt
b164f16681 compile-directory-zos: improvements for skip-path[s] and info 2020-08-23 19:34:55 -06:00
Matthew Flatt
b1aee01b8c cs: fix cross-compile depdency tracking 2020-08-23 19:34:55 -06:00
Matthew Flatt
1f18530719 cs: repair boot-reset linking for cross compiles 2020-08-23 19:34:55 -06:00
Matthew Flatt
71bf119460 Chez Scheme: repair pseudo-random for cross compile 2020-08-23 19:34:55 -06:00
Matthew Flatt
8d96a758d0 cs: support cross compile for Arm Linux 2020-08-23 19:34:55 -06:00
sorawee
a5b69b6594
Make struct* use static struct field information
This PR is largely based on #732

Fixes #3265
Closes #732
2020-08-21 05:47:07 -06:00
Mauer-Oats
da5f77e277 add guards to two uses of seen 2020-08-20 18:42:28 -06:00
Bogdan Popa
d259596a35 pkg: deduplicate dependency list for install command 2020-08-20 18:37:37 -06:00
Matthew Flatt
20cac0056c fix 32-bit ARM barrier preprocessor conditional 2020-08-20 08:58:00 -06:00
Matthew Flatt
ee467fbbb4 pb interpreter: work around old compiler bug 2020-08-20 08:51:36 -06:00
Matthew Flatt
9bde4bc009 update some native-lib build notes 2020-08-20 07:48:15 -06:00
Matthew Flatt
85f3e9f5cb arm32: using ARMv6 memory fence 2020-08-20 07:34:56 -06:00
Matthew Flatt
7a373de4cb Chez Scheme: repair ptr <-> void* conversions for pb on 32-bit 2020-08-20 06:46:23 -06:00
Matthew Flatt
1260f888c9 Chez Scheme: add test case for recent continuation GC repair 2020-08-19 09:04:21 -06:00
Matthew Flatt
2742962988 update "racket/src/native-libs" scripts
Repairs for tool drift and over-specific patch rules.
2020-08-18 16:40:44 -06:00
Robby Findler
afb68b29d4 improve contract0stronger? for between/c vs integer-in 2020-08-18 14:28:26 -05:00
Matthew Flatt
7d8a95a943 for/set: same body handling as for/list, etc.
Change `for/set` to use `split-for-body`. Also, adjust the
documentation of `for/fold/derived` to recommend using
`split-for-body`.

Closes #3351
2020-08-16 16:41:38 -06:00
Matthew Flatt
413106413d cs configure: use strip -S on racket with --enable-embedfw on Mac OS
Closes #3349
2020-08-16 16:00:38 -06:00
Matthew Flatt
4a4e12bc8c cs: repair register-finalizer-and-custodian-shutdown
Refine the approach in 91abd020d1 so that it's only used when needed
to work for the combination of custodian management and unsafe
finalization.

Also, improve the documentation to clarify the constraints on
`register-finalize` due to its implementation in CS by ordered
finalization. This constraint is also reflected in a new `#:ordered?`
argument to `register-custodian-shutdown`. Any existing code that uses
`register-custodian-shutdown` plus `register-finalizer` directly
instead of `register-finalizer-and-custodian-shutdown` would need to
be updated for Racket CS, but code like that should be rare to
nonexistent.

Closes #3352
2020-08-16 07:37:22 -06:00
Matthew Flatt
bf06162210 cs: revert custodian change that creates a leak
Reverts the repair attempt in 91abd020d1. The problem with switching
to a "late" reference is that it's based on ordered finalization in
Racket CS, which doesn't work on values that can refer back to
themselves.
2020-08-16 06:29:18 -06:00
Matthew Flatt
f42ddd2853 cs: scale GC trigger by number of running places
Since all places share the same pool of memory, scale the
amount of memory allowed before trigger a (minor) GC by
the number of running processes.
2020-08-15 19:29:32 -06:00
Matthew Flatt
e47260cb36 cs: fix memory accounting for large objects 2020-08-15 18:46:00 -06:00
Matthew Flatt
a2bc613a4c cs configure: improve propoagation of LIBS
Propagate `LIBS` to rktio's configure, and also move some flags in
`LIBS` that should be in `LDFLAGS`. The immediate result is to repair
the detection of iconv for rktio on FreeBSD.

Closes #3353
2020-08-15 16:22:28 -06:00
Matthew Flatt
61f701dcff io: avoid atomic-mode crash when locale converter is not available
Related to #3353
2020-08-15 16:11:24 -06:00
Matthew Flatt
91abd020d1 cs: allow unsafe finalizers on managed objects
Change the regular weak reference in a custodian, which allows
`will-executor`-based finalization, to a "late" weakk reference, which
allows both `will-executor` and `register-finalizer` finalization.

Closes #3352
2020-08-15 12:58:29 -06:00
Matthew Flatt
0f530dd9f4 cs: fix custodian callbackks to run on exit
Related to #3352
2020-08-15 12:58:29 -06:00
Matthew Flatt
c96673d198 Chez Scheme: repair for MinGW 2020-08-15 12:58:29 -06:00
Matthew Flatt
57be9a7702 fix FORCEINLINE for MinGW 2020-08-15 07:49:07 -06:00
Matthew Flatt
5894550833 makefile: adjust pb fetch for older git clients
Use `git fetch -q origin $(PB_BRANCH):remotes/origin/$(PB_BRANCH)` to
make sure a `remotes` branch is added locally.
2020-08-15 07:46:11 -06:00
Matthew Flatt
9619205a9d cs: update Rumble layer for incremental promotion in GC 2020-08-14 17:43:54 -06:00
Matthew Flatt
3aa2d99000 repairs to initial merge of incremental promotion of objects 2020-08-14 17:43:54 -06:00
dyb
48487ed6fb Added support for incremental promotion of objects
- the collector now promotes objects one generation higher at a time
  by default.  previously, it promoted every live oldspace object to
  the selected target generation, which could result in objects
  prematurely skipping one or more generations and thus being
  retained longer than their ages justify.  the biggest cost in
  terms of code complexity and performance is the recording of
  pointers from older newspace objects to younger newspace objects
  that could not previously occur.
    gc.c, alloc.c, externs.h
- the collect procedure now takes an additional optional minimum
  target generation argument to allow the new default behavior to
  be overridden.
    7.ss, primdata.ss,
    gcwrapper.c,
    7.ms, root-experr*,
    smgmt.stex, release_notes.stex
- added cn flag to control collect-notify
    mats/Mf-base
- resweep_weak_pairs now sets sweep_loc to orig_next_loc rather than
  first_loc since the latter could result in unnecessary sweeping of
  existing target-generation weak pairs.
    gc.c
- added set of S_child_processes[newg] to S_child_processes[oldg]
  in S_do_gc code handling decreases in the maximum generation.
    gcwrapper.c
- a specialized variant of the collector is used in the common case
  where the max copied generation is 0, the min and max target
  generations are 1, and there are no locked generation 0 objects
  is now used. with the default collection parameters and no locking
  of generation 0 objects, these collections account for 3/4 of all
  collections.
    gc.c, gc-011.c (new), gcwrapper.c, externs.h, c/Mf-base
- maybe-fire-collector no longer tries to be so precise and instead
  just counts the number of generation-bytes allocated since the
  last gc.  suprisingly, rebuilding the s directory requires about
  the same number of collections with this coarser (and less
  expensive) measurement.  this change also fixes a problem with
  too-frequent collections when the maximum-generation is set to
  zero.  to make the determination even less expensive, a running
  total of bytes in each generation is now maintained in a new
  bytes_of_generation vector, and maybe-fire-collector is no longer
  called when the collector is running.
    alloc.c, gc.c, gcwrapper.c, globals.h
- copy now copies two pairs at once only if they are in the same
  segment, which saves a few memonry references and tests and turns
  out not to reduce the number of opportunities significantly in
  tested programs.
    gc.c
- occupied_segments, first_loc, base_loc, next_loc, bytes_left,
  bytes_of_space, sweep_loc, and orig_next_loc are now indexed
  by [g][s] rather than [s][g] to improve locality in the default
  (and common) case where there are only a handful of active
  generations.
    globals.h, types.h, segment.c, gc.c, gcwrapper.c, prim5.c
- now maintaining 16-byte architectural stack alignment (if the
  incoming stack is so aligned) on all x86 platforms except
  i3nt/ti3nt.  more recent versions of gcc sometimes generate sse
  instructions that require 16-byte stack alignment.
    x86.ss

[Merge for Racket includes additional changes to combine with in-place
 marking - mflatt]
2020-08-14 17:08:04 -06:00
Matthew Flatt
45a84dcb97 schemify: drop variable names that are unused for errors
Using just a number makes the code smaller, and it makes the
checked-in ".scm" vary less going forward.
2020-08-13 16:04:20 -06:00
Matthew Flatt
be6312314b cs: check linklet imports when a procedure is expected 2020-08-13 15:52:45 -06:00
Matthew Flatt
ab1b164982 cs ffi: fix handling of struct results 2020-08-13 13:54:10 -06:00
Matthew Flatt
1e91db8053 raco setup: add debug logging to report available concurrency 2020-08-13 13:54:10 -06:00
Jesse Alama
b722d81059
Remove dead store identified by a static analyzer (#3341)
Evaluate to_quoted, possibly for side effect (emitting a
quote), but ignore its return value.

Co-authored-by: Jesse Alama <jesse@lisp.sh>
2020-08-11 19:11:54 +02:00
Matthew Flatt
543dab5964 cs: fix iteration on copy of a mutable hash table
Incorrect initialization of the copy's iteration state for a hash
table meant that table sizes larger than 32 looked like tables of only
32 elements when iterating (including when printing).

Closes #3344
2020-08-09 15:51:39 -06:00
Matthew Flatt
4f0290186b cs: fix optimizer bug
An optimization pass used mostly for inlining did not reqcognize
`quote`, and it could replace a quoted name with a constant-propagated
value.

Closes #3339
2020-08-08 13:03:40 -06:00
evdubs
980a9fbd4d Ensure sorting is applied for in-directory
In initial-state, the call to dir-list will sort the results of directory-list. However, in initial-state, there is a different path that will call directory-list without sorting. This change makes these paths consistent.
2020-08-07 07:59:00 -06:00
Matthew Flatt
776b69e399 avoid race on places and initialization for eval
Force visits on internal Chez Scheme modules before starting a place,
so that there won't be a race among places to visit the modules.
2020-08-07 07:19:58 -06:00
Fred Fu
e4dc27a2b8 fix typos in comments 2020-08-06 16:29:58 -06:00
Matthew Flatt
581f02d6f8 expander: fix make for generating BC source
Also, update "README.txt" to explain both CS and BC setup.
2020-08-06 14:09:53 -06:00
Matthew Flatt
06ed5bf8f5 cs gracket: unbreak zero-argument case on Unix 2020-08-06 07:45:19 -06:00
Matthew Flatt
6317669f51 cs gracket: fix handling of X11 flags and -singleInstance
X11 flags and -singlreInstance were being filtered from the command
line but not propagated to the `racket/gui`.
2020-08-05 18:01:21 -06:00
Matthew Flatt
65b69a91e5 add needed store fence in list-bits management 2020-08-05 06:25:12 -06:00
Paulo Matos
342e95cf32
Fix variable replacement (#3337)
By using `{$threadLibs}` it meant we ended up with a command line with `{hreadLibs}`, which breaks the arm32le build.
2020-08-05 14:10:17 +02:00
Matthew Flatt
29a6ca6737 Chez Scheme: increase FP registers for x86_64 2020-08-05 05:55:28 -06:00
Matthew Flatt
2b73b20704 Chez Scheme: on Arm64, implement popcount with CNT and ADDV
Initial measurements suggest that performance is unchanged, but it
at least generates less code.
2020-08-05 05:55:28 -06:00
Matthew Flatt
204d9d6f01 Chez Scheme: increase available registers on Arm64 2020-08-05 05:55:28 -06:00
Matthew Flatt
744e69c0c1 add flsingle
The `flsingle` function takes a flonum and discards precision that
wouldn't fit in a single-flonum. If single-precision arithmetic is
somehow useful, then combine flonum operations with `flsingle` to
discard precision on the result; even on Racket BC, that's likely to
perform better than using generic arithmetic on single flonums.
2020-08-05 05:55:28 -06:00
sorawee
dcf034280e
Preserve multivalued-ness of stream in stream operations 2020-08-04 07:02:40 -06:00
Sorawee Porncharoenwase
e2b8fdb553 cs: change multiple values mismatch error to match bc
Related to #3325
2020-08-04 06:53:11 -06:00
Jay McCarthy
09ff1344e8 git-checkout display repo on error 2020-08-03 10:30:11 -04:00
Matthew Flatt
fcd7295457 remove uuid lib from linking specs 2020-08-03 05:37:27 -06:00
Matthew Flatt
2d0961adcf avoid dependency on libuuid by using /dev/urandom on non-Windows 2020-08-02 18:33:13 -06:00
Matthew Flatt
2cca030eff Chez Scheme: fix tests to work outside of source directory 2020-08-02 18:30:43 -06:00
Matthew Flatt
b32b3178bc raco: recognize racobc when trying to distinguish from setup-plt 2020-08-02 14:58:51 -06:00
Matthew Flatt
9b5dd35adc makefile: fix cross builds 2020-08-02 14:28:45 -06:00
Matthew Flatt
2885df0347 update build guide and READMEs for CS as default 2020-08-02 07:57:12 -06:00
Matthew Flatt
e6752e9afc configure: switch default from BC to CS
This change brings the top-level makefile and `configure` back in
sync, but it affect source distributions by changing the `configure`
default there.
2020-08-02 07:57:12 -06:00
Matthew Flatt
093fcd1bc7 makefile: make Racket CS the default
The top-level makefile now builds Racket CS as `racket` by default.

Use `racket bc` to build Racket BC as `racket`. Use `make both` to
build both CS and BC (the latter with the `bc` suffix) overlayed in a
single build. By using `make both` insted of `make cs` plus `make bc`,
you can avoid redundant package downloads and documentation rendering.

To build Racket BC as `racket`, use `racket bc RACKETBC_SUFFIX=`, but
you must consistently use `RACKETBC_SUFFIX=` with `make` every time.
2020-08-01 17:33:53 -06:00
Matthew Flatt
1c181ffbd8 cs: change undefined-variable error to match bc
Add a missing "in".

Related to #3325
2020-08-01 12:47:08 -06:00
Matthew Flatt
351c45c78b rktio: fix use of POLL... where EPOLL... is intended 2020-08-01 09:10:26 -06:00
Matthew Flatt
ad3baffc8d fix gracketcgc install 2020-08-01 08:12:22 -06:00
Matthew Flatt
719cd66835 Chez Scheme makefiles: fix .bootquick when source has boot files 2020-08-01 07:52:04 -06:00
Matthew Flatt
6c59a722a1 makefiles: fix install of GRacket BC 2020-08-01 07:05:30 -06:00
Matthew Flatt
b0bd5061d5 Chez Scheme makefile: create correct directory on .bootquick 2020-08-01 06:17:22 -06:00
Matthew Flatt
2ae4ee4163 makefiles: build Chez Scheme in the "build" area
Instead of leaving Chez Scheme build artifacts in in the ChezScheme
source directory, keep them in a "build" directory like everything
else.
2020-07-31 16:33:07 -06:00
Matthew Flatt
c1cd9c499c adjust Chez Scheme configure script to work in any directory
Adjust `configure` and makefiles so that `configure` can be run in an
directory, not just the source directory. Initial boot files are found
at either the current directory or the source directory.

Also, add support for `-B` and `--Boot` flags to accept a path that is
resolved relative to the current directory, instead of relative to the
installation.
2020-07-31 16:32:19 -06:00
Matthew Flatt
fc5f846693 cs: fix Mac OS framework versioning 2020-07-31 12:47:07 -06:00
Matthew Flatt
6886dc2143 make bc and cs configure scripts more symmetric
The `--enable-cs` and `--enable-csdefault` flags now enabled just the
CS build, as long as pb boot files are present or
`--enable-racket=...` is supplied.
2020-07-31 11:08:42 -06:00
Matthew Flatt
ed415a3795 move "racket/src/racket" -> "racket/src/bc"
Also, move "racket/src/gracket" and "racket/src/foreign" to
subdirectories of "racket/src/bc".
2020-07-31 06:40:26 -06:00
Matthew Flatt
8ef22d6334 src/configure: unbreak main-target setup 2020-07-30 20:20:45 -06:00
Matthew Flatt
cde197125c support Racket BC build and installation with a "bc" suffix 2020-07-30 20:14:34 -06:00
Matthew Flatt
1d9db6eec3 makefile: make bc and cs rules more symmetic
Currently, `make` is the same as `make bc`, but the idea is that
`make` can become the same as `make cs` when some other pieces are in
place.

The source of the top-level makefile is now ".makefile", and it's
turned into "Makefile" using "racket/src/makemake.rkt". The
transformation makes non-GNU `make` variants and `nmake` act like GNU
make to propagate variables, which makes abstraction through targets
plus variables (admitedly an abuse of `make`) more reliable and
consistent.

Why abuse `make` this way? Because `make` variants and `nmake` are
similar enough that to constitute a portable scripting language, and
one that conveniently provides a large number of entry points.
2020-07-30 13:29:02 -06:00
Paulo Matos
a4b6ac701e
Solo Chez build/test workflow (#3316) 2020-07-30 13:19:49 +02:00
Matthew Flatt
7d7b8fb1e9 makefile: fix cs targets to not break non-cs targets 2020-07-29 13:37:39 -06:00
Matthew Flatt
8a0bb78ab1 unbreak windows CGC build 2020-07-29 10:06:31 -06:00
Matthew Flatt
0d279ca06d prune Boehm GC references from the MSVC projects 2020-07-29 09:25:22 -06:00
Matthew Flatt
ea096e1989 move cfg-racket to cfg-bc 2020-07-29 08:58:42 -06:00
Matthew Flatt
7c256a051d replace "traditional Racket" references with "Racket BC" 2020-07-29 08:27:58 -06:00
Matthew Flatt
e42dfffa3a update unixstyle-install for a source distribution 2020-07-29 06:56:24 -06:00
Matthew Flatt
af651ca435 Merge branch 'master' of github.com:racket/racket 2020-07-29 05:20:13 -06:00
Paulo Matos
a20f55cf47 Remove Boehm GC from Racket
Boehm GC has not been regularly tested or even used - therefore
removal avoid bit-rot.
2020-07-28 13:23:17 -06:00
Matthew Flatt
62a3f6ec91 change CS build to use a subtree Chez Scheme and a bootstrapped pb
Also, schemified "thread", "io", "regexp", "schemify", and "expander"
layers are checked in. Overall, building Racket CS no longer requires
first building Racket BC.
2020-07-28 12:56:42 -06:00
Matthew Flatt
c6e0c54a4f repair for pb on FreeBSD 2020-07-28 12:54:43 -06:00
Paulo Matos
139c1de00f Call recursive make through $(MAKE)
This fixes the build under FreeBSD 12.1 where the system `make` is not compatible with the Chez makefiles and gmake is needed instead.
2020-07-28 12:54:42 -06:00
Matthew Flatt
89831c01f6 bc: fix optimizer bug
Fix inlining problem when inlining has been explicitly disabled.

Closes #3309
2020-07-28 12:43:39 -06:00
Matthew Flatt
d44fcbf041 import Chez Scheme sources as racket/src/ChezScheme
The imported sources are from the `racket/ChezScheme` repository,
which branched from `cisco/ChezScheme`. The commit history is
preserved, but all of the commit IDs have shifted, because bootfiles
have been pruned from the history.
2020-07-27 07:41:56 -06:00
Matthew Flatt
5022107489 cs windows: fix build
Nested `includes` for ".def" files need compile before load.
2020-07-25 17:23:36 -06:00
Matthew Flatt
efc95c2e19 remove "cs-bootstrap" package
The "cs-bootstrap" package is now in the `racket/ChezScheme` repo,
because it needs to track the Chez Scheme implementation instead of
the Racket implementation.
2020-07-25 16:32:05 -06:00
Matthew Flatt
914db0b549 cs-bootstrap: support nested include and define-constant-default 2020-07-25 12:40:21 -06:00
Matthew Flatt
a69111c1bd sync with updated Chez Scheme 2020-07-24 15:43:45 -06:00
Matthew Flatt
574e8e32e2 unbreak non-xform 3m embedding setjmp
Commit 023681947c fixed a problem cooperating with xform, but the
repair assumes xform. The "embed-in-c.rkt" test, for example, uses 3m
without xform (and instead uses macros like `MZ_GC_DECL_REG`.
2020-07-24 10:47:33 -06:00
Matthew Flatt
93a7b5d29c more detail in racket/HISTORY.txt
It's not clear that adding to "HISTORY.txt" is all that useful. But as
long as we do, at least include milestones that were signficant enough
to mention in release announcements.
2020-07-24 08:59:19 -06:00
deeglaze
ef2132ced3 Fix some typos in expander comments 2020-07-20 10:38:00 -06:00
sorawee
7c903871bd
Fix unchecked struct with custom constructor (#3301)
Fix a bug introduced in #3267

Related to: #3300

Sounds good to me!
2020-07-18 16:32:58 -07:00
Matthew Flatt
39b37dd892 repair inconsistencies with simplify-path
CS didn't always return a complete path when simplifying in
use-filesystem mode. On Windows, CS and BC were inconsistent with each
other and the Unix behavior.
2020-07-17 05:50:16 -06:00
Matthew Flatt
6e3c111728 repairs for build-path on \\?\RED\ paths
A `\\?\RED\` path is Racket- and Windows-specific, and it's an extreme
corner case: a drive-relative absolute path that include elements that
must eb specially esacped. BC's `build-path` incorrectly allowed
`\\?\RED\` to extend an absolute path. CS's `build-path` incorrctly
allowed various absolute-path extensions, including `\\?\RED\` paths.
The documentation was slightly off.
2020-07-17 05:50:16 -06:00
Matthew Flatt
7709287e03 cs: fix split-path on a \-less Windows drive root 2020-07-17 05:50:16 -06:00
Matthew Flatt
6805145e10 cs: protect special filenames from directory-list
For example, return `\\?\REL\\aux` instead of `aux`.
2020-07-17 05:50:16 -06:00
Matthew Flatt
9867d11d68 cs: fix resolve-path to just cleanse when there's no link
Don't convert thet path to absolute, and don't normalize separators on
Windows.

Also, fill in `current-drive`.
2020-07-17 05:50:16 -06:00
Matthew Flatt
c18dcd72c7 rktio: fix (consistent) typo in variable name 2020-07-16 07:07:12 -06:00
Matthew Flatt
d2f8c83368 add file-or-directory-type
Since file links and directory links on Windows are disjoint, and the
difference is relevant for operations such as deleting a file,
`link-exists?` is not enough information. Add `file-or-directory-type`
to provide more information and also avoid separate calls to
`file-exists?`, `directory-exists?`, etc.

The `delete-directory/files` function now uses `file-or-directory-type`
so that it will work right with Windows directory links.

Relevant to #3288
2020-07-16 06:53:30 -06:00
Matthew Flatt
1a7c898ea2 windows: allow symlink creation when developer mode is enabled
Relevant to #3288
2020-07-15 16:57:35 -06:00
Matthew Flatt
c8c7fd7043 rktio: avoid over-large read or write request 2020-07-15 16:57:32 -06:00
Matthew Flatt
91acb4293e racket/HISTORY.txt for v7.8 2020-07-15 10:36:15 -06:00
Matthew Flatt
454a586a79 cs: support source-location paths in compiled code
Procedures in compiled code could not previously have source-location
paths that are managed through the write-relative and load-directory
configuration. Instead, paths were always converted to strings that
start "..." --- and those strings were sometimes incorrectly converted
back to paths in context information extracted from a continuation
mark set.

This commit takes advantage of changes to Chez Scheme `fasl-write` and
`fasl-read` (and related for compiling code) to lift paths out where
linklet-level marshaling can take care of them.
2020-07-15 06:44:42 -06:00
Bogdan Popa
3e08f50944
win32: add Power Shell script to set env vars
The added PS script runs msvcprep.bat in a sub shell then reads the environment
variables line by line and sets them in the current shell.
2020-07-14 06:52:18 -06:00
Matthew Flatt
740f345937 bc: improve FFI handling of unions and arrays on Arm
libffi doesn't support unions or arrays, so we have to simulate them,
and the simulation depends on ABI details.
2020-07-13 10:01:04 -06:00
Matthew Flatt
5cc686526b cs: sync with revised fasl compression for code
Sync with changes from cisco/ChezScheme. The specific code fragments
that are compressed and the chunks that are used for compression
remain essentially the same as before for Racket CS, but a different
organization at the Chez Scheme level takes over some of the work that
was on the Racket CS linklet layer, and load times may improve
slightly.
2020-07-13 06:57:45 -06:00
Matthew Flatt
c56b837692 cs: fix addition of memory-order-{acquire,release} 2020-07-13 06:50:15 -06:00
Matthew Flatt
40f07236b9 add memory-order-{acquire,release} 2020-07-11 19:59:27 -06:00
Sam Tobin-Hochstadt
100597f9bb Repair 7f44aaf2bf to check argument length before /. 2020-07-09 21:29:49 -04:00
Matthew Flatt
7dda76b7ce cs: add aarch64-linux
Just a few configuration lines here, since all of the porting work was
at the Chez Scheme level.
2020-07-08 20:22:11 -06:00
John Clements
39a8a50d0a
apparent typo in collection-search looks like error should be raise-argument-error (#3285) 2020-07-08 11:16:22 -07:00
John Clements
38d92bdb30 Post-release version for the v7.8 release 2020-07-08 08:47:14 -07:00
Robby Findler
ac4ae9ebba adjust ->i to fall back to the slow path to signal the error
because the existing shortcut didn't gave the right message all the
time.

Closes #3286
2020-07-04 17:41:46 -05:00
Ryan Culpepper
497bb25917 read-xml: use {open,get}-output-string instead of list->string 2020-07-02 19:33:13 -04:00
Matthew Flatt
e0f390c8c8 syntax/strip-context: handle hash tables
Closes racket/scribble#245
2020-07-02 14:42:18 -06:00
Luka Hadzi-Djokic
8464896255
Add combine-output-ports 2020-07-02 14:14:48 -06:00
Matthew Flatt
c40a7ae2fc cs: limit debugging context in continuation marks
In CS, if you interrupt an especially tight non-tail recursion, such
as

 (let loop ()
   (cons 1 (loop)))

then the "context" view of the continuation (as recorded in a
continuation mark set) can take space that is a multiple of the size
of the continuation itself. That's a particular problem if the
too-deep recursion triggers the memory limit in DrRacket, because
DrRacket will then need a multiple of its current heap space to report
"out of memory".

(Note: Just keeping the continuation itself is not a good option,
because that may retain other data referenced by the continuation.)

This commit reduces the heap space used to gather a continuation
context, relying in part on new Chez Scheme support, but mostly it
limits the context length to roughly the same maximum as in BC. The BC
limit is an implementation artifact, but it turns out to have good
properties; informaiton on more than 64k continuation frames is rarely
useful. The limit could be a parameter, but a large built-in limit
seems likely good enough.

(Another note: Adding a limit argument to
`continuation-mark-set->context` doesn't help enough, because it's too
late by that point; too much memory has been used to repersent the
information that's in the mark set.)

The commit also tightens tracking of continuations for memory
accounting, reducing the chance that a thread's large continuation
will be charged to the wrong custodian.
2020-07-02 10:59:02 -06:00
Matthew Flatt
7c7f16ba02 bc: system-library-subpath for aarch64-linux 2020-07-02 08:50:56 -06:00
Bogdan Popa
96c93abe7f rktio: fix demo.c compilation errors 2020-07-01 06:10:54 -06:00
Matthew Flatt
c0a525db60 bc: repair --enable-shared install
Don't try to install librktio.a when building in shared-library mode.
2020-06-30 07:40:29 -06:00
Matthew Flatt
3bb607d46f makefile: fix location of 3m arm assembly output 2020-06-29 18:43:53 -06:00
Sorawee Porncharoenwase
ee773b2835 Fix contract-out for struct
- A part of contract-out's code generation for struct assumes that
there's no parent struct and uses the provided struct name for
everything. This causes duplicate definitions when there are duplicate
field names where one is in a child struct and another is
in a parent struct. This PR fixes the problem.
- Disallow multiple #:omit-constructor
- Deprecate super-id. This information is unnecessary since we can
extract it from static struct information already. Attempting to
check that super-id is well-formed is error-prone due to how
the super struct type could be contracted which shields us from
detecting that they are indeed the super type.
- Utilize static struct field name information, and provide
the information when exporting a struct.

This PR is largely based on #732.

Fixes: #3266, #3269, #3271, and #3272
2020-06-29 19:35:19 -05:00
Matthew Flatt
b9770f6869 cs: remove outdated porting note 2020-06-29 16:49:20 -06:00
Matthew Flatt
b00e8415b7 cs: check memory limit in make-phantom-bytes 2020-06-29 16:49:20 -06:00
Sam Tobin-Hochstadt
7f44aaf2bf io: format error message fixes. 2020-06-29 16:10:30 -04:00
Matthew Flatt
0af11de62b ffi: another spurious CAS accommodation
Also adjust the futures test suite.
2020-06-29 12:45:14 -06:00
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