Commit Graph

39095 Commits

Author SHA1 Message Date
Matthew Flatt
c50d2753c0 cs, thread & io: finish implementing places
Implement place channels and messages, and change `place-enabled?` to
claim that places are enabled, but `processor-count` still reports 1.

The implementation of place channels has an interesting use of
ephemerons --- that is, a use that isn't just solving a key-in-value
problem. Using epehemerons solves the problem of forgetting a place
channel and any thread blocked on the read end when there are no
producers on the write end. Along similar lines, when only the write
end is retained (i.e., no readers), the channel data is forgotten and
writes become a no-op. The read end holds a "read key" and references
the channel data through an ephemeron keyed by a "write key"; the
write end similarly holds a "write key" and uses an ephemeron keyed by
the "read key". This use of an epehemeron implements a reachability
"and": retain the place-channel data only if the read end *and* the
write end are both reachable. (Minor point: a read end also holds onto
the "write key" anytime the channel already has data.)
2018-09-05 16:02:19 -06:00
Matthew Flatt
aad98e563d avoid a compiler warning 2018-09-04 14:53:22 -06:00
Matthew Flatt
8ff8b36bdf racket/place: remove place-sleep
The `place-sleep` function was undocumented, should not have existed,
and has no uses that I find.
2018-09-04 14:53:22 -06:00
Matthew Flatt
fa3c5abd00 syntax-parametereize: fix set! with rename transformers
Relevant to bootstrapworld/curr#423
2018-09-04 14:53:22 -06:00
Matthew Flatt
62a5086b2a thread, io, & cs: fill in stdio setup for places 2018-09-04 14:53:22 -06:00
Ben Greenman
63f2a0fd39
doc: update contract for 3rd argument to hash-ref! (#2248) 2018-09-04 16:30:11 -04:00
Robby Findler
988e0d441b add another special case to and/c to detect a situation that's really just integer-in 2018-09-03 20:30:07 -05:00
Matthew Flatt
416447e842 thread, io, & cs: place startup, wait, break, & kill
Fill in more of place creation and termination, which exposed
additional places that the thread layer needs place-specific
variables.
2018-09-03 16:47:00 -06:00
Matthew Flatt
35af40d850 cs & thread: move places API to the thread layer
The Rumble layer provides a primitive `fork-place` operation and
`start-place` hook to tie in place initialization from other layers
(especially "io"), but the rest can live in the "thread" layer,
especially to handle place-channel synchronization.
2018-09-03 09:12:52 -06:00
Matthew Flatt
f03d5c0076 raco exe: add ++lang support
When a stand-alone executable created by `raco exe` needs to load
modules that start with a `#lang` line, there have been various
obstacles to adding the right run-time support via `++lib`. The
`++lang` flag addresses those problems and makes it easy to indicate
that enough should be embedded to support loading modules with a
specified language.

There are problems in the way that various handlers interact for the
"lang/reader.rkt" versus `(submod "." reader)` search path that
converts a language name to a reader. To accomodate the search in a
standalone executable (that does not provide access to collections in
general), the module name resolver must refrain from raising an
exception for a non-existent submodule path that refers to a
non-existent collection.
2018-09-02 07:53:47 -06:00
Matthew Flatt
3127bc239b raco exe: fix declare-preserve-for-embedding submodule 2018-09-02 07:25:16 -06:00
Matthew Flatt
8c5eebc513 cs: fix races with places in the Rumble layer 2018-09-02 07:25:16 -06:00
Ben Greenman
8b4a17e33e
typo: fx=,fx<,etc. take 1+ arguments (#2247) 2018-09-01 23:07:05 -04:00
shhyou
ef5467a9d4 Fix dom exercisers in randomly generated function 2018-08-30 13:46:13 -05:00
Matthew Flatt
7faf874000 cs: first cut at support for places
There's no place-channel communication yet --- just enough of a
conversion to thread-load storage to make places possible.

In contrast to traditional Racket, where the expander linklet is
instantiated once per place, the flattened expander linklet is
instantiated only once in RacketCS (because it's inlined into a Chez
Scheme library). The expander therefore needs to keep per-place state
separate, and the same for the thread, io, and regexp laters.

In the expander/thread/io/regexp source, place-local state is put in
an unsafe place-local cell. For traditional Racket, a place-local cell
is just a box. For RacketCS, the thread through expander layers are
compiled in a way that maps each cell to a fixed index in a vector
that is stored in a virtual register, so the value is roughly two
pointer indirections away (thread context -> virtual register array ->
place-local vector). Multiple Chez Scheme threads in a place, such as
threads to run futures, share the same place-local vector.

Although `place-enabled?` reports #f, `dynamic-place` from `'#%place`
can create a place as a Chez Scheme thread and load a module there.
2018-08-29 09:52:29 -06:00
shhyou
1ad4d82691 Have arg-dep-ctcs return the contract directly 2018-08-28 15:42:31 -05:00
Matthew Flatt
37c9169874 expander: fix body scope for letrec-syntax
An extra scope is needed to separate the bindings of a `letrec` from
the `letrec` body, in case a macro moves right-hand-side expressions
to the body.

Michael Ballantyne and William Hatch reported this problem and its
solution in December 2016, but I forgot to add the repair.

Relevant to #2237
2018-08-28 14:08:36 -06:00
Matthew Flatt
1d65a89f53 cs: faster continuation-mark-set-first
Avoid allocating mark-chain elements, and change search function so
that it's more recognizable as a loop.
2018-08-28 14:08:36 -06:00
bruno cuconato
f9e6a8b61b add stream-take + docs (#2181) 2018-08-27 23:19:18 -04:00
shhyou
3825a133ad Recognize cons? and empty? in contract coercion 2018-08-27 15:12:28 -05:00
Matthew Flatt
f5eb600dd7 unbreak cify build 2018-08-25 08:05:34 -06:00
Matthew Flatt
247fc89f15 make doc search context work on Edge
This patch is by Ben Lerner.
2018-08-25 06:58:15 -06:00
Matthew Flatt
f95723e70e cs: speed up calls to applicable structs 2018-08-25 06:58:15 -06:00
Matthew Flatt
aa75a2fd32 io, read: use fixnum operators 2018-08-25 06:58:15 -06:00
Matthew Flatt
d0eb8f6c53 add unsafe-char=?, etc. 2018-08-25 06:58:14 -06:00
Matthew Flatt
d54c60ae3a cs: enable fxvector field representation 2018-08-25 06:58:14 -06:00
Robby Findler
a1b9fd0965 generalize any/c's random generator to generate some of the built-in structured values 2018-08-24 15:55:39 -05:00
Robby Findler
176f09a7ad add generator for symbols 2018-08-24 15:46:11 -05:00
Robby Findler
47ad1552d5 revert part of 6c676cf48 because make-custom-hash is actually
the only way to do certain jobs
2018-08-23 08:53:35 -05:00
Matthew Flatt
1d3e3d5a08 bytecode compiler: fix set! repair
Fix problem with generated viable in 53a08c065e.
2018-08-22 09:43:22 -06:00
Matthew Flatt
53a08c065e bytecode compiler: fix order of set! undefined checking
Evaluate the right-hand side of the assignment first.
2018-08-22 07:53:07 -06:00
Matthew Flatt
974988fe3c bytecode compiler: don't discard another set! that should error
The repair in 7176fc4253 did not make the no-discard decision stick
well enough for some cases. Robby found this bug using the Redex model
and random testing, too.
2018-08-21 20:50:58 -06:00
Matthew Flatt
16e496b0c5 expander: avoid parameters for dynamic-extent indicators
Using a parameter for the current expansion context means that if a
macro spawns a thread, the thread thinks that it's in an expansion
context. Switching to a raw continuation mark avoids that problem.

Along the way, bring Racket and RacketCS more in line by making both
have an internal notion of "root" prompt tag that can be used to get
all continuation marks independent of any prompts. That's not structly
necessary, since a continuation mark could be combined with a distinct
tag to make the mark always accessible, but it's simpler and more
lightweight to use a root prompt tag.
2018-08-21 19:37:18 -06:00
Matthew Flatt
eed18fac93 schemify: improve use-before-definition analysis
This improvement removes only a few places where a variable use is
considered possibly too early in the RacketCS implementation, but
the improvement is significant for uses of `input-port?` in "io".
2018-08-21 15:46:22 -06:00
Matthew Flatt
473ec2762e io: streamline read-char and read-byte 2018-08-21 15:46:22 -06:00
Alexis King
2a667dc9a8 Fix reader error message when encountering illegal graph notation
Also, document explicitly that graph notation is not allowed at all in
read-syntax mode.
2018-08-21 15:02:09 -05:00
Matthew Flatt
34231aca7e cs: repairs for chaperoned events
The recent `sync` shortcut was wrong for chaperoned events.
2018-08-20 18:08:11 -06:00
Matthew Flatt
ae7a64b4ea cs: fix weak hash table weakness after iteration 2018-08-20 18:08:11 -06:00
Matthew Butterick
70f7cf99ae match examples: #:when and => 2018-08-20 11:14:59 -07:00
Matthew Flatt
2d09e121c5 cs: fix dependency in makefile 2018-08-19 20:41:25 -06:00
Matthew Flatt
7176fc4253 bytecode compiler: don't discard set! that should error
Robby found this bug using the Redex model and random testing.
2018-08-19 17:17:31 -06:00
Matthew Flatt
4128189499 generalize some function arities
Allow a single argument to comparison functions like `<`, and
support the same arities as the generic version for fixnum and
flonum operations like `fx+` or `fl+`.
2018-08-19 16:56:50 -06:00
Matthew Flatt
008102decc cs (mostly): fix hash table problems
RacketCS weak `equal?`-based hash tables didn't retain flonums, and
hashing of hash tables was not properly insensitive to the order of
keys.

Racket, meanwhile, didn't limit work consistently for different kinds
of hash tables, and it didn't keep a counter value odd as intended
(but the counter never gets large enough to appear to be a mapped
pointer, anyway).
2018-08-19 05:36:26 -06:00
Matthew Flatt
27693843ea fix break checking on continuation applciation
Racket did not check for a break when escaping from a break-disabled
context to a break-enabled context. RacketCS didn't check in other
cases, either. Fix those various cases.
2018-08-18 17:07:38 -06:00
Matthew Flatt
40b5fffb80 cs: avoid unnecessary work in exception handler 2018-08-18 17:07:37 -06:00
Matthew Flatt
ae4b101ec5 cs: add sync shortcuts for simple cases 2018-08-18 17:07:37 -06:00
Matthew Flatt
e15eadd106 unbreak unixstyle-install
Commit 1afcbee381 effctively dropped a conditional case that was
marked as "shouldn't happen" --- but it does happen and makes sense.
Adjust the replacement `delete-directory/files` call to accomodate the
case.

Relevant to #2198 and #2236
2018-08-18 11:22:48 -06:00
Matthew Flatt
a01feffa83 expander: improve error reporting for definitions without expression
Closes #2183
2018-08-18 11:22:48 -06:00
Ben Greenman
369eb65ec2 doc: make 'deftech' for match failure procedure 2018-08-17 16:03:58 -04:00
Matthew Flatt
dde342a198 compiler: fix a copy-propagation bug in the letrec checker
The bug could cause reachable code to be replaced with `(void)`.

Closes #2232
2018-08-17 09:54:42 -06:00