Commit Graph

40255 Commits

Author SHA1 Message Date
Matthew Flatt
72852c7b75 cs: use call-consuming-continuation-attachment
Use `call-consuming-continuation-attachment` to implement
`with-continuation-marks`, because that avoids duplicating
a set of checks when in tail position.
2019-09-11 17:21:25 -06:00
Matthew Flatt
5bcf7eb19d cs: fix optiimizer arity for make-parameter
Should have been part of 91d702c6fe.
2019-09-08 17:58:34 -06:00
Matthew Flatt
2403b18e0f cs: more constant tokens
Should have been part of 12a2cd75a8.
2019-09-08 17:57:10 -06:00
Alexis King
415f030212 Fix syntax-local-value[/immediate] rename transformer context
fixes #2815
2019-09-08 14:56:43 -05:00
Matthew Flatt
866c5d41e0 cs: unbreak Windows build 2019-09-08 07:24:49 -06:00
Matthew Flatt
f4fa74e6f2 expander: fix reader bug
Fix incorrect comparison of character to EOF. There's a test, already,
but the test fails only if the expander is compiled in safe mode.
2019-09-06 17:35:54 -06:00
Matthew Flatt
4c630a2442 sync bootstrapped expander
Update expander embedded in traditional Racket to pick up
the parameter names added in 5147771b04.
2019-09-06 17:35:54 -06:00
Matthew Flatt
3024b77ba5 add custodian-based unloading of foreign libraries
Specificially, add a `#:custodian` argument to `ffi-lib`.
2019-09-06 17:35:54 -06:00
Matthew Flatt
276a102d6a add ffi-lib-unload at the #%foreign level 2019-09-06 17:35:54 -06:00
Sam Tobin-Hochstadt
5147771b04 Name more internally-defined parameters and std library parameters. 2019-09-06 11:54:22 -04:00
Paulo Matos
a5abfa9a0d
Fix typo 2019-09-06 08:35:28 +02:00
Matthew Flatt
8bb41e590d cs: yet another try at the major-GC heuristic
Looking at `bytes-allocated` usually works, but sometimes lets
memory use spiral out of control. Looking at `current-memory-bytes`
is more reliable, but still makes peak memoy use too high.
Combining those values doesn't limit the peak well enough.
Try the more obvious (in retrospect) approach of comparing
`bytes-allocated` changes and `current-memory-bytes` changes
separately, and triggering a GC if either grows enough.
2019-09-05 20:14:31 -06:00
Matthew Flatt
12a2cd75a8 cs: constant tokens
Instead of allocating tokens like `undefined` or `parameter-key`
with `gensym` on startup, allocate them once for all eternity.
2019-09-05 11:13:41 -06:00
Matthew Flatt
8284dfa1b1 cs: add names for primitive parameters 2019-09-05 08:22:49 -06:00
Matthew Flatt
1f2342b57a cs: adjust trigger major GC
Commit 1811193285 caused Racket CS to have much higher peak memory
use. Adjust the heuristic again to trigger a major GC when the
`current-memory-bytes` value is the post-GC `bytes-allocated` plus the
post-GC `current-memory-bytes`, which means waiting until
another `bytes-allocated` bytes are allocated (instead of waiting
until the number of newly allocated bytes also catches up to overhead,
such as unserused pages due to locked objects).
2019-09-05 08:22:49 -06:00
Matthew Flatt
91d702c6fe add name argument to make-parameter 2019-09-05 08:22:49 -06:00
Matthew Flatt
cccaf4e46e cs: change representation of parameters
Implement a parameter as a Chez Scheme wrapper procedure,
instead of an applicable record. A wrapper procedure can be
applied more directly, saving 10-20% of the time for some
parameter lookups.
2019-09-05 08:22:49 -06:00
Paulo Matos
8c049d914e
Remove definitions for __LITTLE_ENDIAN, __BIG_ENDIAN, and __BYTE_ORDER (#2807)
These are already defined in /usr/include/endian.h for all tested configurations
Related to #2797
2019-09-04 19:32:02 +02:00
Matthew Flatt
36e00806de io: fix call to raise-arguments-error 2019-09-03 18:47:44 -06:00
Matthew Flatt
88464b327a ffi doc: make-wrap-<id> binding from define-cstruct
When `#:property` is used wih `(define-cstruct _<id> ....)`, then
`make-wrap-<id>` is among the defined identifiers.
2019-09-03 18:47:44 -06:00
Jon Zeppieri
b0d753e2d6 Implements negated unicode categories in pregexps
The grammar for pregexps includes:

   | \p{‹property›} Match (UTF-8 encoded) in ‹property›
   | \P{‹property›} Match (UTF-8 encoded) not in ‹property›

and <property> is defined as:

   ‹property› ::= ‹category› Includes all characters in ‹category›
               |  ^‹category› Includes all characters not in ‹category›

That is to say, there are two independent ways to negate one of
these character classes. The Racket implementation of regexps
(as opposed to the C implementation) does not recognize negated
categories. This PR fixes that.
2019-09-03 18:47:33 -06:00
Matthew Flatt
9fa6e9e25d repair GC problem with 'atomic-interior / 'interior
Some parts of the GC meant to traverse all objects on a page of
'atomic-interior or 'interior objects used "<" to detect the end of
the page, but "<=" was needed. As a result, things could sometimes go
wrong for the last object on a page for platform and size combinations
where the last object ends exactly at the end of the page.

This change consistenly computes the iteration end in a way that makes
both "<" and "<=" work.

Using MPFR bindings from the `math` library could trigger a problem
(but it's difficult to provoke the problem in a reasonably small
example --- difficult enough that I couldn't do it).
2019-08-30 12:25:32 -06:00
John Clements
65ce0cd468
gen:stream fix example code (#2802) 2019-08-30 10:34:09 -04:00
Matthew Flatt
1811193285 cs: correct and imprrove heuristics for force a major GC
Use `current-memory-bytes` instead of `bytes-allocated` to determine
major GCs, because the latter doesn't include enough (perhaps missing
finalized values). For example, the repair avoids unbounded memory use
from

  (let loop ([i 0])
    (malloc 6400 'atomic-interior)
    (loop))

due to finalizers that pile up faster than they are run.
2019-08-30 06:32:17 -06:00
Matthew Flatt
dd5e517e88 cs: fix random-seed to be compatible with Racket
Fix `random-seed` to set the pseudo-random generator's
state to the same state as traditional Racket.
2019-08-29 19:14:39 -06:00
Matthew Flatt
afef3fe900 remove unused C function declaration 2019-08-28 15:51:51 -06:00
Matthew Flatt
fd63d5a1ba cs: rewrite error message for car, cadr, etc.
Closes #2798
2019-08-28 05:56:47 -06:00
Matthew Flatt
1e2019f600 reference: add pointers to immutable?
When reading just the vector section of the Reference, it's
not obvious that `immutable?` distinguishes immutable vectors,
so add a note there. And the same for sttrings, etc. The section
on boxes was missing the usual paragraph on mutability.

Based on a suggestion from Shriram.
2019-08-27 15:57:31 -06:00
Gustavo Massaccesi
800ea98525 use KMP to avoid quadratic time in string-contains? 2019-08-27 09:59:51 -03:00
Matthew Flatt
a8d5a4f2f4 avoid unneed preprocessor redefinition
Limit a Mac-specific declaration that isn't needed anyway.

Related to #2797
2019-08-27 06:01:16 -06:00
Sam Tobin-Hochstadt
81bdbb19e9 Add guide documentation on printing exception information.
Suggested by badkins.
2019-08-26 09:33:09 -04:00
Matthew Flatt
76a7ee0ccd raco exe: expand in fresh namespace
Related to racket/typed-racket#852
2019-08-26 05:32:28 -06:00
Matthew Flatt
9f424cfe0a cs: fix procedure names in jitified linlet to use 'inferred-name
When a linklet is too large to pass to Chez Scheme whole, then
names for the procedures that are individually compiled need to
be extracted from 'inferred-name for reference in the wrapper.

Closes #2787
2019-08-22 21:06:53 -06:00
Matthew Flatt
2a5df8ad2a rktio: fix Windows network error reporting
Convert wide-character error message to UTF-8.

Closes #2794
2019-08-22 17:15:20 -06:00
Matthew Flatt
d14a4f75a1 read: refine message for some ill-formed #lang lines
In particular, improve the message when `#lang` is followed
by two space characters.
2019-08-22 15:40:59 -06:00
Nick Thompson
8d2b0ba363 Add native dark mode to macOS apps
Enables native dark mode UI elements in macOS 10.14 and above. Adds the
'NSRequiresAquaSystemAppearance' key with a value of 'false' to the
Info.plist file, while allows UI elements to match the system theme even
when not building against the latest SDK.
2019-08-22 14:37:33 -06:00
Matthew Flatt
e8cb4015a7 adjust tests to accomodate no-pthread build modes
The new fifo handling requires pthreads, so skip some tests where
the implementation falls back to a less complete implementation.
2019-08-22 09:08:20 -06:00
Matthew Flatt
2d0f10f473 rktio: better behavior for opening write and of fifo
When opening the write end of a fifo that doesn't have a reader
already, the old implementation could allow writing bytes that are
discarded. This new implementation uses a blocking `open` in a
`pthread`, and that way the write routines know whether the stream is
ready for writing or not.

The difference is visible in the Racket API in a two places:
`subprocess` needs to wait until a fifo writer is connected before
attempting to dup the corresponding file descriotor, and more
generally a use of `unsafe-port->file-descriptor` needs to wait. The
former blocking operation is now build into `subprocess` (and
documented), but the burden is place on callers of
`unsafe-port->file-descriptor` to wait is necessary.

The new `port-waiting-peer?` predicate exposes the waiting state,
while `sync` is sufficient to wait for a peer.

Closes #2784
2019-08-22 05:14:58 -06:00
Matthew Flatt
264ec72790 cache bytes converter used for locale conversions
On platforms other than Windows and MacOS, locale encoding (inclduing
path <-> string conversion) opened a converter for each separate
operation. That can be slow on some OSes, so cache converters used for
locale conversions.

Relevant to #2781
2019-08-16 12:10:28 +02:00
Matthew Flatt
ee9de07744 docs: improve contracts on some syntax-object operations
Use `any/c` instead of `any` for some functions.

Closes #2790
2019-08-16 07:29:50 +02:00
Matthew Flatt
9ba8c7658c move vector-empty? docs to the right section 2019-08-15 13:16:25 +02:00
Matthew Flatt
001abc5b55 ffi/unsafe/alloc: allow #f as an "allocator"
Allowing #f as an allocator avoids problems composing `allocator` with
foreign-function lookup where failure is anticipated and implemented
as #f. For example, `g_settings_new` in the "gui-lib" package's
"mred/private/wx/gtk/gsettings.rkt" can be #f if the libgio libray is
too old, in which case there won't be an attempt to use
`g_settings_new`.
2019-08-15 09:42:10 +02:00
Robby Findler
19fad3f8d9 add missing @racket[] 2019-08-07 08:59:41 -05:00
Paulo Matos
f73f242965
Add history for vector-empty (#2783)
Should have been part of 68621c3ee1
Related to #2695
2019-08-06 22:46:29 +02:00
Robby Findler
652c0d37c5 typo in docs 2019-08-06 13:22:10 -05:00
Paulo Matos
6c17f38f27
Add make rule for gmp_arch_gcc sources to gc2 Makefile.in (#2782)
This avoid a split build (first build cgc and then 3m based on cgc)
failing on arm/alpha.
2019-08-06 18:14:15 +02:00
Gustavo Massaccesi
044c15ec8f more test for print/pretty-print 2019-08-05 13:09:45 -03:00
Gustavo Massaccesi
ecaff3dc96 cs: fix display and print when print-vector-length is enabled
Don't use print-vector-length in `display`.

Use print-vector-length in `print` for fxvectors and flvectors.
2019-08-05 13:09:45 -03:00
Gustavo Massaccesi
63173a32be fix pretty-write when print-vector-length is enabled
Show "#3(struct:b 1)" instead of "#(struct:b 1 1)", so it behaves like `write`.
2019-08-05 13:09:45 -03:00
Gustavo Massaccesi
964e998d70 fix pretty-print when print-vector-length is enabled
In some cases, (vector x 2 3 3 3) was pretty-printed as "(vector x 2 3)" when
print-vector-length was enabled.

Also print "(fxvector)" instead of "(fxvector )".
2019-08-05 13:01:42 -03:00