Commit Graph

42440 Commits

Author SHA1 Message Date
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
502b0b5f50 repair for locked-object handling and multiply-locked values
Weak pairs, ephemeron pairs, some symbols, and some ports were handled
incorerctly when locked multiple times.

original commit: 847fc1c84496f67cd363c8411d0023339f4d6246
2019-09-01 08:57:14 -06:00
Matthew Flatt
2f4d59de0f remove unused binding
original commit: a4732d58666d80e78af5e1cde4c796d3eeae20e7
2019-09-01 07:13:23 -06:00
Matthew Flatt
c195288251 scalable object locking
The `unlock-object` operation was O(N) with N currently locked objects
--- so, O(N^2) to lock N objects and then unlock them --- because
locked objects were stored in and searched in a global list. Also, GC
was O(N) at any generation with N locked objects across generations,
since every locked object was scanned.

Fix these poblems so that locking and unlocking is practically O(1)
and GC is not poportional to locked objects. More precisely, locking
and unlocking is now O(C) for locking an individual object C times to
be balanced by C unlocks. (Since multiple locks on a single object
is rare, this performance seems good enough.)

The implementation replaces the global list with segment-specific
lists. Backpointers are managed using the general generational
support, so that unmodified, old-generation locked objects do not
need to be swept duing a new-generation collection.

original commit: a57d256ca73a3d507792c471facb7e35afbe88b3
2019-09-01 07:03:16 -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
Bob Burger
fd172d93b3 use case-insensitive search for ".exe" in Windows
original commit: 20f86fea125ecf41b2246ad3ba9e9bb3f8a79c04
2019-08-22 10:10:06 -04: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
Bob Burger
9a9cf2a1e5 fixed tab character in makefiles
original commit: f1e91e76cd8e448aee26f3172cefae8ef14ea6e6
2019-08-15 10:19:58 -04: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
Andy Keep
0ccbd84870 Merge pull request #453 from juanfra684/fix-typos
Fix typos
original commit: bf018c856152bb8e58735286168545056fc62af6
2019-08-11 20:17:50 -04:00
Juan Francisco Cantero Hurtado
121be1049f Fix typos
original commit: 468adc892df9d4a0b4c8f282e11a608636a87049
2019-08-10 18:34:21 +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
Matthias Felleisen
89e1ba55a5 fix contract in docs, fixes #2780 2019-08-04 10:36:04 -04:00
Chuan Wei Foo
68621c3ee1 Add vector-empty? (#2695)
* Add vector-empty?

* Add tests for vector-empty?
2019-08-03 15:51:33 +02:00
Paulo Matos
f6b14a7bc1
Add -D to pkg install as an alternative to --no-docs (#2777)
raco setup already provides --no-docs and -D so we should too.
Followup to #2776
2019-08-03 15:49:31 +02:00
Paulo Matos
fc76f59457
Add --no-docs command line to raco pkg install (#2776)
This simply passes the same flag to setup, which already knows how to
run setup without rendering the documentation.
2019-08-01 21:12:10 +02:00