Commit Graph

5118 Commits

Author SHA1 Message Date
Matthew Flatt
a3dfc1478a number-parsing repair for no-extflonum builds 2019-02-24 08:21:49 -07:00
Matthew Flatt
47a37f6bbe repair for number parsing
Fix a problem recognizing the range of characters for bases larger
than 10.
2019-02-23 21:09:16 -07:00
Matthew Flatt
0549bfb1e5 rewrite number parser
Inspired by the way the Chez Scheme number parser works, change the
one in the expander to be faster and probably clearer. This improved
performance brings number parsing almost back in line with the v6.12
parser's performance.

The revised parser is faster because it goes through an input string
just once. The new parser is also more xcomplete; it doesn't rely on a
host-system `number->string` (except for dummy extflonums when
extflonums are not supported).

If you're reading the commit history, beware that the note on commit
be19996953 is incorrect about the change to parsing divide-by-zero
errors. (It explains a change that was edited away before merging.)
This commit really does change the bahvior, though, again as a better
match for v6.12. Specifically, "/0" (with no hashes) always triggers
divide-by-zero in an otherwise well-formed number, even if `#i` is
used.
2019-02-23 17:25:54 -07:00
Matthew Flatt
be828b184c json: speed up JSON parser
Speed up JSON parsing (usually around x4 to x8) by avoiding regexp
matching and using more direct byte and character operations. Along
similar lines, compute parsed numbers directly instead of converting
to a string and then using `string->number`.

The revised reader behaves differently only in the case of a bad input
stream, where it may consume more bytes from the stream than the old
one due to eagerly reading bytes instead of tentatively matching
peeked bytes. Also, a UTF-8 decoding error is just `exn:fail` like
other input-parsing errors, and not `exn:fail:contract`.
2019-02-22 19:22:53 -07:00
Matthew Flatt
4d43c9884c io: fix file-buffer performance when driven by peeks 2019-02-22 18:47:08 -07:00
Matthew Flatt
75c8c3ce37 fix bytes-utf-8-ref to accept 5 arguments as documented 2019-02-22 18:46:36 -07:00
Matthew Flatt
c4a23595b9 json: faster parsing
Replace some regexœp operations with more direct `peek-char` and
read-char` operations.
2019-02-22 13:06:49 -07:00
Jesse Alama
1eafd1518e Offer 7.2 in .travis.yml
Bring the boilerplate .travis.yml up-to-date.
2019-02-22 11:34:39 -07:00
Paulo Matos
7a6536ab6d Remove unnecessary exit(0);
This was necessary to avoid warnings in a specific compiler but after
adding MZ_DECLARE_NORETURN, this is now unnecessary.
2019-02-22 08:52:09 -07:00
Paulo Matos
ef8b31b527 Use noreturn attribute only when MZ_DECLARE_NORETURN 2019-02-22 08:52:09 -07:00
Paulo Matos
5b837b895f Put all declarations with NORETURN in a single line
If declarations are not in a single line makex.rkt gets confused and
mis-parses the declarations.
2019-02-22 08:52:09 -07:00
Paulo Matos
0659e51b3f Mark other error functions as NORETURN
Related to PR #2472, marks a few other functions as NORETURN.
Namely:
	- scheme_signal_error
	- scheme_wrong_count
	- scheme_wrong_count_m
	- scheme_case_lambda_wrong_count
	- scheme_wrong_type
	- scheme_wrong_contract
	- scheme_wrong_field_type
	- scheme_wrong_field_contract
	- scheme_arg_mismatch
	- scheme_contract_error
	- scheme_wrong_return_arity
	- scheme_unbound_global

Unfortunately static analysis is done per compilation unit, so
although, for example, scheme_wrong_contract calls scheme_raise_exn
and the latter is already marked NORETURN, the analyzer does not know
this. Therefore we need to manually propagate the NORETURN for each
function declaration.
2019-02-22 08:52:09 -07:00
Matthew Flatt
b7654d9a84 cs: avoid uninitialized bytevectors via ffi/unsafe
Zeroing out allocated memory is required by the specification of
`alloc` from `ffi/unsafe`.

Possibly relevant to #2493
2019-02-21 08:39:06 -07:00
Matthew Flatt
858a925c16 remove another dead assignment to buf, which also causes leak
These leaks happen just once in startup code, so they
didn't matter in practice --- but, obviously, its better to
fix them.
2019-02-20 16:35:27 -07:00
Matthew Flatt
a119804827 remove unused call to GC_set
Closes #2339
2019-02-20 16:35:27 -07:00
Matthew Flatt
6a94ce5c04 fix error-message typo 2019-02-20 16:35:27 -07:00
Paulo Matos
6fa0e4fc64 Avoid dead initialization of boot_offset
Assuming here that ELF_FIND_BOOT_SECTION and WIN32 are mutually exclusive.
2019-02-20 16:35:19 -07:00
Philip McGrath
fe563735be ffi/unsafe/alloc: handle keyword arguments
closes https://github.com/racket/racket/issues/2484
2019-02-20 16:29:28 -07:00
Paulo Matos
be054f6149 free buf to avoid memory leak 2019-02-20 16:27:58 -07:00
Paulo Matos
490105ed53 Remove dead store for rator 2019-02-20 16:25:38 -07:00
Paulo Matos
10d721eaea Remove dead store for did_alt 2019-02-20 16:24:45 -07:00
Paulo Matos
7e856b3b4d Remove dead assignment to buf which also causes leak 2019-02-20 16:23:30 -07:00
Paulo Matos
671611e992 Remove dead store for closure_size 2019-02-20 16:22:24 -07:00
Ryan Culpepper
d185257a75
add unsafe-poll-fd, unsafe-fd->evt (#2414)
The unsafe-fd->evt interface is based on unsafe-{file-descriptor,socket}->semaphore. 
The main differences are that these events are level-triggered, not edge-triggered, and 
they do not cooperate with ports created by unsafe-{file-descriptor,socket}->port.
2019-02-20 13:53:11 +01:00
Paulo Matos
166c97ecea
Fix missing parens
There's a paren mismatch introduced by a previous commit
2019-02-19 11:22:54 +01:00
Gustavo Massaccesi
5c1b1bf8cf fix with-syntax* when it has no patterns
This also fix define-inline for 0-arity functions.
2019-02-18 20:07:45 -03:00
Gustavo Massaccesi
3c4f160346 make file-stream-port? and terminal-port? total 2019-02-18 20:07:19 -03:00
Matthew Flatt
66f7e0c3e3 cs: fix slowness in set!, vector, and box operations 2019-02-18 11:59:28 -07:00
Matthew Flatt
f14d7e06bb Make noreturn attribute valid only for GNUC implementations
.. with an `exit` call to make the declaration clearly true to the
compiler.
2019-02-17 07:14:34 -07:00
Matthew Flatt
6117d8aff4 Revert "Make noreturn attribute valid only for GNUC implementations"
This reverts commit d033dd1ed2.
2019-02-17 07:09:48 -07:00
Paulo Matos
0124210b0b Avoid conn memory leak if try_connect fails (#2481) 2019-02-17 07:04:32 -07:00
Paulo Matos
41b282d3ae Merge pull request #2480 from LinkiTools/pmatos-clanganal-9
Avoid memcpy from null pointer in do_inotify_add
2019-02-17 07:04:06 -07:00
Paulo Matos
d033dd1ed2 Make noreturn attribute valid only for GNUC implementations 2019-02-17 07:03:46 -07:00
Paulo Matos
3e301d22b5 Mark scheme_raise_exn as noreturn - regenerate schemex
scheme_raise_exn raises an exception and doesn't return.
Static analysis tools find a huge amount of problems with regards
to memory leaks that are actually false positives because the tools
are not aware the function does not return. Marking it as such aids
further inspection of real problems.
2019-02-17 07:03:46 -07:00
Matthew Flatt
0567527be4 io: fix unsafe-poller
When asking a poller to register wakup events, handle an
"event is ready" response by canceling the sleep.

Closes #2482
2019-02-16 19:35:01 -07:00
Ryan Culpepper
edeae791ab syntax/parse: fix #:attr-name-separator, used by honu macros 2019-02-15 12:25:10 +01:00
Matthew Flatt
30e260835f fix \D, \S, \W in string regexp
The documentation and implementation were confused about whether \D,
\S, and \W match non-ASCII characters. Now they do. The new regexp
implementation (as used in Racket CS) already matched them.
2019-02-14 11:50:58 -07:00
Paulo Matos
f4c48dd9b5 Assigned value at initialization is never read
Assigning variable instead to NULL.
2019-02-14 08:11:50 -08:00
Paulo Matos
5ea27fc972 Remove unused variable did
Used to be useful but now it's no longer the case.
2019-02-14 08:10:24 -08:00
Paulo Matos
1722e49c85 Remove dead code
I understand what the idea is in this file, except this code won't
work like the author expected it to. Variables marked for wiping won't
be wiped unless they are marked as volatile. The compiler will simply
remove the code wiping the variables and issue a warning, which is
what brought me to look into this code in the first place.
2019-02-14 08:09:26 -08:00
Paulo Matos
136ea767e2 Free memory stored when error occurs - otherwise buffer leaks 2019-02-14 08:08:27 -08:00
Paulo Matos
14499aa822 Free buffer in case of unknown error - avoids memory leak 2019-02-14 08:07:49 -08:00
Paulo Matos
4014b066d1 Remove assignment - value stored to cpos is never read 2019-02-14 08:06:39 -08:00
Paulo Matos
04e6422c72 Ensure copied is not overwritten by another strdup causing a leak 2019-02-14 08:04:38 -08:00
Matthew Flatt
e7e9d02c9e native-libs: patches to adjust Pango font-face matching 2019-02-14 08:57:51 -07:00
Matthew Flatt
ecf3766d96 io: reduce overhead on display and write-bytes 2019-02-13 16:18:22 -07:00
Matthew Flatt
17c46c9c36 io: fix file and TCP ports as place messages 2019-02-13 10:48:55 -07:00
Matthew Flatt
a4bd83011b io: fix result of file-stream-port? 2019-02-13 10:41:12 -07:00
Matthew Flatt
5339a36187 io: fix file-stream-buffer-mode on file output ports 2019-02-13 10:20:04 -07:00
Matthew Flatt
c2d53143c1 io: improve syntax of internal class forms 2019-02-13 10:08:58 -07:00
Matthew Flatt
d197e1b8f4 io: adjust read-[bytes-]line to use direct buffer 2019-02-13 10:08:58 -07:00
Matthew Flatt
e266da929d io: fix pipe slow path and GC
Make the slow path faster by reducing input- and output-end
coordination. Also, avoid retaining one end just because the other end
is retained.

This change involves adding an indirection for the fast-path buffers
so that management for both ends of a pipe can be centralized
independent of the ports.
2019-02-13 10:08:58 -07:00
Matthew Flatt
f0aa8573fe io: repair some buffer + counting interactions 2019-02-13 10:08:58 -07:00
Matthew Flatt
6fb4097fef io: make fd-output-port use the fast path 2019-02-13 10:08:58 -07:00
Matthew Flatt
45347465df io: add output fast path
Add a fast path for output that is like input, based on a exposed
buffer. Make bytes-output-port and pipe use it.
2019-02-13 10:08:58 -07:00
Matthew Flatt
d6af78cebd io: convert tcp-{input,output}-port to object style 2019-02-13 10:08:58 -07:00
Matthew Flatt
01d53378b2 io: partial streamline of fd ports
Further improvements to move away from the `data` field.
2019-02-13 10:08:58 -07:00
Matthew Flatt
a382c6ca72 io: clean up unneeded scaffolding
Everything is converted, so we don't need the scaffolding anymore.
2019-02-13 10:08:58 -07:00
Matthew Flatt
40f27f8153 io: convert make-output-port to object style 2019-02-13 10:08:58 -07:00
Matthew Flatt
c57b52eb70 io: convert make-input-port to object style
Sortof. This is where we especially take advantage of vtable
flexibility. The methods of the vtable are really closures,
because that's far more convenient for custom ports.
2019-02-13 10:08:58 -07:00
Matthew Flatt
6e85165b3c io: convert fd-output-port to object style 2019-02-13 10:08:58 -07:00
Matthew Flatt
c28a0f45dc io: (mostly) keep fast path when line counting is enabled 2019-02-13 10:08:58 -07:00
Matthew Flatt
e3b00715bc io: convert fd-input-port to object style 2019-02-13 10:08:58 -07:00
Matthew Flatt
95083d6add io: add peek-via-read layer as prep for fd and custom ports 2019-02-13 10:08:58 -07:00
Matthew Flatt
35ceb8e3b3 io: convert pipe to object style 2019-02-13 10:08:58 -07:00
Matthew Flatt
78136c0613 io: convert bytes-output-port to object style 2019-02-13 10:08:57 -07:00
Matthew Flatt
d8521e8486 io: start conversion to classes
Change the internal port representation to an object-with-vtable
representation. The syntax looks similar to the class system of
`racket/class`, but everything is first-order: no class values, no
mixins, etc. Also, the vtable can contain non-procedures (like #f for
"not supported" or a port to mean a direcirection).

Using objects will make port instaces smaller and support a
reorganization to eliminate ad hoc `data`-field extensions. It will
also replace a half-step was was in place for byte input

Along with the conversion, change the way the fast path for writing
works: When possible, expose a shared buffer and index into that
buffer.

Only byte string input ports are really converted, so far. A
compatibility layer maps the old protocol to the new one, so
conversion can continue piecewise.
2019-02-13 10:08:57 -07:00
Matthew Flatt
e60b24c1a9 io: fix (find-system-file 'pref-file)
Corrects a mistake in 5c775fa04c.
2019-02-09 10:48:25 -07:00
Matthew Flatt
44368147f2 cs: small shortcut for mark lookup 2019-02-09 10:48:25 -07:00
Matthew Flatt
3c030b143b expander: extend "illegal use of syntax" error
Show the compile-time value that is not a procedure. While
this runs some risk of exposing details that are meant
to be private to a macro/language, a macro/language can
use an applicable structure to provide a more specific
error message. Meanwhile, showing the value is likely to
help for someone who needs to debug a macro problem.
2019-02-09 10:48:25 -07:00
Robby Findler
4ed5d7d98b added struct-guard/c 2019-02-09 09:18:58 -06:00
Matthew Flatt
5c775fa04c io: find-system-path and directory results
Use `path->directory-path` to ensure consistent trailing slashes.

Closes #2461
2019-02-07 09:12:12 -08:00
Matthew Flatt
2754d4e5a0 cs: avoid cont-mark conversion on capture
A conversion from assoc list to hash table is a leftover of a previous
stretegy, and it does not seem useful anymore.
2019-02-05 08:48:08 -08:00
Matthew Flatt
2abe2a48b4 bump version to sync cs changes 2019-02-05 08:23:37 -08:00
Matthew Flatt
e1cc9b2a80 cs: speed up sync on combination with never-evt 2019-02-04 06:42:33 -08:00
Matthew Flatt
61ca9ef474 cs: speed up break-enabled slightly 2019-02-04 06:23:15 -08:00
Matthew Flatt
b1bdcacabc io: slightly faster read-line 2019-02-03 15:28:18 -08:00
Matthew Flatt
af24a0318f io: faster read-char 2019-02-03 14:46:02 -08:00
Matthew Flatt
9823cbba4d io: reduce overhead on read-byte and read-char 2019-02-03 13:52:20 -07:00
Matthew Flatt
5ffb96e62d cs: reduce the cost of entering & exiting atomic mode 2019-02-03 10:33:15 -07:00
Matthew Flatt
80f84f2132 fix extflvector-length for platforms where it's not inlined 2019-02-02 19:38:41 -07:00
Matthew Flatt
db760fe748 makefile: avoid stderr more for Chez Scheme build 2019-02-02 13:13:22 -07:00
Matthew Flatt
acb2cfc465 git-checkout: doc repairs 2019-02-02 13:00:32 -07:00
Matthew Flatt
608005ac06 git-checkout: faster discovery of commit in common case
When the desired reference is not an advertised commit, then try
pulling just a few commits --- at depth 8, 16, and 32 -- from the
"master" branch to check whether the commit can be found that way. If
not, fall back to the exhaustive search that requires a full download.

This should help with the common case that a package reference into
the Racket repo is a few commits behind the current master branch
(because the package server hasn't scanned the repo recently enough).
It's much faster to disover that the commit is within the first 32,
which is almost always is, than to download the entire repository.
2019-02-02 11:13:10 -07:00
Matthew Flatt
7ea98c671c makefile: fix reconfigure for -MCR mode 2019-02-02 10:22:21 -07:00
Matthew Flatt
1affe4e7ad unbreak clean Mac OS build 2019-02-02 08:20:39 -07:00
Matthew Flatt
1b11111da3 raco pkg migrate: don't promote auto-installed
Upgrading an auto install to an explicit install runs into trouble if
the auto install is in a wider scope. It doens't seem necessary to
promote already-installed packages for migration, anyway.
2019-02-01 09:42:55 -07:00
Matthew Flatt
afd8c8fcac bump version for change to racketcs internals 2019-02-01 05:24:50 -07:00
Matthew Flatt
85edde8132 cs: use source names in errors about defined identifiers 2019-01-31 15:04:27 -07:00
Matthew Flatt
8b4075bd3d cs: reject certain srclocs in marshaled form 2019-01-31 15:04:27 -07:00
Matthew Flatt
cf72bace95 cs: fix printing of some symbols
Commit bd6cf17f92 wasn't the right repair.
2019-01-31 15:04:27 -07:00
Matthew Flatt
63fb08905b makefile: adjust in-place CGC/3m install to preserve CS install
Also, make an in-place CS install clean old versions in the same way
as a CGC/3m.
2019-01-31 15:04:27 -07:00
Ryan Culpepper
5ada142ee9 wrap-expr/c: improve performance, add #:arg?, fix pos/neg args
- Improve performance by using make-apply-contract, lifting,
  fast path for dependent flat contracts.
- The positive blame party now consistently means the *macro def*
  and the negative party means the *macro use*. The #:arg? argument
  controls blame swapping.
2019-01-31 15:38:39 +01:00
Ryan Culpepper
5f77da9f5d split out and provide make-apply-contract 2019-01-31 15:38:39 +01:00
Matthew Flatt
ccfa41e22c pkg: add missing flush to some status printouts 2019-01-30 16:40:19 -07:00
Matthew Flatt
4e39054b91 ffi/unsafe/objc: fix expand-time check of (system-type 'vm)
Don't make expansion depend on `(system-type 'vm)`, because expansions
should be VM-inpendent. For example, distribution builds use a single
expansion and finish up from there for different Racket
implementations.
2019-01-30 16:18:06 -07:00
Matthew Flatt
b9a28b368f expander: fix ".zo" mismatch errors to be exn:fail:read 2019-01-29 19:35:04 -07:00
Matthew Flatt
ed301f8a7c cs: skip check for module as an extension
The "extension" module protocol predates the modern FFI and depends on
the C API. Since it's not supported on Racket CS, skip the check for
extension modules.

Skipping the check can reduce load time considerably. We should
consider depracting the extension protocol for traditional Racket.
2019-01-29 19:34:49 -07:00
Matthew Flatt
33d7840a93 cs: fill in missing command-line flags 2019-01-29 14:59:14 -07:00
Matthew Flatt
c628414d6c avoid stderr output for cs build 2019-01-29 09:18:07 -07:00
Matthew Flatt
1cbc331532 unbreak no-places, no-futures build 2019-01-28 07:03:37 -07:00
Matthew Flatt
737ee9eba5 expander: fix flattener in machine-independent mode 2019-01-26 16:42:10 -07:00
Matthew Flatt
c9e3788d42 make effect of JIT_EAGER_JIT more complete 2019-01-25 19:20:03 -07:00
Matthew Flatt
13cb9bfc06 show peak code bytes in GC logging output 2019-01-25 15:39:36 -07:00
Matthew Flatt
bd6cf17f92 cs: fix printing of symbols that start #% 2019-01-25 14:39:58 -07:00
Matthew Flatt
a4821716d9 cs: wrap command-line eval in #%top-interaction 2019-01-25 14:39:40 -07:00
Matthew Flatt
f8448c4795 raco exe: disable --embed-dlls on RacketCS, for now
The RacketCS DLL currently doesn't work as embedded.
2019-01-25 12:42:17 -07:00
Matthew Flatt
7bc0364ec7 raco exe: fix --collects-dest for non-default "compiled" 2019-01-25 12:36:55 -07:00
Matthew Flatt
a80952e05f fix struct->vector on some renamed procedures
The repair is to give the structure type a name symbol. The rest is
cleanup and tests.

Closes #2454
2019-01-25 12:04:43 -07:00
Matthew Flatt
a97b3739a3 cs: add conversion to exn:fail:contract:non-fixnum-result 2019-01-24 19:44:04 -07:00
Matthew Flatt
77e362b27c io: fix 'update mode to not create a file 2019-01-24 19:30:29 -07:00
Matthew Flatt
74387d683b update racket/HISTORY.txt for 7.2
Please merge to v7.2
2019-01-24 08:26:58 -07:00
Matthew Flatt
0ae5ff7c1e fix typo in previous commit 2019-01-23 19:56:57 -07:00
Matthew Flatt
917a8f3aeb cs: fix GRacket-startup process-global registrations
This repair avoids an extra bounce and confused menu bar for DrRacket
startup, for example.
2019-01-23 19:51:09 -07:00
Matthew Flatt
8e5e5b9467 cs: improve procedure-result-arity 2019-01-22 17:34:49 -07:00
Matthew Flatt
3b99688275 regexp: repair extracting positions from string match 2019-01-22 10:32:36 -07:00
Matthew Flatt
82d8184ca9 cs: initial cut at procedure-result-arity 2019-01-22 10:32:36 -07:00
Matthew Flatt
602b797443 cs: eq? on flonums
Take advantage of a Chez Scheme patch that makes `eq?` work on
flonums.
2019-01-22 10:32:36 -07:00
Matthew Flatt
7bcf6afb62 cs: fix error message for vector* and box* operations 2019-01-22 10:32:36 -07:00
Matthew Flatt
1d7080fbb0 schemify: cover all too-early variable uses
Don't defer any too-early variable checks to Chez Scheme, because the
schmeify-inserted checks use the right names and include a reference
to the enclosing module.
2019-01-22 10:32:36 -07:00
Matthew Flatt
c47cbbf6c5 cs: add missing prompt-tag checks in mark lookup 2019-01-22 10:32:36 -07:00
Matthew Flatt
aed8d4f3e5 cs: left associativity for +, *, and variants 2019-01-22 10:32:36 -07:00
Matthew Flatt
fdb98da0b1 cs: repair primitives incorrectly exported in unsafe form 2019-01-22 10:32:36 -07:00
Matthew Flatt
299d80e830 cs: rewrite some error messages from Chez Scheme
At least interpose on the value->string part of constructing an
error message and use the Racket-level error-value->string handler.
2019-01-22 10:32:36 -07:00
Ryan Culpepper
218ed485e1 fix {DYLD,LD}_LIBRARY_PATH for starter with embedded dll-dir
closes #2450
2019-01-21 15:01:24 +01:00
Matthew Flatt
725af574fd io: fix some error corners of encoding conversion 2019-01-20 16:38:45 -07:00
Matthew Flatt
25a4f67912 fix char-numeric?
The `char-numeric?` function was missing some Unicode characters that
have the numeric property, because it was calculated from the wrong
field of UnicodeData.txt.
2019-01-20 15:04:42 -07:00
Matthew Flatt
53d4cdd2c7 cs: unbreal seconds->date 2019-01-20 09:33:05 -07:00
Matthew Flatt
dee990ff18 cs: implement phantom bytes
Mostly just connect to the implementation as a Chez Scheme addition.
2019-01-20 09:04:26 -07:00
Matthew Flatt
dc047d8922 cs & thread: enforce custodian limit on immediate allocations
For large vector, string, and byte string allocations, check
for limits on the current custodian.
2019-01-19 17:24:05 -07:00
Matthew Flatt
e93088dd2c cs: reject overlarge _array type
x
2019-01-19 15:07:43 -07:00
Matthew Flatt
c55c922e44 cs: fix callbacks from arbitrary threads
The "wakeup" function needs to be retained from the place
that will run the callback.
2019-01-19 15:03:03 -07:00
Matthew Flatt
dc58fccc4c cs: immutable string in seconds->date result 2019-01-19 13:54:24 -07:00
Matthew Flatt
bf2fac74f2 io: use PWD to initialize current-directory 2019-01-19 13:54:24 -07:00
Matthew Flatt
24121798bd io: more repairs to subprocess
Fix backwards tratment of `force?` in `subprocess-kill`, and
check for subprocess as valid supplied group.
2019-01-19 13:54:24 -07:00
Matthew Flatt
b4cc2d849c regexp: repair match results on large string 2019-01-19 13:54:24 -07:00
Matthew Flatt
74b34c210d io: fix decoding in get-output-bytes 2019-01-19 13:54:24 -07:00
Matthew Flatt
09b3b2fb3c io: fix file-stream? to always return a boolean 2019-01-19 13:54:24 -07:00
Matthew Flatt
cd56b670ca io: fix subprocess group creation 2019-01-19 13:54:24 -07:00
Matthew Flatt
21712fecc9 cs: print results of -e command-line expressions
Also, wrap an individual prompt around each evaluation.
2019-01-19 13:54:24 -07:00
Matthew Flatt
2fe2b7a8a7 cs: fix thread initial prompt and parameterization
The initial parameterization needs to be inside the initial prompt,
not outside.
2019-01-19 13:54:24 -07:00
Matthew Flatt
a2b1fbea3f io: speed up read-line a little 2019-01-19 13:54:24 -07:00
Robby Findler
962c7d4397 fix a bug in define/merge-cache
please include on the release branch
2019-01-18 21:08:36 +00:00
Jay McCarthy
7c08ded63b Fixes #2440 2019-01-18 16:20:47 +00:00
Matthew Flatt
422d5579b3 atan: exception on exact 0+1i or 0-1i, exact 0 on positive x
Change from treating exact 0+1i and 0-1i like the corresponding
inexact values.

Also, change from treating `(atan 0 x)` as exact 0 only when x is
exact. That's consistent with `angle` producing exact 0 for a positive
real number.
2019-01-17 20:08:49 -07:00
Matthew Flatt
f27c9330a5 magnitude: return +inf.0 for a complex with [+-]inf.0
... even if the oyther component is +nan.0. This change makes
`magnitude` consistent with the hypot() C-library function.
2019-01-17 19:58:39 -07:00
Matthew Flatt
f5babc4246 cs: more divide-by-zero exception conversions 2019-01-17 19:58:39 -07:00
Matthew Flatt
22b721be8a io: require absolute path for current-load-relative-directory 2019-01-16 21:29:01 -07:00
Matthew Flatt
a044c2ad05 io: conform to print-vector-length and print-struct 2019-01-16 21:15:34 -07:00
Matthew Flatt
11f12d69bd cs: fix hashing on vector cycles 2019-01-16 20:50:41 -07:00
Matthew Flatt
cddcd57267 regexp: fix O(size) behavior for large strings 2019-01-16 20:39:23 -07:00
Matthew Flatt
6c8ba483a1 regexp: fix consumption of bytes from a port 2019-01-16 20:39:19 -07:00
Matthew Flatt
b19671f0f5 regexp: fix matching on port given prefix bytes 2019-01-16 18:23:57 -07:00
Matthew Flatt
be19996953 read and string->number: fix large-exponent cutoff and # in fractions
The cutoff point for large-magnitude exponents (forcing a +inf,0 or
0.0 result) was wrong for bases below 10, and its did not take into
account the mantissa magnitude for some number forms.

Also, change the parsing of numbers with both `/` and `#` to be more
consistent. A `#` anywhere in the number should trigger an inexact
teratment 0 in the denominator (so inifnity or not-a-number instead of
divide-by-zero), even if `#` is only in the numerator. Meanwhile,
setting `read-decimal-as-inexact` to #f should count `#`s as `0`s and
not trigger inexact treatment.
2019-01-16 14:50:02 -07:00
Matthew Flatt
345339990f cs: repair some number-test failures 2019-01-15 20:30:53 -07:00
Matthew Flatt
349207d19f cs: repair procedure name, arity, and error-message support
The "procs.rktl" tests now pass.
2019-01-15 20:30:53 -07:00
Gustavo Massaccesi
c5a74c173e fix typos in error messages 2019-01-15 15:52:48 -03:00
Matthew Flatt
0aa2fdc476 cs: fix Mac OS install to include "Starter.app" 2019-01-14 20:04:44 -07:00
Matthew Flatt
95367b4b52 schmify: add some unsafe conversions
Explicitly substitute unsafe some non-primitives, which won't be
automatically substitued in Chez Scheme by compiling in unsafe mode.
2019-01-14 18:38:46 -07:00
Matthew Flatt
94a4f6d703 io: streamline bytes output port 2019-01-14 18:16:27 -07:00
Matthew Flatt
0e6c441f37 thread: break-suspend as a faster virtual register
Slightly speeds up atomic mode for io.
2019-01-14 18:03:21 -07:00
Matthew Flatt
ad2c0624b5 cs: fix struct proc names from make-struct-type 2019-01-14 14:53:49 -07:00
Matthew Flatt
40bc59d512 schemify: fix handling of #<void> as 'inferred-name
It's not supposed to suppress a srcloc-based name.
2019-01-14 09:07:42 -07:00
Matthew Flatt
8b9525f1c9 io: fix udp-set-receive-buffer-size! error reporting 2019-01-14 08:56:57 -07:00
Spencer Florence
75550e79cc fix finding first argument of make-pipe when more than one argument is provided 2019-01-14 08:45:47 -06:00
Matthew Flatt
2fe5f40dd7 io: fix logger bugs 2019-01-13 21:04:15 -07:00
Matthew Flatt
0602c7e21b cs: fix prop:chaperone-unsafe-undefined-triggered error 2019-01-13 18:13:14 -07:00
Matthew Flatt
4c53d3c380 cs: add missing unsafe-struct*-cas! 2019-01-13 09:42:50 -07:00
Matthew Flatt
f287f21ab2 cs: fix unsafe-[us]16vector-{set,set!} 2019-01-13 09:38:51 -07:00
Matthew Flatt
e9593749eb fix procedure names on syntax-source and related 2019-01-13 09:26:41 -07:00
Matthew Flatt
df93054d18 cs: dsiable srclocs for Rumble in stack trace by default 2019-01-13 08:41:53 -07:00
Matthew Flatt
6b52f9eedb cs: fill in procedure-name and srcloc interaction
Infer procedure names based on source locations, and suppress a
procedure name when it has #<void> for its 'inferred-name property.

Threading this information through the Chez Scheme layer involves a
hack, where a name starting with "[" indicates either "no name" or
"inferred from path".
2019-01-13 08:41:53 -07:00
Matthew Flatt
3b76e44730 cs: path adjustments on write and read of compiled code
Use `current-write-relative-directory`, etc.
2019-01-13 08:41:53 -07:00
Matthew Flatt
56846a9ca2 cs: guard against cyclic quoted constants
But only mutable hash tables and prefabs are relevant, since
no other serializable data has cycles and can get through
`datum->syntax`.
2019-01-12 14:25:58 -07:00
Matthew Flatt
a039248b9f cs: unbreak unsafe-get-place-table 2019-01-11 20:10:43 -07:00
Matthew Flatt
11120977b8 cs: add PLT_LINKLET_SHOW_CP0 2019-01-11 20:09:17 -07:00
dharmatech
0108bf43a9 cs/README.txt - fix typos 2019-01-09 15:31:28 -03:00
Matthew Flatt
7810232b67 no warning for unsupported long-term poll set operations 2019-01-08 18:52:32 -07:00
Matthew Flatt
1888663702 cs: fix unsafe-f64vector-{ref,set!} 2019-01-08 18:52:32 -07:00
Matthew Flatt
77c7b2b147 make-readtable: fix argument checking 2019-01-08 18:52:32 -07:00
Matthew Flatt
9aa0965aaa cs: switch to some system primitives
Replace some hacks with other hacks that are slightly more
respectible.
2019-01-08 18:52:32 -07:00
Matthew Flatt
eb3ba2052e cs: repair prompt around top-level evaluation 2019-01-08 18:52:32 -07:00
Matthew Flatt
8777d89eaf cs: fix exception raised by check-not-unsafe-undefined 2019-01-08 18:52:32 -07:00
Vincent St-Amour
09d25777d6 Post-release version for the v7.2 release 2019-01-07 10:29:01 -06:00
Matthew Flatt
53baa3f8cc src/makefile: adjust cs target to explain configure 2019-01-05 19:16:59 -07:00
Matthew Flatt
edcd1833e7 cs: move build/cs to build/cs/c
Use "cs/c" to be parallel to the source tree, because making them
different is asking for trouble (e.g., using `configure` without
a separate "build" directory goes wrong).
2019-01-05 19:00:32 -07:00
Matthew Flatt
f9c2a9395b remove "2018"s and "PLT Design"s 2019-01-05 16:31:57 -07:00
Matthew Flatt
52358ec42e small adjustments to udp-set-receive-buffer-size!
Minor adjustments to a commenably complete addition.
2019-01-05 16:31:57 -07:00
Greg Hendershott
4cd34ce10d Add udp-set-receive-buffer-size! 2019-01-05 14:56:25 -07:00
Greg Hendershott
ea663550a9 Fix rktio_create_console decl
The rktio/parse.rkt grammar doesn't handle empty argument lists and
was choking on this line, before it even got to my new line adding
rktio_udp_set_receive_buffer.

Fix by following example of using `(void)` instead of `()`. Two notes:

- I forget which variation of C or C++ requires (void) instead of ().

- Strictly speaking, this commit isn't part of the theme of this PR.
  If I squash the other commits down to one, maybe I should leave this
  separate.
2019-01-05 14:56:25 -07:00
Matthew Flatt
e99de2bf79 cs: implement custodian memory limits 2019-01-05 11:02:27 -07:00
Matthew Flatt
bcc9b2264e improve reporting of primitive-count startup error 2019-01-03 10:24:05 -07:00
Matthew Flatt
5a12d7bf71 cs: remove bound-identifier=? from '#%kernel table 2019-01-02 10:41:41 -07:00
Matthew Flatt
9731394e2a cs: ensure that arguments to foreign functions are retained
Make a call to a foreign function behave as in traditional Racket: the
arguments are considered reachable un their unwrapped forms until the
foreign function returns.
2019-01-01 16:30:39 -07:00
Matthew Flatt
709f327e4e io: remove incorrect symbol shortcut for format and "~s"
As exposed by a "print.rktl" test, the shortcut was wrong for symbols
that write with escapes.
2019-01-01 14:33:26 -07:00
Matthew Flatt
f85d18aed6 io: fix printing of '|| 2019-01-01 13:58:48 -07:00
Matthew Flatt
13e2817a2d fix typo in comment and sync "startup.inc" 2019-01-01 13:58:39 -07:00
Matthew Flatt
c60a081115 expander: fix bootstrap to work on RacketCS
The expander relies on an extra primitive when running on RacketCS.
2019-01-01 13:43:04 -07:00
Matthew Flatt
b9e1d23f0d cs: allow unsafe-undefined in variables
Distinguish "not initialized" from "value is unsafe-undefined".
Otherwise, `(dynamic-require 'racket/unsafe/undefined 'unsafe-undefined)`
 fails.
2019-01-01 13:27:05 -07:00
Matthew Flatt
dbabafa147 cs: support second argument to primitive-table
The two-argument mode is needed to support building RacketCs using
RacketCS.
2019-01-01 13:14:07 -07:00
Matthew Flatt
7797d3672b fix 'interior mode for malloc 2019-01-01 11:30:11 -07:00
Matthew Flatt
5cec8d52c2 schemify: fix quoted box in interpret mode 2019-01-01 09:19:18 -07:00
Matthew Flatt
7e83a6038a schemify: fix pessimization of constructor applications
A missing `unwrap` caused references to structure constructors to be
treated as potentially non-primitive procedures, which significantly
slows down calls to the constructor.

Probably, this started going wrong at a point where original names
were more consistently associated to defined identifier.
2018-12-31 14:16:31 -07:00
Matthew Flatt
21bbf1b42e cs: vfasl for Windows and Unix variants 2018-12-31 11:24:35 -07:00
Matthew Flatt
47d42d88cb cs: add -luuid for linking Chez Scheme on Linux 2018-12-31 10:09:24 -07:00
Matthew Flatt
846c40ff6c cs: restore vfasl 2018-12-31 08:16:45 -07:00
shhyou
c21beab167 Add sub-range-binder for define-logger 2018-12-30 18:39:34 -06:00
Matthew Flatt
e7c6efdaa8 cs: disable vfasl for now
Further testing uncovered a problem with vfasl loading.
2018-12-30 16:10:35 -07:00
Matthew Flatt
3c2003d01e cs: fix for fasl-related definition 2018-12-30 14:00:05 -07:00
Matthew Flatt
1052bc8dff unbreak cify build 2018-12-30 06:10:11 -07:00
Matthew Flatt
59246a0107 cs: fix call-with-immediate-continuation-mark and chaperones
Also, repair `call-with-immediate-continuation-mark` in tail
position with respect to a prompt.
2018-12-30 06:00:50 -07:00
Matthew Flatt
e37199cd7a cs: fix letrec
Report source name when accessing a variable too early, and allow
multiple returns (based on continuation capture) for the right-hand
side of a `letrec`.

The repair directly implements `letrec` as needed in terms of `let`
and `set!`, instead of relying on Chez Scheme's `letrec`, unless
right-hand sides are simple enough. Implementing `letrec` that way
risks losing Chez Scheme optimizations, but schemify takes care
of many improvements already.
2018-12-30 05:18:16 -07:00
Matthew Flatt
cea82c1ddc cs: use vfasl for boot files 2018-12-30 05:18:16 -07:00
Matthew Flatt
326e555146 expander: adjust stx serialization for RacketCS
Get more of the benefit of traditional Racket's lazy bytecode
unmarshaling by using an explicit `fasl->s-exp` stap on the serialized
form of syntax objects. This approach also avoids generating pointless
machine code for constructing the serialized form, effectively using
`fasl->s-exp` as an interpreter. The result is significantly smaller
".zo" files for RacketCS and slightly faater load times.
2018-12-30 05:18:16 -07:00
Matthew Flatt
75c30b4e2e cs: faster srcloc unmarshaling 2018-12-30 05:18:16 -07:00
Matthew Flatt
2c1cf20d17 cs: fix build to uncompress boot files
The uncompress step was broken by the switch to use "setup-go.rkt".
2018-12-22 18:35:56 -07:00
Matthew Flatt
86bbdab1de cs: reduce startup code size 2018-12-22 18:35:56 -07:00
Matthew Flatt
2fc594fcc4 cs: make public udp-bound? and udp-connected? safe 2018-12-20 21:31:43 -07:00
Matthew Flatt
d14238ae31 cs: fix udp-receive!
Closes #2433
2018-12-20 21:24:55 -07:00
Matthew Flatt
b38d437a00 file/untar: allow \0s for user and group ids
Some .tar packer (on Windows?) zeros out the user and group fields,
and `file/untar` doesn't use them anyway.
2018-12-19 19:34:39 -07:00
Sam Tobin-Hochstadt
9a42fab7fe Rebuild expander for b1e765ca31. 2018-12-13 16:00:17 -05:00
Sam Tobin-Hochstadt
c77388eeef Include radix in low-level error message. 2018-12-13 16:00:17 -05:00
Sam Tobin-Hochstadt
d2fdfe973e Fix expander demo to go with 19e709d27b. 2018-12-13 16:00:17 -05:00
Dan Feltey
a0fdee59b4
Add support for collapsible contracts (#2367)
* Add support for space-efficient vector and arrow contracts.

When an eleventh contract would be applied to a function or vector,
switch representation for the wrapper and try eliding redundant
checks. The resulting value keeps a constant number of
chaperone/impersonator wrappers regardless of the number of contracts
applied to it, and won't run any (provably) redundant checks.

This avoids a pathological case where, e.g., a function crosses a
boundary inside a loop, and gets wrapped N times (or worse, 2^N).

The optimization for function contracts currently only applies for
fixed-arity functions and contracts, and only for functions with known
result-arity of 1. These limitations are not fundamental.

Checking specific checks is not as optimized as for regular arrow
contracts yet. (Specifically: arity-specific wrappers and
tail-marks-match support is missing.) Again, not a fundamental
limitation.

Further described in the OOPSLA 2018 Paper: "Collapsible Contracts: Fixing a Pathology of Gradual Typing"

In collaboration with Ben Greenman, Christophe Scholliers, Robby Findler, and Vincent St-Amour.
2018-12-13 14:58:56 -06:00
Alexis King
15d0ccc2c0 Fix splicing-parameterize around begin 2018-12-13 14:28:50 -06:00
Alexis King
1d1245b092 Allow explicitly providing a parent logger to define-logger 2018-12-13 10:22:31 -06:00
Matthew Flatt
347f5b8ccf compiler/cm: unbreak dependency checking
Recent changes to adapt cm to cross-multi mode also attempted to
improve dependency checking to avoid prematurely committing to
compiling an old dependency, but that improvement was broken.
2018-12-12 08:44:06 -07:00
Matthew Flatt
aded42468e expander: fix use of root namespace for readers 2018-12-10 20:38:42 -07:00
Sam Tobin-Hochstadt
b1e765ca31 Check result of reading linklet hash. 2018-12-10 10:40:52 -05:00
Sam Tobin-Hochstadt
404964ea08 Reduce some build system dependencies. 2018-12-10 10:40:52 -05:00
Caner Derici
48cf9e54e3 regexp: add a target for writing the zo 2018-12-10 05:50:22 -07:00
Matthew Flatt
140043fb65 in-indexed: repair call to wrapped continue-after-pos+val?
Closes #2418
2018-12-09 12:27:29 -07:00
Matthew Flatt
24aeea28c1 file-position: repair for OS pipe after peek
Closes #2419
2018-12-09 12:16:10 -07:00
Matthew Flatt
db2ac559a7 compiler/cm: avoid rewriting machine-indepedent files
The multi-cross mode, don't rewrite a machine-indepedent file
by recompiling it to itself. This shouldn't matter, but not
touching files makes the result cleaner.
2018-12-09 11:02:09 -07:00
Matthew Flatt
344b72b4f8 cs: reconstruct let* in fallback interpreter
Representing nested `let`s as `let*` avoids a limitation
in Chez Scheme's `fasl-read`, for now.
2018-12-09 08:54:23 -07:00
Matthew Flatt
476bc8b879 schemify: lift "empty" closures to top of a module body
When a `[case-]lambda` form's only free variables are at the module
level, the Schemified form is a `[case-]lambda` form whose only free
variables are in an enclosing `lambda` for a linklet. Since those are
not completely closed, to make the allocation pattern consistent with
traditional Racket, Chez Scheme needs a hint to allocate the closures
once per linklet instantiation.
2018-12-09 08:54:23 -07:00
Matthew Flatt
0261332ac3 io: avoid closure allocations for pipes and byte-string ports 2018-12-09 08:54:23 -07:00
Matthew Flatt
bcf6492d56 io: reduce overhead of a byte string output port
Make it a thinner wrapper around the output half of a pipe.
2018-12-09 08:54:23 -07:00
Matthew Flatt
9f27b90e31 io: change port from table of functions to table of methods
Adjust the internal port representation to that it doesn't inherently
require allocating lots of closures.
2018-12-09 08:54:23 -07:00
Ben Greenman
0c2ada98ff json: improve 'bad input' error message (#2420)
When 'read-json' finds "bad input", print the input to try to show what
went wrong.
2018-12-08 16:31:58 -05:00
Matthew Flatt
a66038a427 io: shortcut for common format patterns 2018-12-07 11:03:53 -07:00
Matthew Flatt
0f413d38c5 cs: faster path for simple foreign calls 2018-12-07 09:53:49 -07:00
Matthew Flatt
45046f4c5d fix placement of "instantiate" starting counter 2018-12-07 07:53:56 -07:00
Matthew Flatt
99feebf070 ephemeron-value: add optional "retain" argument
When an ephemeron is accessed through a weak mapping from the same key
that is used in the ephemeron, and when the key is not otherwise
reachable, there can be a race between extracting the value from the
ephemeron and performing a GC that reclaims the key. Avoid that race
by supplying the key back to `ephemeron-value`, which ensures that the
key remains reachable until the value is extracted.

In many cases, supplying the key as the second argument would also
work --- since that argument is used as a replacement value when the
key is inaccessible, but the key can't become inaccessible if it's
pending as a replacement value. A separarate optional argument to
`ephemeron-value` seems clearer and more general, though.
2018-12-07 06:31:18 -07:00
Matthew Flatt
9ce4dd8770 raco exe: fix excessive memory use
Avoid retaining namespaces that are created to gather runtime paths.
If expansion generates a lot of instances with a lot of type
information, for example, this repair can save a lot of space.
2018-12-07 05:31:43 -07:00
Matthew Flatt
f9551bcaa5 remove accidentally committed debugging file 2018-12-06 16:48:49 -07:00
Matthew Flatt
beb8445d14 cs on Windows: almost support embedded DLLs
Wire in the pieces to make embedded DLLs work, but a DLL based
on Chez Scheme doesn't actually work as embedded, yet.
2018-12-06 16:46:48 -07:00
Matthew Flatt
fed7e5e95c reader: immutable vectors and boxes from read-syntax
Closes #1745
2018-12-05 16:26:57 -07:00
Gustavo Massaccesi
561fe7e2e7 cs: more pure primitives 2018-12-04 22:03:27 -03:00
Gustavo Massaccesi
ff5f2ae69a optimizer: (cdr <list?>) is a <list?>
In case it is not an error, the result is a list.
2018-12-04 18:34:21 -03:00
Ben Greenman
88b165314a
fix pair accessor error messages (#2413)
Change the error message for some functions like `caddr` so they
describe pair structures that they expect
2018-12-04 16:04:01 -05:00
shhyou
8043768b4c Support unsyntax-splicing in vector quasisyntax
If the sub-template inside #(...) is unsyntax-splicing instead
of list, produce the template #((~@! . ????)) instead of calling
(datum->syntax o list->vector o syntax->list). Fixes #2402.
2018-12-04 12:00:01 -06:00
Philip McGrath
b3104a6acd add #:result clause to for/lists and for*/lists 2018-12-04 10:12:43 -07:00
Matthew Flatt
6d8596bae3 raco setup: repair more problems with multi-cross mode
Fix some race conditions involving concurrent setup tasks that are
each trying to generate both machine-independent bytecode and
machine-specific bytecode.
2018-12-04 06:05:53 -07:00
Ben Greenman
b38ce36c92
glob: add 'glob-quote' (#2397)
add a function to escape any glob wildcards in a path or string

also add a private `glob-element->filename` function so that, e.g., the pattern
`a\*` matches the file named `a*` (previously, the match would fail and
I think it was impossible to match for only `a*`)
2018-12-04 00:21:14 -05:00
Matthew Flatt
e729d35915 bump version number
Should have bumped with 37929f2191.
2018-12-03 20:24:13 -07:00
Matthew Flatt
37929f2191 cs: make interp layer safe-for-space
Fix the fallback interpreter (which is used for the "outside" of a
module that is too big to compile) so that it's safe-for-space.

This change is unlikely to repair any immediate problems, but space
safety problems are difficult to detect and avoid when the underling
implementation is not safe-for-space so fixing the interpreter is
likely worthwhie in the long run.
2018-12-02 15:58:59 -07:00
Matthew Flatt
74abc61f03 cs: fix module-prompt handling in interpret mode 2018-12-01 09:33:23 -07:00
Matthew Flatt
0c6d22a04a hash-ref: guard against fixnum argument when JIT-inlined
Closes #2409
2018-12-01 06:22:08 -07:00
Matthew Flatt
3a19809268 compiler/cm: protect a ".dep" use against old versions 2018-12-01 06:00:49 -07:00
Matthew Flatt
b94f84a909 expander: load modules on demand for recompile 2018-11-30 22:54:10 -07:00
Matthew Flatt
68e105c0ed cs: prompts for module-body expressions
Module definitions and expression need to have a prompt around them to
delimit continuation capture, variable assignment needs to happen at
the right point to ensure that reassignment is guarded and
non-assignment is detected. But avoid the prompt when it's not needed,
such as around function definitions.

Closes #2398
2018-11-30 22:54:10 -07:00
Matthew Flatt
6f0748108c cs: fix module-variable initialization order
Similar to a255def019, but for side effects potentially
exposed by definition RHS expressions, instead of
expressions not in a definition. Improve that commit and
this one by only forcing variable assignments at non-simple
expressions.
2018-11-30 22:54:10 -07:00
Matthew Flatt
8b15ad971c cs: fix embedded modules in places 2018-11-30 22:54:10 -07:00
Matthew Flatt
f2fb2ebc55 racketcs: fix command-line handling after non-flag argument 2018-11-30 22:54:10 -07:00
Philip McGrath
bd7de80d98 raco pkg new: Remove deprecated sudo: false from .travis.yml
Travis is eliminating its container-based infrastructure
and deprecating the `sudo` keyword.

This commit also updates the example build matrix to use
more recent Racket versions.

Corresponds to https://github.com/greghendershott/travis-racket/pull/29
2018-11-29 19:21:13 -05:00
Matthew Flatt
2e3b16f77c makefile: fix redundant path separators 2018-11-29 10:08:19 -07:00
Matthew Flatt
e607ae09de makefile: speed up make in "cs" build directory
Take advantage of ".d" files that are already generated to speed up a
`make` in the "cs" build dierctory when nothing needs to be done.
2018-11-29 09:41:49 -07:00
Philip McGrath
2798608ccd cs: fix error message from raise-argument-error
Closes https://github.com/racket/racket/issues/2400
2018-11-28 06:19:12 -07:00
Matthew Flatt
a7499ab854 expander: more determinsitic machine-independent "bytecode"
Discard local-variable names to avoid `gensym` artifacts in the same
way that a more complete compilation would discard the names. This
change does not affect function names, which are preserved through
separate properties.
2018-11-27 20:01:43 -07:00
Matthew Flatt
8c6af1a234 expander: avoid format in common paths
Use `string-append`, `symbol->string`, etc., instead of `format` for
constructing some symbols.
2018-11-27 19:26:59 -07:00
Matthew Flatt
432dfcdb4a hash-{map,for-each}: strengthen try-order? guarantee
Promise a specific order for a hash table that uses only certain
primitive, non-compound datatypes for keys.
2018-11-27 17:50:48 -07:00
Matthew Flatt
5f940e462e call-with-atomic-output-file: option to make Windows moves more atomic
It most cases, it's more important for `compiler/cm` to reliably
replace a file that might be busy than to make the file update atomic.
To suport that kind of use, `call-with-atomic-output-file` implemented
a fairly reliable, multi-step, non-atomic process for replacing a file
on Windows.

For recompilation of bytecode in machine-independent form, however,
`compiler/cm` now really wants to atomically write a replacement
bytecode file. That's not generally possible on Windows (except on
NTFS with transactions, which are discouraged...), but MoveFileEx work
atomically in some cases and it's likely to work for the cases needed
by `compiler/cm`. Probably.

So, add a mode to `call-with-atomic-output-file` to get "more atomic"
updates on Windows. This mode is enabled by a callback that makes the
caller responsible for deciding what to do with the move fails, such
as waiting a while and trying again. And `compiler/cm` now waits a
while and tries again, up to a limit, which should be good enough for
recompilation.
2018-11-27 09:47:11 -07:00
Robby Findler
b68866db0f added object=-hash-code 2018-11-27 16:00:24 +01:00
Matthew Flatt
a001b5b231 raco setup: multi-machine cross-compile support
Enable `raco {setup|make}` to build two sets of compiled files: one
set that is suitable for the current machine, and another set that is
suitable for a different machine or for all machines (i.e.,
machine-independent bytecode).

In the long run, this new `raco setup` mode support cross compilation
where the build machine and target machine have different bytecode
formats --- unlike the current cross-compliation mode, which relies on
there being a single bytecode format in traditional Racket for all
platforms.

In the short run, the new mode enables the faster creation of
Racket-on-Chez distribution builds. The build server can send out
machine-independent bytecode to client machines while using
machine-specific bytecode for itself to drive the build process.

The new compilation mode relies on a somewhat delicate balance of the
`current-compile-target-machine` and `current-compiled-file-roots`
parameters (as reflected by the `-M` and `-R` command-line flags for
Racket) as well as cross-compilation mode (as enabled by the `-C`
command-line flag).
2018-11-26 19:49:33 -07:00
Matthew Flatt
4a080ada04 system-type: add 'target-machine
The 'target-machine result from `system-type` reports the
default value of `current-compile-target-machine`.

Also, fill in pieces to make `setup/cross-system` work
for RacketCS, although cross-compilation is still several
steps away.
2018-11-25 12:10:09 -07:00
Matthew Flatt
7cdf9f1c0b raco setup: remove -M/--compile-any
This commit mostly reverts 9441f7075f, because it looks like relying
on `racket`-level configuration is the right idea after all.
2018-11-25 12:10:09 -07:00
Matthew Flatt
695e270197 compiler/cm: avoid race in recompile
The new path for recompiling from machine-independent files
trues to read a ".zo" file without holding the recmopilation
lock and without an `exn:fail:filesystem` handler.
2018-11-25 08:11:21 -07:00
Matthew Flatt
3833a22f75 setup: leave cm trace handler alone in places
When `--vv` is not provided, leave the default `compiler/cm` trace
handler in place so that logging works as intended.
2018-11-25 08:06:28 -07:00
Matthew Flatt
055642a40a raco setup: less eager removal of ".zo" files
Wait until replacement is more assured before deleting an existing
".zo" file.

Also, don't delete a ".zo" file that is later in the
`current-compiled-file-roots` search path than the one being written.
This refinement supports setting up a search path to try
machine-specific compiled files and fall back to machine-independent
files, for example.
2018-11-24 19:39:01 -07:00
Matthew Flatt
a70c1b5242 compiler/cm: add missing version check 2018-11-24 12:02:41 -07:00
Matthew Flatt
1d2a7dec62 raco setup: show target machine in startup info 2018-11-24 11:46:36 -07:00
Matthew Flatt
9441f7075f raco setup: add -M/--compile-any
Add `-M`/`--compile-any` to `raco setup`, `raco pkg install`, etc., to
build machine-independent bytecode, which is useful in the process of
building distributions.
2018-11-24 11:19:09 -07:00
Matthew Flatt
0bc010d972 raco setup: avoid recompilation in parallel mode
The `parallel-lock-client` protocol expects a #f back when a
file was meanwhile compiled by another process. So, don't
just forget about a file after it is compiled, in case there
is still a lock request on the way for that file.
2018-11-23 18:14:42 -07:00
Matthew Flatt
4946196c91 recompile-linklet: accept option argument
Add an options argument for consistency with `compile-linklet`.
2018-11-23 18:04:48 -07:00
Matthew Flatt
ac70e9a058 compiler/cm: detect and take recompilation shortcut
When a module is compiled to platform-independent form, recompile from
that form for the current platform, instead of recompiling from source.
2018-11-23 17:59:20 -07:00
Matthew Flatt
1c437793a6 expander: fix another recompilation problem
Fix merging of extra-inspector sets, which recompilation ignores
anyway.
2018-11-23 11:28:51 -07:00
Matthew Flatt
600a6b4c29 expander: fix compiled-expression-recompile
Linklets other than the body linklet may need conversion from
machine-independent form to machine-specific form.
2018-11-23 09:58:02 -07:00
Matthew Flatt
d6802444fa cify: repair bytes-ref and bignum handling
These problems were exposed by cifying `racket/fasl`.
2018-11-23 08:03:45 -07:00
Matthew Flatt
f47f685af9 schemify: fix srcloc marshaling
Partly fix it, anyway. More is needed in general to reduce
recording build-time paths in compiled code.
2018-11-22 19:31:46 -07:00
Matthew Flatt
19e709d27b revise compile-target parameter
Replace `compile-machine-independent` with
`current-compile-target-machine` to set up
better for future cross-compilation support.
2018-11-22 17:36:31 -07:00
Matthew Flatt
c5f000c4fc expander: recompile converts from machine-independent to -specific
Actually, the machine-independent-to-specific part is trivial. The
hard part was making `compiled-expression-recompile` enable
cross-linklet optimization as it recompiles, since that involves
pulling apart metadata and putting it back together afterward.
2018-11-22 16:39:55 -07:00
Matthew Flatt
2bbaa64cd6 add machine-independent compilation mode
The `compile-machine-indendent` parameter controls whether `compile`
creates a compiled expression that writes (usually in a ".zo" file) to
a machine-independent form that works for anhy Racket platform and
virtual machine. The parameter can be set through the
`-M`/`--compile-any` command-line flag or the `PLT_COMPILE_ANY`
environment variable.

Loading machine-independent code is too slow for many purposes, but
separating macro expansion from backend compilation seems likely to be
a piece of the puzzle from cross-compilation and faster distribution
builds.
2018-11-22 13:41:36 -07:00
Matthew Flatt
d84d35870a expander: fix set! in namespace from module->namespace
Closes #2369
2018-11-22 07:21:30 -07:00
Matthew Flatt
ad14cca1e8 expader: fix caching for flattening 2018-11-22 06:39:38 -07:00
Matthew Flatt
fd462604bd cs: make gensym add a counter for the printed form
Although the counter doesn't make the generated symbol any more
distinct, it's often a helpful hint.

Closes #2396
2018-11-22 05:43:53 -07:00
Sam Tobin-Hochstadt
df88852e24 Additional files to ignore. 2018-11-21 12:39:56 -05:00
Sam Tobin-Hochstadt
18afdb54d6 Use linklet functions from '#%linklet instead of from lower level. 2018-11-21 12:39:56 -05:00
Matthew Flatt
744d440ab9 schemify: ensure that deserialized constants are immutable
Closes #2394
2018-11-21 10:16:19 -07:00
Matthew Flatt
669e51768d io: normalize path to current-directory[-for-user]
Closes #2393
2018-11-21 09:58:16 -07:00
Matthew Flatt
299692a38a io: fix initial print-as-expression value
Closes #2391
2018-11-21 09:48:14 -07:00
Matthew Flatt
e5bfba5f3c cs: repairs for byte-string comparison operators 2018-11-21 09:38:32 -07:00
Matthew Flatt
7231f11b60 cs: don't treat crashes as constract errors
Converting "invalid memory reference" to an `exn:fail:contract` (which
is the default conversion) hides crashes as success when a test
expects an error.

Also, fix a bug that was hiding as an expected excdeption.
2018-11-21 09:28:28 -07:00
Matthew Flatt
701854a404 expander: remove unused require of racket/fasl 2018-11-21 09:08:48 -07:00
Matthew Flatt
13fa23e79a unbreak cify build 2018-11-21 08:37:48 -07:00
Matthew Flatt
6f6d121611 move linklet bundle and directory to expander layer
The Racket and RacketCS implementations had separate copies of
linklet-directory and linklet-bundle reading and writing. Move the
implementation into the expander layer.

The primitive '#%linklet instance now omits directory and bundle
operations and `read-compiled-linklet`. It intead must provide
`write-linklet-bundle-hash`, `read-linklet-bundle-hash`, and
`linklet-virtual-machine-bytes`.
2018-11-21 07:23:50 -07:00
Robby Findler
8cee5a09da improve the redundancy checking for class contracts
In particular, when there isn't any redundancy detected, then
just make a single call into the projection and create just a single
class.

This seems to help on at least one of the configurations of
dungeon, which completes in about 6 minutes with this commit
and I gave up waiting after 15 minutes for the version of
racket that didn't have it
2018-11-20 21:30:39 -06:00
Gustavo Massaccesi
b4e3030a0d rumble: fix some type checks in bytes.ss 2018-11-20 16:50:50 -03:00
Sam Tobin-Hochstadt
940e46df6c Rebuild expander.
Should have been included in 1258d9d28.
2018-11-20 11:56:28 -05:00
Sam Tobin-Hochstadt
1258d9d28a
Point to body forms in missing-expression error. (#2356)
Improves the error message for:

```
(define-syntax (like-lambda stx)
  (syntax-case stx  ()
    [(_ e) #'(lambda () e)]))

(like-lambda (define x 1))
```

Based on a report from @pkoronkevich.
2018-11-20 11:43:28 -05:00
Matthew Flatt
daed85e1dc setup/dirs: fix cases where paths are unavailable
When an executable distibution is created, some path become
unavailable at run time, such as the result of `find-links-file`.

Change the contract on those functions and adjust the implementation
to return `#f` in those cases. This is a backward-compatible change in
the sense that uses that now return `#f` would have crashed before
(although it does shift the blame in that case).

Based on an initial patch by Shu-Hung.

Closes #2352
2018-11-19 19:15:49 -07:00
Sam Tobin-Hochstadt
c1d2e4031e
Guard free-identifier=? comparisons in shared. (#2382)
Fixes #2381.
2018-11-17 22:26:11 -05:00
Alex Feldman-Crough
c4189ff934 untar: treat the tag #\nul as a synonym for #\0
The GNU Tar manual (at
https://www.gnu.org/software/tar/manual/html_node/Standard.html) says
that older archives may have the typetag AREGTYPE (\0) instead of
REGTYPE ('0'), and that AREGTYPE should silently be treated as
REGTYPE.
2018-11-17 18:00:15 -07:00
Matthew Flatt
ef9e9e3f7e cs: check initialization of variables on instance linking 2018-11-17 16:44:08 -07:00
Matthew Flatt
a255def019 cs: fix state of module instance interrupted by error
Closes #2380
2018-11-17 16:30:56 -07:00
Matthew Flatt
d47d036239 cs: fix dynamic-wind on chaperoned procedure 2018-11-17 15:58:46 -07:00
Matthew Flatt
64069a5792 cs: initialize error-value->string-handler per place
Closes #2377
2018-11-17 15:15:23 -07:00
Matthew Flatt
f6eb956199 cs: fix error with a single symbol argument
Closes #2379
2018-11-17 15:06:55 -07:00
Matthew Flatt
c1c110f662 makefile: accomodate current Mingw-64
As of version 5.0.5, Mingw-64 adds an ".exe" extension even if it's
not in the `-o` argument. Adjust the makefiles to consistently use
".exe".
2018-11-17 15:03:15 -07:00
Matthew Flatt
c44c8b9cc0 cs: implement best-effort-ordered hash table traversal 2018-11-16 16:53:54 -07:00
Matthew Flatt
a6e37fc947 racket/fasl: improve determinism of output
When traversing hash tables, try to sort the keys.
2018-11-16 16:36:56 -07:00
Matthew Flatt
624918d399 expander: remove obsolete and broken to-source? compile mode
Source mode was a leftover from early iterations of the expander. A
bootstrapping mode that uses replacement `compile-linklet`, etc.,
turned out better.
2018-11-16 16:21:28 -07:00
Matthew Flatt
709258d88c reorganize and update "README.txt"s about sources and builds
Integrate Racket-on-Chez information better and reorganize information
to reflect the way that the makefiles and build scripts have evolved.
2018-11-16 07:49:53 -07:00
Matthew Flatt
337aec3436 cs: fix -C flag to set (system-type 'cross) 2018-11-15 18:17:05 -07:00
Matthew Flatt
7c1326a120 io: fix subprocess waiting for Windows 2018-11-15 14:57:09 -07:00
Caner Derici
331b383103 fasl: make sure every write-bytes know where to write (#2373)
adding tests that fail without this fix
2018-11-15 16:53:53 -05:00
Matthew Flatt
06101ffb89 cs & io: fix current-directory initialization 2018-11-15 10:02:57 -07:00
Matthew Flatt
6d1b287467 io: fix (find-system-path 'orig-dir) 2018-11-15 09:37:28 -07:00
Matthew Flatt
a6cc19648f cs: allow Racket framework to find itself not in "CS"
The installer-signing process can copy the framework to an application
directory that does not have "CS" in its name.
2018-11-15 06:35:03 -07:00
Matthew Flatt
a9b02d5956 schemify: fix some function names when saving "bytecode" 2018-11-15 05:29:36 -07:00
Matthew Flatt
3e480f1c93 io: fix current-directory and related parameters
For consistency with traditional Racket, the guards need to be
implemented through derived parameters instead of chaperones.
2018-11-15 05:29:36 -07:00
Matthew Flatt
caf28648e3 cs: fix schemify of non-rator call-with-values 2018-11-15 05:29:36 -07:00
Matthew Flatt
4068b9097d io: fix some test failures 2018-11-15 05:29:36 -07:00
Matthew Flatt
1e726581ef io: TCP port does not count as a file-stream port 2018-11-15 05:29:36 -07:00
Matthew Flatt
bf7eee0f65 thread: fix atomic-timeout-callback implementation
Closes racket/drracket#238
2018-11-14 16:59:16 -07:00
Sam Tobin-Hochstadt
cf34c22380
fasl: find shared values in hash tables. (#2371)
Also, add test to check sharing of uninterned symbols.
2018-11-14 18:45:54 -05:00
Matthew Flatt
c51616ecfd cs: fix typo in Windows build script 2018-11-14 15:47:57 -07:00
Matthew Flatt
60a6dc1796 setup: adjust command-name hack for case-insensitive Windows 2018-11-12 14:58:30 -08:00
Matthew Flatt
0b7072eed3 cs: communicate DLL directory to rktio
rktio needs the DLL directory path to load iconv.
2018-11-12 15:50:14 -07:00
Paulo Matos
28a28e4244 Use constant defined in header 2018-11-12 15:34:44 -07:00
Matthew Flatt
ccbef59e96 io: print: handle paths that don't convert cleanly to a string 2018-11-12 14:33:09 -08:00
Matthew Flatt
7abfdab35e io: repair directory-list for Windows 2018-11-12 14:25:44 -08:00
Matthew Flatt
9e4ebd9196 rktio Windows: fix truncate-file to not move file position
A call intended to restore the position was in place, but it
was wrong.
2018-11-12 09:37:02 -08:00
Matthew Flatt
8e4cecf215 io: flush before performing file truncate
For consistency with traditional Racket and currently matters on
Windows. The Windows implementation of file-truncate should probably
not move the file position as it does, though.
2018-11-12 09:59:35 -07:00
Matthew Flatt
0d4674a6e1 cs Windows: fix manifest on GRacket 2018-11-11 07:18:34 -08:00
Matthew Flatt
7ab69142f4 cs: fix exec-file and run-file setup
Allow embedded command-line argument to adjust exec-file, for
example.
2018-11-11 08:11:17 -07:00
Matthew Flatt
f10e6d43bf rktio: avoid triggering console when starting a place 2018-11-11 05:57:03 -08:00
Matthew Flatt
67b721e5b7 Windows: move on-demand console to rktio
In GUI-application mode (e.g., running GRacket), a console is allocated
on demand if a program tries to use the original ports. Move that
on-demand handling into rktio, where it's simpler and works for
RacketCS.
2018-11-11 06:14:22 -07:00
Matthew Flatt
7fa31684e9 io: show a string as a port name 2018-11-10 15:18:09 -07:00
Matthew Flatt
d0fab4027b net/win32-ssl: repairs for CS 2018-11-10 14:17:07 -08:00
Matthew Flatt
350ecf3d49 expander: don't duplicate properties in 'origin handling
One more take on the problem addressed by 990e1f1e30. This adjustment
avoids copying properties from the original form to the identifier
that is preserved in 'origin.
2018-11-10 07:52:04 -07:00
Paulo Matos
fca1c430af Fix typo 2018-11-10 08:43:12 -03:00
Matthew Flatt
90aac96cde expander: fix taint problem with 'origin handling
Repairs a problem with commit 990e1f1e30.
2018-11-09 20:50:10 -07:00
Matthew Flatt
990e1f1e30 expander: fix origin tracking for int-defn contexts
Closes #2346
2018-11-09 13:51:16 -07:00
Alexis King
bc34ba884b Reinstate the stop list after #%module-begin performs partial expansion 2018-11-08 19:13:03 -06:00
Matthew Flatt
b7c2359026 compiler/cm: adapt as intended to old .dep files
Try again on 1293674ddb.
2018-11-03 17:05:34 -04:00
Matthew Flatt
1293674ddb compiler/cm: don't misue old .dep files
The `get-compiled-file-sha1` function assumed that a ".dep" file is
up-to-date when present. That may not be consistent with all uses,
including in `file-stamp-in-paths` as used by DrRacket for "populate
compiled", and an old file can go wrong with the recent ".dep" format
change. Make `get-compiled-file-sha1` at least check the version on
the ".dep" content before trying to use it.

Relevant to #2354
2018-11-02 20:28:08 -06:00
Alexis King
93def1f753 Fix stream contracts to work with impersonator contracts 2018-11-02 11:24:39 -05:00
Matthew Flatt
62a674fa80 io: exn:fail:network for TCP-port errors 2018-11-02 05:00:16 -07:00
Matthew Flatt
6a7f9773d1 cs: fix _stdbool 2018-11-01 16:49:10 -06:00
Kevin Robert Stravers
22cf2750a7 cmdline: three/four items -> three items 2018-11-01 14:48:20 -05:00
Leif Andersen
209a90d281
Make racket/private/serialize-struct cross-phase (#2270)
This makes sense because a serializable struct should probably remain
serializable, even if it was inserted into a bit o' 3d syntax.
2018-10-30 15:41:08 -04:00
Matthew Flatt
c0fac954e1 windows: declare Windows 10 compatibility in manifest 2018-10-30 09:55:33 -07:00
Matthew Flatt
7e926d1d86 raco exe: fix alignment in PE resource writer 2018-10-30 09:55:33 -07:00
Matthew Flatt
b9c042329b cs makefiles: fix a make that should be $(MAKE)
Relevant to #2344
2018-10-29 20:42:03 -06:00
Matthew Flatt
0242a46396 cs: more portable approach to errno
Have the main Racket executable export a function to get errno, which
avoids portability problems trying to access it via the FFI.

Related to #2344
2018-10-29 20:39:01 -06:00
Matthew Flatt
063fa65872 cs: add (system-type 'machine)
Closes #2343
2018-10-29 20:10:13 -06:00
Ryan Culpepper
ec406dd301 cs: fix lookup-errno 2018-10-29 11:12:58 +01:00
Matthew Flatt
933e3c14b5 bytecode: fix "preserves marks" annotation w.r.t call/immediate-mark
A function that uses `call-with-immediate-continuation-mark` in tail
position should not be flagged as "preserves marks", because the JIT
needs to bump the mark stack if the function is called in non-tail
position.

Closes #2333
2018-10-28 18:52:41 -06:00
Matthew Flatt
d1fe6a6e3e repair allocation bug in delimited continuations
The repair is more precisely a repait to xform, which incorrectly
parsed a C function definition that starts "struct" as a struct
declaration. (The function starts "struct" because the return type is
"struct Scheme_Overflow_Jmp *".) Since the function wasn't recognized,
xform didn't convert it to cooperate with the garbage collector.

Closes #2341
2018-10-28 17:09:45 -06:00
DarrenN
2dc96b365a Implement hash/c random generate and exercise 2018-10-28 14:37:59 -05:00
Matthew Flatt
dbcc9dddc3 xform: updates for recent MinGW 2018-10-28 13:14:14 -06:00
Matthew Flatt
b5084977c0 cs Windows: fill in GUI mode for GRacket
Still need to create console on demand.
2018-10-28 13:14:14 -06:00
Matthew Flatt
a24c6fe4f9 cs Windows: move kernel and boot files to DLL 2018-10-28 11:37:04 -06:00
Matthew Flatt
c6a3d4629d cs: register a nul-terminated byte string for WM_CLASS 2018-10-27 15:22:00 -06:00
Matthew Flatt
a08aed7dde configure help: clarification on --enable-sgcdebug
Closes #2340
2018-10-27 13:43:38 -06:00
Paulo Matos
c6a2843ba2 Fix simple typo in configure help message 2018-10-27 13:42:24 -06:00
Paulo Matos
071406d10d Mark variables as used so they are not removed by LTO
Fixes #2324
2018-10-27 13:39:12 -06:00
Matthew Flatt
de53dc3c5e cs: add Windows GRacket.exe 2018-10-27 13:23:40 -06:00
Matthew Flatt
c128c5aad6 cs: support ptr-ref and ptr-set! on string types 2018-10-27 11:14:42 -06:00
Matthew Flatt
3f6a7b3e06 cs: add icon and other resources to RacketCS.exe 2018-10-27 11:14:42 -06:00
Matthew Flatt
457a673506 Windows: avoid environment variables with empty name 2018-10-26 13:42:16 -07:00
Matthew Flatt
29a80fd7e5 io: repairs for Windows environment variables 2018-10-26 14:19:54 -06:00
Matthew Flatt
23648ba165 cs: repairs relevant to running `racket/gui/ programs on Unix 2018-10-26 14:05:33 -06:00
Matthew Flatt
3b9bc21304 cs: repairs to Windows build client 2018-10-26 11:04:45 -06:00
Matthew Flatt
7d86fddbdc cs: add strip on install for CS executables 2018-10-25 11:30:17 -06:00
Matthew Flatt
c0f14373ab cs: on Linux record embedded boot relative to ".rackboot" section 2018-10-24 21:06:11 -06:00
Matthew Flatt
8c3956a272 cs: update Windows build
Support non-"CS"-suffix mode, and avoid installing bytecode for
traditional Racket when builing a bootstrap traditional Racket.
2018-10-24 18:44:23 -07:00
Alexis King
af554933ef Fix arity mask upper bound calculation in curry
fixes #2332
2018-10-24 12:16:09 -05:00
Matthew Flatt
fce5554695 io: fix tcp-abandon-port so that the socket gets closed 2018-10-24 09:53:00 -06:00
Ryan Culpepper
e8832fbcc7 cs: remove plumber flush callback when custodian closes fd output port
Previously, the following program would print "error writing to
stream port" on program exit.

  (define cust (make-custodian))
  (define out
    (parameterize ((current-custodian cust))
      (open-output-file "test.data" #:exists 'truncate)))
  (write-string "This needs flushing...\n" out)
  (custodian-shutdown-all cust)
  (exit 0)
2018-10-24 17:46:29 +02:00
Ryan Culpepper
ddba2812ba cs: fix unsafe-file-descriptor->port mode 2018-10-24 17:46:29 +02:00
AlexKnauth
df19625c6c syntax/parse: fix Check-Syntax arrows within syntax classes 2018-10-24 17:45:30 +02:00
Matthew Flatt
23f6d2b43f cs: setup compiled subdirectory for gracket like racket 2018-10-23 21:38:43 -06:00
Sam Tobin-Hochstadt
423ce5e5a2 This file doesn't need match. 2018-10-23 11:56:49 -04:00
Matthew Flatt
8473666af3 cs install: remove old file before coying new files into place 2018-10-23 09:45:53 -06:00
Ryan Culpepper
d4691fb219 fix flush-output when write-out is port indirection 2018-10-23 12:00:31 +02:00
Matthew Flatt
31d35ebe88 cs: another fix for racketcs linking configure on Linux 2018-10-22 20:38:29 -06:00
Matthew Flatt
76f868f287 cs: fix racketcs linking configure for Linux 2018-10-22 20:32:07 -06:00
Matthew Flatt
f8e6b22544 cs: fix makefile chaining for bootstrap Racket variant 2018-10-22 20:14:50 -06:00
Matthew Flatt
7481eb6fed update another test for the VM identifier in bytecode 2018-10-22 19:53:21 -06:00
Matthew Flatt
cbd195201a cs: disable use of ncurses when building Chez Scheme
RacketCS doesn't currently access the Chez Scheme expeditor, and
avoiding curses make the build work in a more mininal environment.
2018-10-22 19:18:35 -06:00
Matthew Flatt
aa6ec1f0cd comiler/compile-file: adapt to use-compiled-file-paths setting 2018-10-22 17:14:49 -06:00
Matthew Flatt
9498c521cf cs: make build without "cs" suffix use "compiled" directly
When building RacketCS as just "racket", put compiled files in
"compiled" instead of a platform-specific subdirectory.
2018-10-21 18:27:00 -06:00
Matthew Flatt
8bed64f44f add virtual-machine identifier to bytecode and ".dep" files
So far, bytecode for traditional Racket has been kept separate from
RacketCS bytecode by using a different "compiled" subdirectory for
RacketCS. That makes sense for development work to allow the
implementations to coexist, but it creates trouble for packaging and
distributions, and it (hopefully) won't seem necessary in the long
run. Treating the different virtual machines like different versions
seems more generally in line with our current infrastructure.
2018-10-21 17:33:24 -06:00
Matthew Flatt
e3f25a6159 reorder configure scripts
Run last one of the scripts that can show the
installation-directory information correctly.
2018-10-21 08:07:45 -06:00
Matthew Flatt
3c4fa62e28 cs: configure and makefile corrections for --prefix installation 2018-10-21 07:40:18 -06:00
Matthew Flatt
abc5c9cdef cs: propagate CC, etc., to Chez Scheme configure 2018-10-21 06:38:12 -06:00
Matthew Flatt
51258bc77c cs: add support for -A 2018-10-21 05:59:00 -06:00
Matthew Flatt
de98529c13 cs configure: support SDK options
For example, enable a 32-bit Mac OS build.
2018-10-21 05:59:00 -06:00
Matthew Flatt
3591a685fc reorganize configure to better support racketcs
Rearrange the configure scripts so that it will be possible to build
RacketCS from a source distribution and have it installed in the right
place. Also, when building Racket3m just to bootstrap RacketCS, don't
install Racket3m.
2018-10-20 20:19:36 -06:00
Matthew Flatt
0f18df2c1a makefile: set up for cs client build 2018-10-20 20:19:36 -06:00
Matthew Flatt
18f7b96828 makefile: add way to build RacketCS as racket 2018-10-19 11:19:44 -06:00
Matthew Flatt
8f7a5b6dd5 Add Racket HISTORY.txt note for v7.1 2018-10-19 07:42:55 -06:00
Matthew Flatt
b1dfb61223 racocs exe: fill in implementation 2018-10-17 12:55:53 -06:00
Paulo Matos
703deedb66 Avoid integer overflow
A runtime error was detecting and overflow on e which this fixes.
Fixes part of #2314.
2018-10-17 07:57:39 -06:00
Matthew Flatt
eb6705be3c thread: fix futures in a non-main place 2018-10-17 07:41:38 -06:00
Matthew Flatt
65e464e626 cs: fix concurrency problems in prefabs & interned datums 2018-10-17 07:41:38 -06:00
Alexis King
86bb85931d units: Fix an improper use of syntax instead of quote-syntax 2018-10-16 18:23:13 -05:00
Alexis King
5fb75e9f82 Fix handling of the scopes of contracted signature bindings
fixes #1652
2018-10-16 16:52:45 -05:00
Matthew Flatt
8b22ebbfbe cify: fix more GC problems 2018-10-16 15:03:45 -06:00
Paulo Matos
6d7ab42b56 Fix fasl read fasl string.
Add a new test for the failing case.
2018-10-16 09:29:55 -06:00
Matthew Flatt
a7ae05a414 thread: fix place-channel ephemeron problem
Retains a strong link to a place-channel write end when there's at
least one waiting thread. This is symmetic to keeping a strong link to
the read end when the place-channel queue is non-empty. The change
repairs a problem building documentation with places in `racocs
setup`.
2018-10-16 09:29:55 -06:00
Paulo Matos
c78787a259 Simplify copy-port
Simplify copy-port by removing the several `(let loop...` constructs.
2018-10-16 09:26:41 -06:00
Matthew Flatt
fa6bd87bcd jit: fix nary unsafe-{fx,fl}{=,<,>,<=,>=}
Fix a incorrectly nested "tiny jump" mode that turned off the
surrounding "short jump" mode.

Closes #2313
2018-10-15 21:03:57 -06:00
Matthew Flatt
e9855fa64f cs: fix assignment to auto struct fields 2018-10-15 17:22:14 -06:00
Matthew Flatt
c347bc0c99 cs: clone ChezScheme repo with --depth 1 2018-10-15 17:22:11 -06:00
Matthew Flatt
f9a69105bc cs: small repairs for chaperones
The "struct.rktl" and "chaperone.rktl" tests now pass.
2018-10-15 08:52:13 -06:00
Matthew Flatt
7bb3750ebc cs: fix some structure and imperonsator problems 2018-10-15 08:52:13 -06:00
Matthew Flatt
2b39e61c4e cs, thread, io: fix problems with evt chaperones 2018-10-15 08:52:13 -06:00
Matthew Flatt
7ecb663a6f cs: fix procedure-name problems 2018-10-15 08:52:13 -06:00
Ryan Culpepper
2166c56179 fix typo in error message 2018-10-15 10:50:59 +02:00
Matthew Flatt
48f7082bdc cs: fix problems with procedures, arity, and impersonators 2018-10-13 13:06:06 -04:00
Matthew Flatt
2051bdfc6a schemify: don't incorrectly inline a recursive function 2018-10-13 13:06:06 -04:00
Matthew Flatt
9310b1e14c cs: recognize more Scheme errors
We'll want a better approach eventually.
2018-10-13 13:06:06 -04:00
Matthew Flatt
a7989924fa regexp: don't equate #rx and #px 2018-10-13 13:06:06 -04:00
Matthew Flatt
c43e42c903 cify: fix a GC problem 2018-10-13 13:06:06 -04:00
Robby Findler
b97811d4db improve error checking in the struct form of contract-out
closes #2303
2018-10-12 20:37:39 -04:00
Matthew Flatt
51e08c48f1 thread: repair for killing a thread blocked on itself 2018-10-12 05:56:39 -06:00
Matthew Flatt
e260aef958 cs: fix more printer problems exposed by "print.rktl" tests 2018-10-11 20:32:22 -06:00
Paulo Matos
ad7797e2cf Fix memory leak
Free env variable if it was allocated.
2018-10-11 09:34:42 -06:00
Paulo Matos
9020f5aac5 Clarify the use of foff as a base pointer in foreign malloc
Fixes #2285.
2018-10-11 09:34:03 -06:00
Matthew Flatt
9f839c1161 expander: avoid retaining some syntax objects
During the expansion of an internal-definition contexts, don't
retain full forms, and instead keep just enough to perform
syntax tracking, if any.
2018-10-11 06:55:04 -06:00
Matthew Flatt
26f785e64e cs: fix some printer problems exposed by "print.rktl" tests 2018-10-11 06:01:07 -06:00
Matthew Flatt
d25058c94a cs: fix problems exposed by "read.rktl" tests 2018-10-11 06:01:07 -06:00
Matthew Flatt
16347b434d cs: fix raise-result-arity-error 2018-10-11 06:01:07 -06:00
Matthew Flatt
191d17461f hash-ref: adjust error message for bad failure thunk
Refines 2ef8d60cc6 to avoid characterizing the failure as a `(-> any)`
contract on `hash-ref`, since `hash-ref` doesn't enforce that contract
in general. Go back to an `exn:fail:contract:arity` error, but keep
the specialization of the error message to clarify that it's from
`hash-ref`. Also, bring RacketCS into sync.
2018-10-11 06:01:07 -06:00
Alexis King
15280640d4 Track disappeared define-syntaxes in internal definition contexts 2018-10-10 11:54:44 -05:00
Matthew Flatt
2b9c0c4689 avoid using directory-exists? as part of a contract
Although a `directory-exists?` check is useful for providing better
error messages, it's fundentally a race condition, since an external
process can always remove a directory between the check and a use of
the directory. Because of that limitation of `directory-exists?`, we
normally avoid making it part of a contract. This commit adjust
937aa3cdb1 to follow that convention while preserving the helpful
check and documentation improvements.
2018-10-10 06:26:57 -06:00
Alexander McLin
937aa3cdb1 pkg: fix check-strip-compatible and generate-stripped-directory
Their semantics assume all directory `path-string?` arguments point
to existing directories in the filesystem but they do not actually
check to verify resulting in unhelpful inner exceptions
breaking the functions' semantic abstractions.

Fixed by adding appropriate checks.

Test cases included too.

Documentation updated to reflect the requirement for paths to
refer to existing directories.

Also added note that `generate-stripped-directory` does not
compile or render source files.
2018-10-10 05:51:20 -06:00
Alexander McLin
aecc786b7f pkg: repair file:// URL handling for strip modes
When catalog is specified via file:// URL to a local directory with local
package directories that have been stripped in various modes, `raco pkg install`
will incorrectly error out with an incompatible package content error when
a binary strip mode is selected and a file-system error when source strip
mode is selected.

The cause is due to the file:// URL's resolved file path not being passed
along to the helper functions in the various code paths handling the different
strip modes; instead the full original file:// URL is passed along and is
misinterpreted as an actual filesystem path resulting in the observed failure
modes.

The repair is simple; change the relevant argument so the resolved filesystem path
is used instead of the original file:// URL.

Test cases added to test various combinations of strip modes when using
`raco pkg install` and local catalog directory.
2018-10-10 05:51:20 -06:00
Matthew Flatt
ec837e8eb1 places: fix serialization of hash tables as place messages
I'm not sure why thinsg seemed to work before, but an existing
test fails after recent chages.
2018-10-09 15:51:54 -06:00
Matthew Flatt
de753399b6 racketcs: add support for -m flag 2018-10-09 15:07:49 -06:00
Matthew Flatt
238e2c7861 places: fix handling of OS-level errors during serialization
When a file descriptor cannot be `dup`ed for a place message, the
error message has to be delayed until the partially copied message is
cleaned up. Various problems with the message-serialization code
caused that delay to work incorrectly or incompletely.

Closes #2305
2018-10-09 15:07:49 -06:00
Matthew Flatt
fcf080cf93 fix typo in comment 2018-10-09 15:07:49 -06:00
Matthew Flatt
3acb1a5162 cs: fix build with non-threaded scheme 2018-10-08 15:27:53 -06:00
Matthew Flatt
076684b123 bytecode compiler: fix mishandling of export names
The repair in 4396b841c0 for internal names exposed a problem with the
way `linklet` handled renaming on export, where it mixed up the names
that should be used internally and externally in errors.

Merge to v7.1
2018-10-08 15:05:39 -06:00
Matthew Flatt
70bfd55696 schemify: add a missing unwrap
Anothe repair related to the 'source-name property.
2018-10-08 12:57:12 -06:00
Matthew Flatt
c102673339 thread: add some reminders to the implementation
These comments were meant to be part of e60a78aad9.
2018-10-08 12:57:12 -06:00
Paulo Matos
62c63de7a2 Remove unused modpath->string 2018-10-08 12:56:15 -06:00
Vincent St-Amour
1d8806e0bb Post-release version for the v7.1 release 2018-10-07 10:23:13 -05:00
Matthew Flatt
e60a78aad9 thread: custodian shutdown of current suspend-to-kill thread 2018-10-05 20:55:21 -06:00
Matthew Flatt
b57b9be2f8 schemify: repair after adding 'source-name property 2018-10-05 20:55:21 -06:00
Matthew Flatt
e94a519d44 cs: fix integer->integer-bytes
Closes #2277
2018-10-04 19:20:34 -06:00
Matthew Flatt
4396b841c0 fix expander+compiler to report source name for use-before-init
Lots of plumbling was in place to preserve the source name (instead of
the symbol generated to avoid collisions for macro-introduced
definitions), but some small pieces were missing.

Closes #2288
2018-10-04 18:52:05 -06:00
Matthew Flatt
daba4f518b places: repair detection of mutable prefabs 2018-10-04 15:37:06 -06:00
Matthew Flatt
c2b5e4404a rumble: fix hash-set error message 2018-10-04 15:36:51 -06:00
Matthew Flatt
adfe862a0b cs: make make expander-demo work in a fresh checkout 2018-10-03 08:58:44 -06:00
Matthew Flatt
8a5de6c27f reader: remove some broken tests 2018-10-03 08:58:44 -06:00
Paulo Matos
5bbbe44a7b Fix ubsan runtime error due to large shift 2018-10-02 14:14:04 -06:00
Paulo Matos
15523f68ec Fix sizeof argument 2018-10-01 10:56:36 -05:00
Paulo Matos
5834a4b938 Remove unused code
Fixes #2290.
2018-10-01 10:56:12 -05:00
Paulo Matos
bc3777792d Only copy argv if not NULL
Fixes #2283.
2018-09-24 05:28:47 -06:00
Matthew Flatt
e83ca7a9e5 native-libs: merge Pango repair for emoji iteration 2018-09-22 20:37:34 -06:00
Matthew Flatt
27bb075113 native-libs: restore a Cairo patch
When upgrading native-library versions, a still-relevant
patch got lost. The patch corrects a problem with empty
glyphs getting treated as missing glyphs.

Closes racket/pict#42
2018-09-22 20:28:13 -06:00
Matthew Flatt
45af149fc0 dynamic-place: fix use of expanders module-predefined?
Closes #2278
2018-09-22 18:34:43 -06:00
Matthew Flatt
d06f6e7c4e cs: offer compiler-pass statistics
When `PLT_LINKLET_TIMES` is set, enable pass timing and report
a simple summary along with other times.
2018-09-22 18:34:43 -06:00
Paulo Matos
48302284a8 Avoid shift by negative number by turning condition around
Avoid undefined behaviour in condition which could shift by negative i. By checking first if `i >= 0` we avoid that case.
2018-09-22 14:19:10 -06:00
Paulo Matos
49d31414b7 Fix condition to avoid undef behaviour
Coverity scan uncovered an issue where by if `p == 31`, the following shift `1 << (p + 1)` will cause undefined behaviour.
2018-09-21 09:02:25 -06:00
Ryan Culpepper
0ceb67ebc6 openssl: guard default cert location setup with libcrypto check
Commit dc8a2ca6 removed the check, which caused problems
when libcrypto.so is not found.
2018-09-17 15:51:58 +02:00
Ben Greenman
710cbd25bf stream*: allow 1 argument 2018-09-16 21:21:06 -04:00
Ryan Culpepper
2670a932f8 fix bugs caught by optimizer etc warnings 2018-09-15 21:05:04 +02:00
Alexis King
c0788127ae Make cond track disappeared-uses for => and else 2018-09-13 13:15:34 -05:00
Matthew Flatt
d5aa191fb2 custom-hash: fix ephemeron race
The pattern

  (ephemeron-value
   (hash-ref! intern key
     (lambda ()
       (make-ephemeron key (wrap key)))))

is wrong, because a GC might happen between the time that the
epehemeron is found in the table (or the time that the key was just
added to the table) and the time that `ephemeron-value` is called to
extract the value. If the key is not otherwise accessible, the value
may no longer be in the ephemeron.
2018-09-13 11:11:27 -06:00
Matthew Flatt
9772c05040 cs: fix more problems with GC in an arbitrary Scheme thread 2018-09-13 10:48:26 -06:00
Matthew Flatt
4a763c72d0 cs: repairs for Windows build 2018-09-13 10:48:26 -06:00
Matthew Flatt
2a053caa1a makefile: always make automatic checkout of Chez Scheme
If `make cs` is run without specifying a SCHEME_SRC, then make sure
that `configure` and `make` are re-run in the Chez Scheme checkout,
in case it was updated.
2018-09-13 10:48:26 -06:00
Matthew Flatt
287157cc6d cs: _stdcall for Windows -> __stdcall for Windows x86 2018-09-13 10:48:26 -06:00
Matthew Flatt
2e8e479a52 thread & io: makefile repairs to work with nmake 2018-09-13 10:48:26 -06:00
shhyou
40b8ae7a33 Coerce the arg in contract-random-generate/choose 2018-09-13 10:48:43 -05:00
Matthew Flatt
efd601cb51 cs: avoid thread misuse during GC
A collection can only invoke certain callabcks (e.g., for DrRacket's
GC icon) when the collection is performed in the main thread. Also,
delay posting GC logging events to receivers that cannot work at
interrupt time.
2018-09-13 06:05:58 -06:00
Alexis King
6b56156d55 Revert "Allow local-expand to opt-out of implicit extension of the stop list"
This reverts commit 41fd4f3a5e.

The problems this change was intended to solve can be solved in other
ways, without loosening guarantees about expansion order. See the
discussion in #2154 for more details.

closes #2154
2018-09-12 15:06:33 -05:00
Ryan Culpepper
5be4109495 openssl: change dummy path name to avoid spaces 2018-09-12 15:32:03 +02:00
Ryan Culpepper
fc19d75b40 openssl: add workaround for natipkg openssl lib cert locations
Reference: https://www.happyassassin.net/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
2018-09-12 15:32:03 +02:00
Ryan Culpepper
dc8a2ca6ec openssl: log error if no existing cert locations
This may help with situations like #1919 and #2184.
2018-09-12 15:32:03 +02:00
Matthew Flatt
b2e4d51b1b raco setup: fix problem with processes-based build
The procsses-based build was technically broken with the addition of a
"prefetch" thread (some time back) to improve parallelism, because the
`write`-based implementation of messages did not protect again
interleaving by different threads. The problem turns out to be easier
to expose when running with RacketCS.
2018-09-12 06:17:47 -06:00
Matthew Flatt
fd730a6772 raco setup: add --places and --processes flags
Provide access to subprocess-based parallel builds even when places
are available.
2018-09-11 19:08:59 -06:00
shhyou
dabbfed09f Randomly shuffle contracts in contract-exercise 2018-09-11 16:15:24 -05:00
Matthew Flatt
9cf9be60b0 io: fix retention of blocked log receiver
Don't GC a log receiver that is blocked on a logger that
might receiver relevant events.
2018-09-11 12:15:07 -06:00
Matthew Flatt
862c05d64a thread & cs: fix place bugs 2018-09-11 09:55:11 -06:00
Matthew Flatt
30fb62e438 cs: add sanity check for proper callbacks during blocking callouts 2018-09-11 09:55:11 -06:00
Matthew Flatt
2e7d608fb3 native-libs: update openssl build, especially for natipkg
Record a recoganizable dummy path as the default location for
certificates.
2018-09-11 08:39:52 -06:00
Matthew Flatt
0e2ad7d596 raco pkg: change --scope-dir search-path handling
Formerly, `--scope-dir` would include only the specified directory in
the search path for already installed packages, etc., which means that
it would only work right as a kind of installation scope that is a
step beyond "installation" on the "user"-to-"installation" spectrum.
The `'pkgs-search-dirs` confiugration entry, meanwhile, provides more
control over search ordering in installation scope. Make `--scope-dir`
work more consistently with that search-path configration.

This change also makes "instllation"-scope operations use the search
path more consistently, since some actions used to use the whole
search list while others pruned any prefix before the main
installation directory in the search list.
2018-09-10 06:14:34 -06:00
Matthew Flatt
292dac4e51 cify: repair for big-endian platforms
Relevant to #2018
2018-09-09 14:01:09 -06:00
Matthew Flatt
138e6c11c0 ffi/objc: add with-blocking-tell
Add a way to declare an Objective-C method call as blocking in the
sense of the `#:blocking?` argument to `_cprocedure`.

Usingf `with-blocking-tell` should allow the Cocoa backend for
`racket/gui` to wait for events in the main place without blocking
other places.
2018-09-09 11:56:26 -06:00
Matthew Flatt
9776e4cd8e cs: fully enable places
Fix various problems with the implementation of places, and let
`processor-count` return the actual number of processors. A parallel
build via `raco setup` seems to work but not scale well.
2018-09-09 11:33:33 -06:00
Matthew Flatt
bf9a5f2730 move processor-count core to rktio
Also, repair various problems with places in RacketCS, but make
`(processor-count)` still return 1 for now, since there are still
problems.
2018-09-08 18:59:10 -06:00
Matthew Flatt
3b0336a30a rktio: make fd transfer across rktio_ts explicit
Instead of defining `rktio_fd_t` to be independent of a `rktio_t`,
which isnt quite true, introduce `rktio_fd_detach` and
`rktio_fd_attach` functions to make a transfer explicit, such as when
a file descriptor goes through a place channel.

This adjustment avoids a corner case in cleaning up a file descriptor
from an abandoned channel, where the finalizer might run in a Chez
Scheme thread that is not associated with any place.
2018-09-08 15:57:34 -06:00
Matthew Flatt
ef72554fe4 cs & io: fix potential file-descriptor leak
If a file descriptor is in a place channel message that is never
received and the channel becomes inaccessible, finalize the place
channel.
2018-09-08 13:31:11 -06:00
Matthew Flatt
cd9071cb9b bytecode optimizer: fix inlining bug
When a single-use function is inlined late enough in the optimization
process, and when the body has the only use of some variable computed
by an expression that can be move in place of the use in the inlined
function (but not in the non-inlined function), then it's a problem if
the function binding isn't pruned away early enough. Make sure the
binding to the function is marked as unused after the function is
inlined.

This bug was exposed by a recent change to the "dssl2" package.
2018-09-05 20:33:05 -06:00
Matthew Flatt
66b624e8ca byte compiler: unsafe-make-place-local should not fold 2018-09-05 16:11:12 -06:00
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
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
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
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
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 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
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
Matthew Flatt
1cf6ab7102 places and GC: avoid race in out-of-memory handling
Make the out-of-memory handler thread-local, so that places
don't interfere with each other when setting the handler.
2018-08-16 20:56:08 -06:00
Matthew Flatt
570aa5737d cs: fix missing stack trace frames 2018-08-16 20:56:08 -06:00
Matthew Flatt
9704cc4731 add syntax-binding-set functions
The `syntax-binding-set` functions enable explicit construction of
lexical information for a syntax objects.
2018-08-15 10:34:33 -06:00
Matthew Flatt
9658c723db more consistent expander/linklet performance-logging output 2018-08-15 07:41:48 -06:00
Matthew Flatt
facba8a6ab unbreak cify on "startup.inc"
Commit 7cbeebbb89 broke the input to cify, and eb73837baf uncovered a
different problem.
2018-08-14 20:29:32 -06:00
Matthew Flatt
a25efeb8a9 thread & io: performance improvement
Part of this change restores a `++direct` that was lost in 98ae91e0ba
for "racket/src/thread" to make the atomicity state a virtual
register. Also make `display` on a byte string more directly call
`write-bytes`. That change restores a 5-10% speed improvement for
`racketcs -cl racket/base`.
2018-08-14 19:35:00 -06:00
Matthew Flatt
a58d115bf2 fix problem with parameter impersonator
Closes #2228
2018-08-14 12:27:33 -07:00
Matthew Flatt
bbde12991c cs: faster continuation trace
Reduce the cost of getting a source backtrace for a continuation mark
set (especially as recorded in an exception).
2018-08-14 06:59:51 -07:00
Matthew Flatt
eb73837baf expander: enable performance measurements permanently
Change the expander-performance macro so that it's a very low cost if
not enabled on startup. An extra JIT specialization reduces the cost
further, since the enabled state is known by JIT time.
2018-08-12 11:05:20 -06:00
Matthew Flatt
7cbeebbb89 linklet flattener: repair to name simplifier
The linklet flattener's name-simplification pass (intended to avoid
gratuitious changes in "startup.inc") didn't recognize all binding
forms.
2018-08-12 08:50:35 -06:00
Matthew Flatt
4a7c4d184c optimizer: don't drop application when argument count is wrong
Guard some ad hoc optimizations with an arity check in the cases of 1
or 2 arguments.

Closes #2222
2018-08-11 17:28:11 -06:00
Matthew Flatt
305d02f46a OpenBSD: constrain W^X-by-signal to x86_64
Closes #2214
2018-08-11 16:40:09 -06:00
Matthew Flatt
89583a4d03 fix inexact->exact on subnormal single-flonums and extflonums
Closes #2223
2018-08-11 16:23:31 -06:00
Matthew Flatt
cf396064c3 places and GC: subtarct terminated place's memory use
When a child place terminates, the parent's count of the child's
memory use needs to be updated. Until this repair, the
`current-memory-use` function has been reporting an incorrectly large
number after a place terminates.
2018-08-11 09:50:49 -06:00
Ryan Culpepper
15186ff41c syntax/parse: fix struct match patterns with wrong number of subpatterns 2018-08-10 18:04:56 +02:00
Ryan Culpepper
31519f827a syntax/parse: fix fixup of and pattern with head subpatterns 2018-08-10 18:04:56 +02:00
Matthew Flatt
0d1f4e3c63 unbreak no-JIT build 2018-08-10 09:59:15 -06:00
Matthew Flatt
c05b9409d5 procedure-arity: fix bug in non-JIT mode
The arity calculation for a `case-lambda` as a `prop:procedure`
argument did not drop the self argument as it should.
2018-08-10 09:11:17 -06:00
Matthew Flatt
696e9143a6 expander: declare readtable structure as #:authentic 2018-08-10 09:10:55 -06:00
Matthew Flatt
b533a13d20 JIT code accounting: add count of procedures
Extends ac601a095b.
2018-08-10 05:06:36 -06:00
Matthew Flatt
59d505c157 JIT: tweak unsafe references
Use a constant offset directly instead of loading into a register
for unsafe vector, struct, etc., access.
2018-08-10 05:06:36 -06:00
Matthew Flatt
7efff33831 JIT: tweak to avoid register reload on some branches 2018-08-10 05:06:36 -06:00
Matthew Flatt
fac3c6fbc6 cify repairs
Fix liveness for "simple" arguments to inlined functions. Fix
handling of non-authrntic structure access and mutation to
allow the possibility of a GC.
2018-08-10 05:06:36 -06:00
Ryan Culpepper
3dd402937b syntax/parse: fix var:literal pattern, closes #2225 2018-08-10 00:09:07 +02:00
Alexis King
d1b8ecb3e0 Make curry properly support functions with keyword arguments
Also, while we're at it, make the functions produced by curry cooperate
better with other parts of Racket. Namely, make the information reported
by procedure-arity and procedure-keywords accurate, and give procedures
more useful dynamic names.
2018-08-09 15:35:49 -05:00
Matthew Flatt
ecbd6f1578 add procedure-arity-mask and procedure-reduce-arity-mask
The mask encoding of an arity is often easier to test and manipulate,
and masked-based functions are sometimes faster than functions that
used the old arity representation (while always being at least as
fast).

Attempting to assign an arity like `(expt 2 100)` to `(lambda x x)`
won't work anymore; it will raise an out-of-memory exception, because
the arity is represented internally as a mask. The arities that cannot
be represented aren't sensible arities, anyway.
2018-08-09 10:11:41 -06:00
Matthew Flatt
36204b00ca improve procedure-{reduce-arity,rename} performance
The main performance improvement is in calling a function returned by
`procedure-{reduce-arity,rename}` when the arity is not a single
integer. Calls to functions with > 29 arguments can be worse, but
that seems like a much rarer case.
2018-08-09 10:11:41 -06:00
Matthew Flatt
d3a8834f75 cs: improve procedure-{reduce-arity,rename} 2018-08-09 10:11:41 -06:00
Matthew Flatt
ac601a095b add PLT_EAGER_JIT to force JIT on linklet instantiation
Forcing JIT code generation through an environment variable is useful
to get a sense of how much machine code is generated for a program.
Setting `PLT_LINKLET_TIMES` causes the overall memory used by
JIT-generated code (including adminstrative overhead) to be printed on
exit.
2018-08-09 10:11:41 -06:00
Matthew Flatt
3e9196ab5c cs: convert Rumble though expander to boot file
Loading as a boot file saves time later on major GCs.
2018-08-09 10:11:41 -06:00
Matthew Flatt
f2a7405dda syntax/moddep: DAG repair and #:show argument 2018-08-09 10:11:40 -06:00
Ryan Culpepper
088f72c8c5 syntax/parse: parse syntax-class patterns just once; closes #2164
In pass 1, syntax class defns (without #:attributes decl) need to parse
patterns to determine exported attributes. But to allow forward refs,
stxclass references are not resolved until pass 2.

Previously, this was done by just reparsing patterns in pass 2. But that
means pattern expanders get expanded twice, and their expansions might
not agree (eg generate-temporaries). So instead, parse in pass 1, insert
"fixup" patterns to delay stxclass resolution, and resolve fixups in pass 2.
Complication: a fixup pattern is assumed S, but can change to H in pass 2.
2018-08-09 14:37:33 +02:00
Ryan Culpepper
dbfb1e2fe8 syntax/parse: add datum-to-expression helper 2018-08-09 14:37:33 +02:00
Ryan Culpepper
d950049c5a syntax/parse: trim internal provides 2018-08-09 14:37:33 +02:00
Ryan Culpepper
8a4bab5c3e minimatch: add match-lambda 2018-08-09 14:37:33 +02:00
Ryan Culpepper
34e7c8f556 syntax/parse: only collect attrs with interned names 2018-08-09 14:37:33 +02:00
shhyou
0c8c643989 Fix default fallback for contract-struct-generate
The actual problem is that build-chaperone-contract-property
exported to the user defaults #:exercise and #:generate
to false. This commit changes the default fallback value
in the case where #:generate is not a procedure instead
of changing build-chaperone-contract-property directly
to stay consistent with the how contract-struct-exercise
currently does it.
2018-08-08 12:51:14 -05:00
shhyou
aeab2420fa Fix default contract generation and exercise proc
The default values updated in commit ffc5720b5 do
not work for very subtle reasons. In build-contract
in racket/contract/private/prop, the default values
should not accept an extra ctc argument since ctc
is already handled by make-flat-contract. The
default gen procedure should also be (λ (fuel) #f)
instead of (λ (ctc) (λ () #f)) since the latter
would generate false when the generation should
have failed. In build-property, the default procedure
(λ (ctc) (λ (fuel) #f)) is correct and should not
be changed to (λ (ctc) (λ () #f)).
2018-08-08 12:51:14 -05:00
shhyou
43b0cd4a7e Initialize fail-escape in contract-exercise
Some exercise procedure might invoke
contract-random-generate/choose, therefore
fail-escape needs to be initialized.
2018-08-07 10:06:28 -05:00
Matthew Flatt
5ba910d143 read-bytes!: avoid integer overflow in read size
Closes #2211
2018-08-06 20:43:04 -06:00
shuhung
b4e44e71a9 Export contract-random-generate-env? 2018-08-06 12:55:38 -05:00
Ben Greenman
2ef8d60cc6
improve hash-ref error message for non-thunk failure procedure (#2204)
Improve the `hash-ref` error message when the failure result does not
accept zero arguments. (This only changes what the error messages says.)

Example:
```(hash-ref #hash() 'a add1)```

Old message:
```
; add1: arity mismatch;
;  the expected number of arguments does not match the given number
;   expected: 1
;   given: 0
```

New message:
```
; hash-ref: contract violation
;   expected: (-> any)
;   given: #<procedure:add1>
;   argument position: 3rd
```
2018-08-05 23:53:49 -04:00
Philip McGrath
3e6846a8d9 typo: "unintialized" -> "uninitialized" (#2209) 2018-08-05 23:53:21 -04:00
Matthias Felleisen
8deaa4cf91
fixing bad error message for assf
The old error message requested a function of 2 arguments while the quasi-contract demands one of 1 argument.
2018-08-05 17:48:17 -04:00
Matthew Flatt
582e85adf7 support Visual Studio 2017
Requires the Windows 8 SDK for now, I think.
2018-08-05 13:44:48 -07:00
Matthew Flatt
df67d4e9d1 expander: fix problem with define shadowing require
When a `define` that shadows a `require` appears before the `require`,
then the `require` may fail to other, non-shadowed bindings from the
same `require` spec.

Thanks to Matthias for reporting the problem.
2018-08-05 13:46:38 -06:00
shhyou
33b94e6558 Exercise application result in -> contract 2018-08-05 12:57:32 -05:00
Matthew Flatt
d8ea41df23 cs: fix malloc argument parsing
Closes #2207
2018-08-03 06:58:15 -06:00
Robby Findler
258160707f use slightly better language so it makes sense with the swapping that
the error messages do based on positive/negative

inspired by #2205
2018-08-02 13:34:22 -05:00
Alex Knauth
6cc3a2f960
fix typo, stream-empty? -> set-empty? (#2191)
* fix typo, stream-empty? -> set-empty?

* add a regression test for the set->stream fallback
2018-08-01 13:14:05 -04:00
Matthew Flatt
b7392a688e hash-iterate-value & co.: add an optional bad-index result
The new argument to `hash-iterate-value` and most other
`...-hash-iterate-...` functions determines a result to be returned in
place of raising a "bad index" exception.

For most kinds of hash tables, a "bad index" exception will only
happen when the provided index is wrong or when a hash table is
mutated during an iteration. Mutation during iteration is generally a
bad idea, but in the case of a weak hash table, a potential background
mutation by the garbage collector is difficult to suppress or ignore.
Adding an option to control bad-index behavior makes it easier to
write loops that defend against uncooperative tables, including loops
where a hash-table key disappears asynchronously.

Racket's printer was already using this functionality internally, so
the change to `hash-iterate-value` and company mostly exposes existing
functionality.

The `in-hash` form and related sequence constructors similarly support
a bad-index alternate value so iterations can handle that case
explicitly. They do not use the new bad-index support implicitly to
skip missing entries, because that idea does not play well with the
iteration API. A hash-table index can go bad after `in-hash` has
selected the index and determined that it should be used for the next
iteration, and a sequence can't take back that decision.
2018-07-31 10:14:07 -06:00
Matthew Flatt
5526113311 cs: fix some problems with hash tables
In part, the corrections rely on a new `hashtable-cells` procedure
in Chez Scheme.
2018-07-30 17:37:23 -06:00
Matthew Flatt
fcd84113c8 cs: fix impersonator-property accessor failure modes 2018-07-30 07:46:57 -06:00
Matthew Flatt
bb4e7df1c6 cs: fix case of vector-copy! 2018-07-30 07:34:36 -06:00
Matthew Flatt
810d6da3c8 cs: unbreak continuation-mark chaperones 2018-07-30 07:02:59 -06:00
Matthew Flatt
d9ec0705cf add ffi/unsafe/collect-callback
The `ffi/unsafe/collect-callback` library exposes functionality
formerly only available via Racket's C interface, but implement
it for both Racket and RacketCs.
2018-07-29 13:32:44 -06:00
Matthew Flatt
f8297f9c00 thread: fix resume of suspended sync 2018-07-29 09:59:12 -06:00
Matthew Flatt
e066bb44ea repair uninterrupted-exit on continuation application 2018-07-29 07:18:27 -06:00
Matthew Flatt
1b716d5d32 schemify: fix inlining issues
Make `map` inline again, which involves optimizing away

 (variable-reference-from-unsafe? (#%variable-reference))

early enough. Fix post-schemify optimization for `procedure?
by adding both forms of an import name to the `imports` table.
Fix a problem with inlining operations passed to an inlined
function (as reflected by the addition of `find-known+import`).
2018-07-28 15:07:37 -06:00
Matthew Flatt
a447b5bf6b expander: improve some errors at phase >= 1
At phase 1 and higher, the expander tentatively allows an unbound
identifier so that, for example, `define-for-syntax` can define a
helper function syntactically after a compile-time expression that
uses the helper. While unbound references eventually trigger an error,
the reordering can be consuing, as in the example

  #lang racket

  (define-syntax (f stx)
    (syntax-parse stx
      [(_ oops) #'ok]))

which complains about `_` when the real problem is that `syntax-parse`
isn't imported.

To provide better errors, `raise-syntax-error` now implicitly extends
an error message to include a list of previously encountered unbound
identifiersin the current compilation unit. That list will be
non-empty only at phase >= 1. With that change, the error message for the
above example is

 bad.rkt:5:5: _: wildcard not allowed as an expression
  after encountering unbound identifier (which is possibly the real problem):
   syntax-parse
  in: (_ oops)
  ....

Closes #2167
2018-07-27 12:29:59 -06:00
Matthew Flatt
031564b28c expander extract: add --local-rename to minimize startup diffs
The expander's output normally uses a distinct symbolic name for every
distinct binding within a linklet. That property is useful for
consumers like schemify, but it's counterproductive for minimizing the
diff in changes to "startup.inc", since the traditional Racket
compiler doesn't need that guarantee. Use `--local-rename` to generate
"startup.inc", which should make future diffs smaller and more
composable after changes to the expander.
2018-07-27 12:29:59 -06:00
Matthew Flatt
0b9a7587f6 expander/flatten: better help, error reporting, and - mode for ++knot 2018-07-25 21:27:36 -06:00
Matthew Flatt
a41f58f9d7 cs: use call-setting-continuation-attachment 2018-07-25 19:32:29 -06:00
Matthew Flatt
60977b36c7 cs: remove useless call in delimiting continuations 2018-07-25 16:28:07 -06:00
myfreeweb
c7c4efca95 Add FreeBSD/aarch64 platform 2018-07-24 13:14:22 -06:00
Ben Greenman
e97717ef2b pkg new: clarify 'module+ main' and 'module+ test' purpose
- edit the comments, thanks to John B Clements and Alex Gian and Alex McLin
  and Phil McGrath
- add simple example code
2018-07-22 00:23:33 -04:00
Leif Andersen
eaaede9c2c
Fix fasl bug in Racket 7.0 beta! (#2178)
* Fix fasl bug in Racket 7.0 beta

The following program causes racket to error in Racket 7.

(parameterize ([current-write-relative-directory (build-path "/" "a")])
  (s-exp->fasl (build-path "/")))

This bug appears to have been introduced in Racket 7, and not in
Racket 6.x.

* Fix another bug where 'same was put through path-element->bytes

* "/" => (car (root-paths-list))

This is for windows where simply "/" is not a complete path.

* Add similar tests to serialize library.

* Better error message when relative-directory is a bad pair

Before it would give an internal list-tail error, now it returns
a proper bad argument error.

* Better tests, and improved common case
2018-07-21 14:46:44 -04:00
Gustavo Massaccesi
ebb7c0ea82 cs: fix mark-table-prune
Fix the case when the list of marks to remove is empty,
and also change the order of the arguments.
2018-07-20 17:50:24 -03:00
Ben Greenman
859ead9cc3 fix random-ref error message
For an empty sequence, print a message in terms of random-ref

Also, change all error messages to show all arguments
2018-07-20 12:11:34 -04:00
Matthew Flatt
a1e928350b foreign-call lock: repair for use during place termination
Now that `ffi/unsafe/alloc` deallocations are triggered by a place
exit, it's more likely that an ffi-call lock can be contended during a
place's termination. When that happens, the place cannot cooperate as
usual. Accomodate this rare situation by spinning.
2018-07-20 08:34:12 -06:00
Matthew Flatt
b40fdb7dd7 rktio: fix signal mask for subprocesses
... by making `centralized_unblock_child_signal` actually unblock SIGCHLD.

Closes #2176
2018-07-20 06:50:45 -06:00
Matthew Flatt
e2435d7187 expander: different repair for race
The repair in 49a90ba75e reorders two lines in a way that, in
retrospect, seems worrying. I can't construct an example that goes
wrong, so maybe it's fine, but it seems possible (now or with some
future change) that attempting to visit available modules could lead
to the same attempt in the same thread and therefore a loop.

This commit changes the repair to just always take the lock instead of
fixing up the attempted shortcut. There's a tiny extra cost to always
taking the lock, but that extra cost seems like a better choice
overall.
2018-07-18 13:48:34 -06:00
Matthew Flatt
49a90ba75e expander: repair a race condition related to "available" modules
Fix a broken use of a lock intended to prevent threads from
conflicting while forcing "available" modules to "visited" module.
2018-07-18 10:42:27 -06:00
Matthew Flatt
d3a5006721 fix typos in configure help 2018-07-18 09:54:29 -06:00
Matthew Flatt
3c95034a90 thread: don't always convert end-atomic to a thread swap
If interrupts are disabled to prevent thread swaps, then don't react
to `end-atomic` by performing a deferred swap. That might happen
with logger callbacks after a GC where a deferred action was
overlooked due to a rare race condition.
2018-07-17 16:23:17 -06:00
Matthew Flatt
e1c2e5d4f4 cs: make "main.sps" work in script or boot mode
Now that Chez Scheme supports libraries in boot files, make
"racket.so" work when it is converted to a boot file. Loading it as a
boot file can save around 20ms on every major GC, since the
"racket.so" code will be in the static generation.

For now, however, `racketcs` is not set up to use "racket.so" in boot
form.
2018-07-17 09:51:20 -06:00
Matthew Flatt
d67cec6892 cs: switch to __collect_safe
Sync with current ChezScheme (plus PRs), which involves changing
`__thread` FFI directives to `__collect_safe`.
2018-07-17 09:18:56 -06:00
Leif Andersen
91d059c817
Relative paths should still be readable. (#2172)
* Relative paths should still be readable.

The resent PR to enable relative serialization resulted in serialzed
objects that weren't actually readable (containing literal path
elements). This PR converts them to bytes.

* Move from serialize to relative path.

Also change path->bytes to path-element->bytes

* Path elements can also be 'up and 'same.

Also merge in the relevant code from racket/fasl.
2018-07-16 18:45:47 -04:00
Matthew Flatt
5fd23b18e5 repair no-executables assemble-distribution on Windows
Repairs a problem with `raco c-tool --c-mods <file> --runtime <dir>`
as reported by Dmitry Pavlov.
2018-07-16 15:59:31 -06:00
Matthew Flatt
652a0ad0d1 racket/serialize: refinements for relative paths
Allow selection of relative-path encoding for paths in data independent
of whether deserializer module paths are recorded as relative.
2018-07-15 12:22:16 -06:00
Matthew Flatt
c2c04711a3 cs: change continuation-frame marks table
Use an association list instead of an eq hashtable. This choice is
compatible with assumptions in traditional Racket (i.e., that the
number of mark keys per continuation frame will be small) and cuts
about 1/4 of the time in a benchmark like

 (define f
   ((contract (-> (-> integer? integer?))
              (λ () values)
              'pos 'neg)))

 (time
  (for ([x (in-range 1000000)])
    (f x)))
2018-07-15 06:26:40 -06:00
Leif Andersen
99fff46726
Add procedure? as an acceptable type for prop:serialize's deserialize binder. (#2168)
* Add allow the binder in prop:serialize to be a procedure.

This procedure is evaluated at serialize time, and is useful if
the deserializer is not known during object-type creation time,
but is during serialize time.

* Add docs+tests.

* Add a history note.
2018-07-13 13:49:29 -04:00
Leif Andersen
090eed4b28
Add option to create relative paths for 'serialize' (#2166)
* Add option to create relative paths for 'serialize'

Serialize would previously always create complete byte-string paths.
This adds an optional parameter to serialize (#:relative-to) to enable
relative path creation.

Now when deserialize finds a relative path, it resolves it with
respect to `current-load-relative-directory`.

* Moved fasl's path<->relative-path-elements functions

I moved it into the private/relative-path module, so that serialize
can make use of it.

* Update serialize to use relative-path.

* Add tests.

* And update docs.
2018-07-12 09:12:48 -04:00
Matthew Flatt
80e353c143 expander: fix order of unbound-identifier compilants at phase > 0
Closes #2167
2018-07-11 04:25:43 -06:00
Matthew Flatt
7bfe967e87 racket/fasl: repair for pair current-write-relative-directory 2018-07-09 15:54:55 -06:00
Matthew Flatt
8411b403e5 improve linklet performance-logging report 2018-07-09 15:54:55 -06:00
Matthew Flatt
41402ac783 expander: small code improvement 2018-07-09 15:54:55 -06:00
Matthew Flatt
b27ca8c6a9 expander: fix tracking of submodule base scopes
When expanding a `(module* _name #f ...)` submodule, accumulate all
module scopes on the `#f` and use the `#f` for a reexpansion.
Attempting to start each time from the enclosing module's scope loses
scopes that were generated from previous expansions. One consequence
of losind a scope is that an original definition may appear to be
macro-introduced, and the defined variable may become inaccessible
in the module's namespace.
2018-07-05 19:59:15 -06:00
Matthew Flatt
6a1232ee5a io: repairs 2018-07-03 17:26:38 -06:00
Matthew Flatt
d26517b49b thread: add missing end-atomic 2018-07-03 13:43:25 -06:00
Matthew Flatt
89db60abc9 cs: fix exit status on error
Also, fix some error messages in non-CS Racket, and add a
clarification on exit status in the Reference.
2018-07-03 10:56:23 -06:00
Matthew Flatt
99cf003d98 cs: store code as uncompressed by default
Leaving code uncompressed makes it about 5 times as large on disk, but
it loads about twice as fast.
2018-07-02 18:29:44 -06:00
Robby Findler
ffc5720b51 fix default proc for contract generation
closes racket/typed-racket#751
2018-07-02 07:11:35 -10:00
Matthew Flatt
a2f1f11f9b cs: fix PLT_LINKLET_TIMES mode Racket-thread safety 2018-07-02 07:20:44 -06:00
Matthew Flatt
eea40a6350 cs: cache foriegn call and callable wrappers
Generating the code for a `_fun` type takes hundreds ot thousands
of times as long as in the traditional Racket VM, to cache results
to reduce the cost.
2018-07-01 20:53:59 -06:00
Matthew Flatt
a1098bdb46 cs: repairs to variable-reference-constant?
Further correct the implementation of `variable-reference-constant?`
on bindings to primitive variable.

This repair affects method-call ctype caching in `ffi/unsafe/objc`.
Add some logging there to make problems easier to detect. Also,
add and improve linklet-evel performance logging for comparing
the traditional Racket VM to Racket-on-Chez.
2018-07-01 17:03:47 -06:00
Matthew Flatt
0f32765fe4 expander: fix variable-reference-constant? on primitive
When setting up the namespaces that imitate primitive instances,
the "constant" annotation wasn't set. The v6.x expander gets this
wrong, too, for different reasons.
2018-07-01 07:40:52 -06:00
Matthew Flatt
d5bb22c2d9 cs: improve #%variable-reference-constant?
Repair constant detection for unmodified imports.
2018-06-30 20:32:01 -06:00
Matthew Flatt
64b2694986 jitify: reduce unnecessary variable indirections 2018-06-30 14:11:45 -06:00
Matthew Flatt
bff5989cde cs: inline struct accessors/mutators across compilation units
Make schemify inline structure accessors and mutators across linklet
boundaries --- or, in JIT mode, across function boundaries --- by
replacing an accessor or mutator with a `#%record?` test and
`unsafe-struct*-{ref,set!}` operation.
2018-06-30 13:02:35 -06:00
Matthew Flatt
0f1088a150 cs: add cache for JIT mode
When linklets are compiled in JIT mode and a called procedure is to be
compiled on demand, consult a cache of compiled fragments (by default,
"jit.sqlite" in the addons directory) and either use an existing
compiled fragment or add to the cache after compiling.

Results for this initial implementation suggests that the idea is
workable. With the cache, starting a JIT-mode program a second time is
almost as fast as non-JIT mode (i.e., directly loading machine code).

Some refinements are needed: limiting the size of the JIT-fragment
cache, better contention handling, and better inlining of structure
operations in JIT mode (which may be useful to cross-linklet
optimization in non-JIT mode, too).
2018-06-29 11:04:16 -06:00
Matthew Flatt
fc7c4bb42c repairs for srcloc-marshaling change
Handle "." and ".." as one of the last two elements of a path.
2018-06-27 17:21:03 -06:00
Matthew Flatt
caf1b2e275 avoid a compiler warning 2018-06-27 16:08:14 -06:00
Matthew Flatt
9e6f450005 unbreak startup cifiy
Should have been part of ec036a0f5f.
2018-06-27 07:23:51 -06:00
Matthew Flatt
5b8aa67ea4 Windows: project and other repairs for rktio changes
Should have been part of cda4e5befe.
2018-06-27 06:48:22 -06:00
Matthew Flatt
b13f723ac6 serialize srclocs in bytecode; change expander to keep srclocs
To avoid recording absolute paths from a build environment in bytecode
files, the bytecode writer converts paths to relative form based on
`current-write-relative-directory`. For paths that cannot be made
relative in that way and that are in source locations in syntax
objects, the printer in v6.x converted those paths to strings that
drop most of the path.

The v7 expander serializes syntax objects as part of `compile` instead
of `write`, so it can't truncate paths in the traditional way. To help
out the expander, the core `write` function for compiled code now
allows `srcloc` values --- as long as the source field is a path,
string, byte string, symbol, or #f. (Constraining the source field
avoids various problems, including problems that could be created by
cyclic values.) As the core `write` for compiled code prints a path,
it truncates a source path in the traditional way.

The expander doesn't constrain source locations in syntax objects to
have path, string, etc., source values. It can serialize syntax
objects with non-path source values at `compile` time, so there's no
loss of functionality.

The end result is to fix abolute paths that were getting stored in the
bytecode for compiled packages, since that's no good for installing
packages in built form (which happens, for example, during a
distribution build).
2018-06-27 06:36:20 -06:00
Matthew Flatt
cda4e5befe add sha1-bytes, sha224-bytes, and sha256-bytes via rktio
Although SHA-1 hashing functions are available from `openssl`
libraries, a fast crytopgraphic hash is useful for many purposes below
the layer where the OpenSSL library has been opened. And SHA-1 is
reasonably easy to add to rktio.

Meanwhile, provide an equally convenient SHA-2 function to discourage
bad security practices (i.e., using SHA-1 where SHA-2 should be
preferred).
2018-06-27 06:36:20 -06:00
Matthew Flatt
d72b70f8e1 schemify: speed up jitify a little 2018-06-27 06:36:20 -06:00
Matthew Flatt
ec036a0f5f schemify: remove reannotate arguments
Passing them in instead of direct access to `datum->correlated` was a
holdover from the old setup that schemified directly to annotations.
2018-06-27 06:36:20 -06:00
Matthias Felleisen
5bb837661c for #2058, issue discovered by Sam 2018-06-25 14:06:48 -04:00
Matthew Flatt
a6e6bc0ebd cs: make JIT mode generate non-nested fragments
Applying jitify to a linklet now generates fragments of code that
are not nested. The drawback of this approach is that calling
a nested function needs an extra indirection, and the closure
has an extra slot. The advantage is that the fragments can be
separately compiled and fasled, which could enable a cache of
compiled fragments.
2018-06-22 15:57:50 -06:00
Matthew Flatt
4fa8a9870d cs: report file for bad-version errors 2018-06-22 13:39:08 -06:00
Matthew Flatt
00b9acdac3 cs: fix procedure names
Use a `(let ([<name> ....]) <name>)` wrapper to communicate
an 'inferred-name property from correlated objects to
Chez Scheme. This stategy relies on a Chez Scheme patch to
make the wrapper work consistently.
2018-06-22 12:32:17 -06:00
Matthew Flatt
cf0b38aee9 cs: drop unused correlation early
The improvements reported in 74012f8c57 were actually due to a broken
experiment that dropped source locations on application forms, instead
of preserving them in marshaled code. Adjust the expansion pipeline
to do that earlier and intentionally.

The xify pas doesn't help all that much after all, but it's still more
comfortable to be independent of local-variable names.
2018-06-22 11:04:00 -06:00
Matthew Flatt
74012f8c57 cs: add xify pass for JIT mode
The xify pass replaces local variable names with `x0`, `x1`, etc.
Using a minimal set of symbols makes the fasled form smaller
and typically take only 60-70% as long to read.
2018-06-22 09:57:50 -06:00
Matthew Flatt
d8832723e9 expander: fix corner for syntax-debug-info
Add a missing argument in the implementation of binding traversals for
"all bindings" mode.
2018-06-22 09:57:03 -06:00
Leif Andersen
eb97c7f54e Update deserialize-module-guard. (#2147)
It can now optionally return a pair to redirect the module
that is dynamic-required.
2018-06-22 10:48:12 -04:00
Matthew Flatt
d061970a01 adjust place tests and failure mode
The places test suite included some tests that create lots of places
and don't wait for them, which can lead to an overload of places that
exhausts resources such as file descriptors. Improve the tests, and
also improve a failure behavior from a crash to an error message.
2018-06-21 10:16:02 -06:00
Matthew Flatt
8678fbc90c place-kill: wait for place to finish
The `place-kill` function sends a message to another place to
terminate, but it didn't wait for that message to take
effect before returning. Worse, it put the place object in a
state that claimed that the place had terminated.
2018-06-21 09:00:15 -06:00
Matthew Flatt
d4fc865319 style nit: cond on its own line 2018-06-21 09:00:15 -06:00
Sam Tobin-Hochstadt
b6a3f40bd9 Use a custom implementation of promises.
Saves 43 definitions and 397 lines of (de)compiled code.
2018-06-21 10:37:12 -04:00
Matthew Flatt
f58b99aa74 ffi/unsafe/alloc: add decallocation on place exit
Closes #1830
2018-06-20 16:54:59 -06:00
Matthew Flatt
8fb8d3c936 ffi/unsafe: add _wchar
Closes #1843
2018-06-20 16:54:59 -06:00
Gustavo Massaccesi
6d775e5c5c optimizer: reduce (length '()) ==> 0
This pattern is common in the internal code of the keyword procedures
2018-06-20 17:34:21 -03:00
Matthew Flatt
598a5baf6a JIT: fix miscompilaton of char=?, char<?
When the first subexpression is complex and the second
is a literal character, the generated JIT code swaps the
argument order, but compilation didn't swap the test for
whether one or the other is a literal character to skip
a run-time test.
2018-06-20 13:43:19 -06:00
Matthew Flatt
da41bdf43a syntax/modread: adjust error-message quotes
While we're adjusting error messagaes, change `...' to `...`.
2018-06-19 20:12:01 -06:00
Stephen Chang
8620bc50be clean up check-module-form
- truly ignore expected-module (in err msgs) to match docs
- remove dead code
2018-06-19 20:10:16 -06:00
Paulo Matos
d6fe30156c Fix indentation
Remove tab and add spaces, which is how the rest of the file deals with this.
Avoid a misaligned preview in github editor.
2018-06-19 20:05:35 -06:00
Gustavo Massaccesi
17acb7458b avoid compiler warning in jit 2018-06-19 19:27:35 -06:00
Matthew Flatt
d72ccb521d MzCom: repairs for some Windows configurations
Registration of the typelib seems to be required on some modern
configurations, and myssink must claim to not implement
INoMarshal.
2018-06-19 13:29:19 -06:00
Sam Tobin-Hochstadt
ff867155d1
Add Sarah and Andrew. 2018-06-19 11:25:55 -04:00
AlexKnauth
3996f23879 add src argument to syntax:read-xml
and pass it through into the syntax-source field of the result
2018-06-18 19:52:52 -04:00
Gustavo Massaccesi
9cd3798ca9 schemify: add reduction of (not #f) 2018-06-16 22:44:39 -03:00
Matthew Flatt
96161f68eb fix non-initial call to scheme_basic_env
When an embedding application calls `scheme_basic_env` a
second time, it's supposed to reset the main namespace, but
the new expander wasn't reset correctly.
2018-06-16 15:49:38 -06:00
Matthew Flatt
3c752e008e Racket HISTORY note for v7.0 2018-06-16 09:59:38 -06:00
Matthew Flatt
d3067465e3 setup/unixstyle-install: use delete-directory/files
Use `delete-directory/files` instead of a separate implementation
here to get the special deletion mode for Windows files.
2018-06-16 09:59:38 -06:00
Philip McGrath
5a4ea2cd1b json: small fixes
* Fix handling of single-percision infinities and nan

* Document that non-`hash-eq?` hash tables are accepted by `jsexpr?`.

* Document that the value of `json-null` is recognized using `eq?`

* Use `case` instead of `assoc`.

* Use contracts
2018-06-16 00:42:43 -04:00
Alexis King
41fd4f3a5e Allow local-expand to opt-out of implicit extension of the stop list
Also, adjust the expansion of #%plain-module-begin to reinstate the stop
list after initial partial expansion.
2018-06-15 17:56:52 -05:00
Matthew Flatt
98ae91e0ba expander: repair and further improve flattener
Delay reporting of potential problems until an actual problem
is detected. Correct a mismatch between original and renamed
symbols to restore detection of problems.
2018-06-14 17:27:00 -06:00
Sam Tobin-Hochstadt
62ef3ed1ee Improve flattener. 2018-06-14 14:04:05 -06:00
Matthew Flatt
daa7ddeef8 workarounds for Windows filesystem behavior
* When you delete a file in Windows, then the name doesn't go away
  until the file is closed in all processes (and background tasks like
  search indexing may open files behind your back). Worse, attempting
  to create a new file with the same name reports a permission error,
  not a file-exists error; there's seems to be no way to tell whether
  a permission error was really a file-exists error.

  This creates trouble for `make-temporary-file` when files are
  created, deleted, and created again quickly enough and when
  something like a search indexer runs in the background (which is the
  usual Windows configuration). In practice, that kind of collision
  happens often for `raco setup` on my machine.

  To compensate, make `make-temporary-file` try up to 32 times on a
  permission error. A collision that many times seems extremely
  unlikely, and it seems ok to delay an actual permission error.

  Windows provides a GetTempFileName function from "kernel.dll" that
  must be able to deal with this somehow --- perhaps because it's in
  the kernel --- but it doesn't solve the problem for making temporary
  directories, hence the 32-tries approach for now.

* When a deleted file's name persists because the file is open in some
  process, then a directory containing the file cannot be deleted.

  This creates trouble for `delete-directory/files`, since
  `delete-file` on a directory's content doesn't necessarily make the
  directory empty. In practice, this happens often for package
  upgrades on my machine, where the package system wants to delete a
  short-lived working space that the indexer is trying to scan.

  To compenstate, change `delete-directory/files` to delete a file by
  first moving it to the temporary directory with a fresh name, and
  then delete the file there. It may take a while for a file to
  disappear from the temporary directory, but meanwhile it's not in
  the way of the original enclosing directory.

* When a file is open by any process, it prevents renaming any
  ancestor directory of the file.

  This creates trouble for the package system, which installs a
  package by unpacking it in a temporary place and then moving it by
  renaming. The package system also removes a package by renaming it
  to a subdirectory of a ".trash" directory. If a background indexer
  has a package file open, the move fails. In practice, a move fails
  often on my machine when I'm attempting to upgrade many packages.

  To compensate, make the package system fall back to copy + delete
  if moving fails with a permission error.
2018-06-13 18:57:07 -06:00
Matthew Flatt
09cdbc418c expander: allow rename transformer to primitive in local-expanded
Closes #2119
2018-06-12 19:19:09 -06:00
Matthew Flatt
c7318cab33 expander: fix syntax-local-bind-syntaxes for local-expand
Bind variables in a way that allows `local-expand` (with an empty stop
list) to replace a reference to the binding with one that has the same
scopes as the binding.
2018-06-12 16:23:44 -06:00
Matthew Flatt
380dc42427 expander: fix interaction of expand+eval across namespaces
This repair was motivated by tests in the "rex" package. The
new test added here failed before by finding 'new both times,
but in the "rex" case, the mixup led to the same variable
being imported and exported at the linklet level.
2018-06-12 12:58:56 -06:00
Ben Greenman
cf0c06d810 struct-out: get correct list of super-struct mutators
struct-out was putting the super-struct's accessors into two parts of a
struct-info: the accessor list and the mutator list

this commit puts the accessors only in the accessor list and the
mutators in the mutator list
2018-06-12 08:49:58 -06:00
Matthew Flatt
5c641919a6 fix --enable-jitframe for platforms that use libunwind 2018-06-11 18:16:17 -06:00
Matthew Flatt
0d870fb11c reader: fix bugs in cdot readering 2018-06-11 16:24:34 -06:00
Matthew Flatt
f11b4319b5 catch up on some acknowledgments 2018-06-11 11:42:18 -06:00
Matthew Flatt
a703b608a4 add --enable-jitframe for configure on x86_64
Using a frame pointer for the ABI of internal helper functions
should make the stack friendlier to tools like `perf`. There
may be a small performance cost, though.
2018-06-11 08:35:42 -06:00
Matthew Flatt
2c58937008 expander: fix comment 2018-06-08 09:24:13 +08:00
Vincent St-Amour
a2ab778ddb Post-release version for the v7.0 release 2018-06-07 09:10:05 -05:00
Robby Findler
aabd0e4603 fix random contract generation for </c and >/c when they get +inf.0 or -inf.0 2018-06-07 08:49:02 -05:00
Sam Tobin-Hochstadt
c6dd371ed6 Make stx.rkt cross-phase persistent.
This eliminates more than 70 linklet instance creations.
2018-06-07 09:38:38 -04:00
Matthew Flatt
4e10ed0518 expander: fix another local-expand problem with 'module-begin
Alexis's repair, and as she notes, forcing a `post-expansion` context
value in the core `#%module-begin` expander may allow a simplification
in "definition-context.rkt". But it's not immediately obvious, so save
that potential improvement for later.

Relevant to #2118
2018-06-03 17:10:31 +08:00
Matthew Flatt
9ca8d34e7c expander: clean up post-expansion scope representation
Instead of three different fields in the context to keep in sync,
encode the possibilities witin a single field.
2018-06-03 16:46:46 +08:00
Matthew Flatt
a1b5bab31b expander: repair local-expand with definition context
When `local-expand` receives one or more internal definition contexts,
it would forget about any current post-expansion scopes. That's
particularly a problem in a 'module-begin expansion context, where the
post-expansion scope ensures that any bindings are suitably
phase-specific.

Closes #2115
2018-06-03 10:02:01 +08:00
Gustavo Massaccesi
b9392b2a51 use unsafe-undefined for missing arguments in string-join
This is similar to the recent change of functions with optional
values. Using unsafe-undefined instead of a gensym makes it easier
to avoid the check of the missing argument.
2018-06-01 16:33:16 -03:00
Gustavo Massaccesi
fd149ca1c0 fix cache of regexp in string-{split,trim,normalize-spaces}
When the separator is a string, these function construct a regexp
that is cached to make repeated calls faster. But when the string
is mutated it is necessary to recalculate the regexp.
2018-06-01 16:33:07 -03:00
Matthew Flatt
8d56c29317 expander: fix incorrect addition of shifts
Commit 32b256886e adds shifts in one place where it shoouldn't;
the "determinsitic-zo" test exposed the problem.

Also, avoid adding shifts that will have no effect, which avoids
accumulating useless shifts in some top-level contexts.
2018-06-01 07:41:26 +08:00
Matthew Flatt
2cfd65e972 defend against bad bytecode
Closes #2107
2018-06-01 07:41:25 +08:00
Matthew Flatt
937c396e1b expander: don't flip use-site scope in local-expand
Various parts of the expander, including `local-expand`, always
flipped the use-site scope when flipping an introduction scope. Onlt
`syntax-local-introduce` should flip both of them, though.

Closes #2112
2018-05-31 18:06:59 +08:00
Matthew Flatt
32b256886e expander: fix problem with module->namespace and shifts
When expanding in a namespace for a module unmarshaled from ".zo"
form, a scope corresponding to the module's "inside edge" is added to
every expansion. Before this repair, the scope was detached from
module path index shifts that might apply to the bindings (including
references to bulk bindings). Repair the problem by adding suitable
shifts when adding the scope.

Thanks to William Hatch for the bug report.
2018-05-31 18:06:58 +08:00
Matthew Flatt
865efb7dda add and use racket/repl
As suggested by Sam: Using `racket/repl` to start a read-eval-print
loop can mean that less code is loaded if a startup language other
than `racket/base` is selected.

Closes #2064
2018-05-30 15:55:54 +08:00
Matthew Flatt
388345f35f fix eval variant used for command-line arguments
Closes #2111
2018-05-30 10:13:50 +08:00
Matthew Flatt
7bbbb8f063 namespace-syntax-introduce: fix bad phase shift
A `namespace-syntax-introduce` at a phase other than 0 could shift the
phase of introduced context by double the correct shift.

Relevant to #2099
2018-05-26 21:31:41 -06:00
Matthew Flatt
b1bf333523 expander: avoid excessive binding information in error messages 2018-05-26 20:29:07 -06:00
Ben Greenman
10c05aa3a1 typo: make-file-or-directory-link error message
Change error message to blame the symlink, not its destination
2018-05-26 17:45:21 -04:00
Matthew Flatt
ec2387fa16 syntax-debug-info: restore all-bindings support
Relevant to #2099
2018-05-26 10:32:56 -06:00
Alexis King
87a5ee4cc1 Make syntax-local-introduce work in syntax/parse pattern expanders 2018-05-25 18:25:13 -05:00
Alexis King
33546008b3 Make syntax-local-introduce work in require/provide syntax 2018-05-25 18:25:13 -05:00
Alexis King
2bccbf76ad Make syntax-local-introduce work in match expanders 2018-05-25 18:25:13 -05:00
Alexis King
d944b8589e Add syntax/apply-transformer, which provides local-apply-transformer 2018-05-25 18:25:13 -05:00
Ben Greenman
568f086162 object/c-equivalent? refactoring
- add comment saying `check-one-object/equivalent` only compares common
  members
- put the similar parts of `check-one-object` and
  `check-one-object/equivalent` in a helper function
- in `object/c-equivalent?`, check that names match before comparing the
  common contracts (because the names should be fast to check-if-incorrect)
2018-05-25 14:07:42 -05:00
Ben Greenman
cc44afdf77 bump version for contract-equivalent 2018-05-25 12:10:49 -04:00
Robby Findler
d5d296c350 add missing arguments so external combinators can supply #:equivalent 2018-05-25 08:56:55 -05:00
Matthew Flatt
851ea57ef9 read/recursive: avoid placeholder wrapper
Although the documentation claimed that `read/recursive` produces
a plaeholder, that seems to be a leftover from a much older
reader (before `make-reader-graph`). Fix the new `read/recursive`
to be like the old one, and update the documentation.

Thanks to Alex Knauth for tracking down the unnecessary change
in reader behavior.

Related to #2099
2018-05-24 15:44:21 -06:00
Matthew Flatt
b58938dc89 map: fix contract check on given function with required keyword arguments
Compared to v6.12, `map` & co. already provide better checking in
reporting an error when a keyword-requiring function is provided
with empty lists, but repair the error message to talk about
required keywords instead of just by-position arity.

Thanks to Philip McGrath for reporting the problem.

Related to #2099
2018-05-24 15:44:04 -06:00
Matthew Flatt
643d0d2cc4 Windows: restore console handling of Ctl-Z as EOF 2018-05-24 09:35:28 -06:00
Matthew Flatt
b00779863f fix Windows OpenSSL native library build 2018-05-23 20:46:39 -06:00
Matthew Flatt
1faa0433fa expander: fix local-expand and dropped macro definition
If `local-expand` with a 'module-begin context introduces a macro
definition, but the definition is dropped while a non-macro definition
is later introduced, then make sure references go to the non-macro
definition.

This change also addresses a related scenario, where a
`local-expand`-discovered macro definition is not dropped, but it is
given an extra scope --- which amounts to the same thing from the
expander's perspective.
2018-05-23 15:19:35 -06:00
Matthew Flatt
37dde6dc1e expander: fix related to (local-expand .... 'module-begin ....)
When a module body is expanded with `local-expand`, then submodules
can remain declared even if the submodule is discarded in the final
expansion. Since that's the way it has always been, leave it that way.
But also guard against a way of generating an import cycle via those
leftover declarations.
2018-05-23 12:30:52 -06:00
Matthew Flatt
ab7dffa420 expander: repair for module with (#%declare #:empty-namespace)
Repair a corner of `namespace-attach-module` on modules that include
`(#%declare #:empty-namespace)`.
2018-05-22 14:19:16 -06:00
Robby Findler
1ee5786e2d fix substruct contract blame setup
closes #2093
2018-05-22 08:43:10 -05:00
Matthew Flatt
fadac92003 dump-memory-stats: repair for non-backtrace build
Fix `(dump-memory-stats 'count ....)` to avoid crashing immediately.
2018-05-21 06:33:48 -06:00
Matthew Flatt
c990bbf1f7 Windows: fix Console output for non-UTF-8 bytes
A repair for the preceding commit: Writing non-UTF-8 output to a
console will write something unspecified, but it shouldn't crash
or freeze Racket.
2018-05-20 09:47:14 -06:00
Matthew Flatt
f5f4e6cf03 Windows: Unicode I/O for console ports
Use WriteConsoleW and ReadConsoleW to support Unicode input and output
for a console independent of it's code page.

Closes #2087
2018-05-20 07:46:20 -06:00
Gustavo Massaccesi
293beac7ff fix mode in rumble:equal?/recur 2018-05-19 09:49:22 -06:00
Matthew Flatt
628c177480 expander: fix code-inspector management during macro expansion
Specifically, don't incorrectly preserve the current macro's code
inspector when triggering another macro via `local-expand`.
2018-05-19 07:12:26 -06:00
Caner Derici
55011ce282 racket/src/expander: add -B
adding -B option into the expander to write the bytecode of the extracted linklet
2018-05-18 19:25:51 -06:00
Robby Findler
54989bddec use preserved thread cells for the knot-tying cache
(this makes a difference in the acquire gradual typing
benchmark, which uses nested threads via the sandbox library)
2018-05-17 08:42:08 -05:00
Alexis King
774b02a0b8 syntax/parse: Add #:track-literals and syntax-parse-track-literals 2018-05-16 14:07:58 -05:00
Robby Findler
be7fe82ea8 adjust implementation of recursive contract to cope with
the fact that blame object equality now works right and
adding context to a blame object doesn't produce an equal?
blame object

also it appears that blame-add-unknown-context is not actually
being called so lets just get rid of that functionality
(but preserve reasonable backwards compatibility in
case someone is actually calling that function or
supplying #f to blame-add-context)

And the interning of blame objects was not intended to be
in 0b3f4b627e, so get rid of it here

closes racket/typed-racket#722
2018-05-15 21:06:53 -05:00
Jay McCarthy
06c7318eaf reformat and fix up reconnecting 2018-05-14 10:17:47 -04:00
Robby Findler
0b3f4b627e streamline the representation of blame objects
and improve the context tracking support
to allow a choice of how much context to save
2018-05-12 17:28:55 -05:00
Matthew Flatt
44b8e56ed0 bytecode optimizer: allow inline of unsafe-undefined
Restores some function inlining that was lost by the change to
optional-argument expansion.
2018-05-12 07:49:12 -06:00
Alexis King
bbbdee2853 Adjust local-require to be more deliberate about syntax-local-introduce
This ensures macro-introduction scopes don’t unintentionally end up on
lifted pieces of syntax, which causes problems for Check Syntax, since
it affects the syntax-original?-ness of the require spec.
2018-05-11 16:52:17 -05:00
Ben Greenman
a539825dc9 fix: allow missing fields in object/c-common-fields-stronger?
Change `object/c-common-fields-stronger?` to only compare the fields
common to both objects.
2018-05-11 11:50:14 -04:00
Robby Findler
8ec3edaa95 add contract-equivalent?
and use it to get rid of the change in 4de050552,
avoiding the exponential blowup in a way that
doesn't compromise on contract-stronger?'s result
2018-05-09 21:32:29 -05:00
Matthew Flatt
c927a004d2 expander: fix problems with syntax-local-make-definition-context
Allow `syntax-local-make-definition-context` in places where the
created scope is not accumulated for stripping from `quote-syntax`.
Refine the docs to clarify those situtations.

A test for the repair exposed a problem with use-site scopes
and `quote-syntax`, so fix that, too.

Closes #2062
2018-05-06 20:23:39 -06:00
Matthew Flatt
f9821f9f15 variable-reference->namespace: repair namespace availability
Internally, the namespace must be set to the returned one while making
it available. Otherwise, the current namespace can get mangled.

Closes #2067
2018-05-06 20:23:39 -06:00
Robby Findler
76c404dffc fix contract-stronger bug 2018-05-06 21:21:44 -05:00
Matthew Flatt
f231cb2003 expander: fix problem related to (local-expand 'module-begin ...)
When `local-expand` is used for a 'module-begin context, use a fresh
binding -> definition-unreadable-symbol table for the nested
expansion. That way, the table used for the main expansion is
unchanged, and re-expanding or evaluating the expanded module will
arrive at the same unreadable symbols as the initial expansion.

The report and example are from Alexis.
2018-05-06 07:59:54 -06:00
Matthew Flatt
662a9022c0 refine implementation of keyword and optional arguments
The old implementation turns a single optional argument into two
arguments: the optional value and a boolean to indicate whether the
optional value is supplied.

The new expansion uses `unsafe-undefined` in place of not-supplied
arguments, in the general case. If the default-value expression is
simple enough, however, it is copied to call sites that would
otherwise supply `unsafe-undefined`. In the common case where the
default value is `#f`, for example, no run-time test is needed in the
core implementation function to check whether the default is supplied,
because a `#f` will be filled in for callers.

The performance improvement is tiny to non-existent for realistic
programs, but the simpler and reduced generated code may help in the
long run.
2018-05-06 07:59:54 -06:00
Robby Findler
4de0505525 block possible exponential explosion in stronger check 2018-05-06 08:58:21 -05:00
Asumu Takikawa
5eceb3d051 Guard FFI union functions with type checks (#1375)
* Guard FFI union functions with type checks

Also add unit tests for unions
2018-05-06 00:10:14 -04:00
Robby Findler
69eb5ee055 change the representation of blame objects
so that blame-swap (when no context is added)
is more efficient
2018-05-04 14:40:31 -05:00
Robby Findler
143d15eaa5 add the ability to not track context information in contract violation error messages 2018-05-04 06:38:59 -05:00
Robby Findler
3f4cbcbfd8 memoize the creation of the name in the blame object 2018-05-02 19:01:20 -05:00
Tucker DiNapoli
822938d9ae Handle symbol changes between openssl-1.0 and 1.1
In openssl-1.1 (specifically libcrypto) the functions sk_num, sk_value and sk_pop_free are prefixed by 'OPENSSL_'.
Now both symbol names looked for to support both version 1.0 and 1.1.
2018-05-02 06:26:08 -04:00
Sam Tobin-Hochstadt
73c3341001 Implement read-eval-print-loop using #%kernel.
Makes the repl faster to load when using a very small language
such as `racket/kernel/init`
2018-05-01 13:35:05 -04:00
Sam Tobin-Hochstadt
ba8c79f502 Avoid some dependencies for racket/kernel/init.
This is useful when loading without bytecode. Motivated by use in
Pycket, which does not load bytecode.
2018-05-01 13:35:05 -04:00
Sam Tobin-Hochstadt
409ad2d73b Avoid some uninitialized variables. 2018-05-01 13:35:05 -04:00
Sam Tobin-Hochstadt
3fc964faaf Fix name of the racket/private/top-int.rkt module. 2018-05-01 13:35:05 -04:00
Matthew Flatt
6f31650539 repair for re-expansion of an implicit-form expansion
The repair in 385f9588f8 propagates the
must-be-bound callback too far. It shouldn't be propagated anymore after
a non-rename transformer is applied.

Closes #2048
2018-04-30 21:05:09 -06:00
Matthew Flatt
53c1b5b1db fix generated makefile dependencies to work when a file is deleted 2018-04-30 19:57:22 -06:00
Robby Findler
ff588f93eb add contract-pos/neg-doubling and use it in various places 2018-04-29 21:50:32 -05:00
Alexis King
96b69d0366 Add interned scopes and make-interned-syntax-introducer 2018-04-27 20:12:11 -05:00
Robby Findler
8dbedc6a26 the commit 2a1c8a78 contained stuff that was meant to be in bff0c41
so when it was reverted, we have to bring back that stuff
2018-04-27 18:59:10 -05:00
Robby Findler
ef8101bde3 Revert "change the strategy for recursive-contract's knot tying"
This reverts commit 2a1c8a78a5.

something goes wrong with large recursive nests with this commit
2018-04-27 15:04:03 -05:00
Matthew Flatt
53ffd28e0f expander: atomic update of a module-path-index table
A module path index used to expand a module must be interned, and the
intern table is an `equal?`-based weak hash table, which means there's
an internal lock on the table that can be damaged if the current
thread is terminated while using the table.

I don't see an easy way to fall back to `eq?`-based tables, so I'm
resorting to an atomic region (which I had managed to avoid until
now).
2018-04-27 12:59:58 -06:00
Matthew Flatt
cb921cd1d9 configure: fix --disable-cify 2018-04-26 13:48:09 -06:00
Robby Findler
bff0c4113d lift out some work from object contracts from the post-value application
of the projection to the pre-value (after getting the blame object)
2018-04-26 14:30:58 -05:00
Robby Findler
2a1c8a78a5 change the strategy for recursive-contract's knot tying
this change speeds up this microbenchmark by about 10x:
2018-04-26 14:06:17 -05:00
Milo
026d368a38 Improve some errors from match and friends (close #1431, #1615) (#1974)
* More specific error for no-clause match-lambda** (close #1615)

* Remove unused orig-stx parameter from racket/match internals

* Use of match-XYZ/derived for better errors (fix #1431)

* Tests for the exceptions produced by racket/match
2018-04-25 17:17:39 -04:00
Matthew Flatt
bc55560f8d raco pkg update: add ---unclone as a kind of alias for --lookup
It's difficult to remember that the opposite of `--clone` is
effectively `--lookup`.
2018-04-25 09:54:06 -06:00
Alexis King
e2ef7cdd5c Make syntax-local-lift-require not affect syntax-original?-ness 2018-04-25 10:52:14 -05:00
Alexis King
b87793640b Add quote-syntax and #%plain-module-begin to kernel-form-identifier-list 2018-04-24 15:10:11 -05:00
Robby Findler
b8c398cc69 add obligations for instanceof/c 2018-04-24 14:48:11 -05:00
Matthew Flatt
77d0b0b8f4 syntax-local-lift...: correct error for module-begin context
Relevant to #2052
2018-04-24 08:22:37 -06:00
Matthew Flatt
88d8ba00e0 bytecode compiler: fix for call-with-immediate-continuation-mark
The converstion from calling `call-with-immediate-continuation-mark`
to an internal `with-immediate-continuation-mark` form did not handler
a mutable argument variable.
2018-04-23 21:13:10 -06:00
Alexis King
3531cb24f4 Restore binding-introduction behavior of parent definition contexts
This behavior was in Racket 6, but was not preserved in the new
expander.
2018-04-23 11:19:20 -05:00
Matthew Flatt
b1f9f2caad expander: no #%expression in fully expanded
Ensure that `#%expression` appears only around a top-level form in
a fully expanded form.
2018-04-22 08:15:44 -06:00
Alexis King
7d556d4006 Preserve some coercion behavior of old internal-definition-context-apply
mzlib/unit200 relies upon this behavior, even though it appears to have
been mostly accidental, so this maintains it for the sake of
backwards-compatibility.
2018-04-20 20:42:14 -05:00
Daniel Feltey
51decc085d remove unused definition 2018-04-20 17:00:25 -05:00
Matthew Flatt
07473865a6 fix continuation-mark splicing across composable combinations
Although splicing was set up for applying a composable
comtinuation to most kinds of continuations, it was not
set up right for applying a composable continaution in tail
position for a just-applied composable continuation.

Thanks to Spencer Florence for the report and example.
2018-04-20 12:02:59 -06:00
Alexis King
6834e4a12c Document and generalize some things for first-class definition contexts
This commit adds a section to the reference to document how the expander
tracks information about local bindings, and it extends some
syntax-local functions to allow them to accept multiple definition
contexts instead of just one. In addition, it improves the documentation
on how first-class definition contexts interact with local-expand,
syntax-local-value, and syntax-local-bind-syntaxes, and it also
clarifies what it means to create a child definition context.
2018-04-20 11:47:23 -05:00
Alexis King
e5b5747566 Make local-require work with phase shifted require specs
fixes #2049
2018-04-19 15:16:18 -05:00
Matthew Flatt
65217898d1 repair gui native-lib metadata generation 2018-04-17 15:44:03 -06:00
Matthew Flatt
3b1ddc6ee4 update native-library notes for PPC Mac OS 2018-04-16 07:40:58 -06:00
Matthew Flatt
ee695bc317 native libs: add ATK to native-library builds for all platforms 2018-04-16 06:34:13 -06:00
Matthew Flatt
70020785b2 JIT: fix more misuses of jit_retval
Older mistakes that are the same as in 82517622c7.
2018-04-16 06:34:13 -06:00
Matthew Flatt
7bccfa7824 ffi/unsafe/obj: ignore NULL protocols
If the `#:protocols` clauses of a `define-objc-class` form includes
errors, but it simplifies the declaration of protocols that are
introduced in different versions of a framework, and it's effectively
more compatible with the implementation before dc0898f5ef.
2018-04-16 06:34:13 -06:00
Matthew Flatt
d2ef35082a repair JIT-inlined hash-ref
The attempt in 82517622c7 was wrong. Using `JIT_R0` for
the result in the internal ABI is fine, and the problem
was using a register for two purposes in the called
stub.
2018-04-15 17:23:39 -06:00
Matthew Flatt
c79fba4ca6 native-library build-script updates for PPC Mac OS 2018-04-15 16:48:28 -06:00
Matthew Flatt
8100438afc unsafe-fxlshift: fix constant folding
Closes #2034
2018-04-15 11:10:48 -06:00
Matthew Flatt
ecd0aee2b7 db: avoid Racket C API
Also, the use of `scheme_make_sized_byte_string` was incorrect, since
it expects 3 arguments.
2018-04-15 08:16:47 -06:00
Matthew Flatt
69f5395d5d cs: repairs for Linux build 2018-04-15 08:16:47 -06:00
Matthew Flatt
82517622c7 repair JIT-inlined hash-ref
Direct of `JIT_R0` instead of `jit_retval` is wrong on PowerPC.
2018-04-15 08:16:47 -06:00
Matthew Flatt
abb601558d 3m: avoid reinstall of write-barrier signal handler for places
Redundantly setting the signal handler hasn't matter, but it's
confusing and now matters for implementing W^X via a different signal
handler.

Closes #2038
2018-04-14 15:46:10 -06:00
Matthew Flatt
385f9588f8 expander: adjust rename-transformer handling for implicit forms
For consistently with the old expander, treat `#%app` and `#%datum`
like unbound if they're bound to a rename transformer whose identifier
does not untimately refer to macro or primitive syntactice form.

Closes #2042
2018-04-14 10:36:45 -06:00
Ben Greenman
8b797a10a8
fasl: use longer fasl prefix
Change fasl prefix from `rkt:` to `racket/fasl:`, in the hope that future civilizations will be able to decipher these binary files.
2018-04-13 22:44:35 -04:00
Matthew Flatt
fb635c0d97 repair for raise-result-arity-error
Classic misuse of provided string as a formatting template.

Closes #2040
2018-04-13 06:36:39 +02:00
Matthew Flatt
b1dc723acd Mac OS: fix build script for libgmp 2018-04-11 22:00:12 +02:00
Michael Ballantyne
4be2c523b6 fix dynamic-require with symbol to not make available
to match behavior in docs and racket 6.
2018-04-11 21:59:53 +02:00
Gustavo Massaccesi
8d08264b41 schemify: fix boolean-or-fixnum?
Also, add null? to equal-implies-eq?
2018-04-11 13:28:09 -03:00
Matthew Flatt
a5d0d38ae0 cs: use O_BINARY only on Windows 2018-04-11 06:47:58 +02:00
Matthew Flatt
fcfa72e73a add raise-result-arity-error
Use it to provide some proper errors from the expander.

Closes #2029
2018-04-11 06:47:58 +02:00
Alex Knauth
f66b3312df match: check duplicate identifiers across list-no-order patters (#2000)
* match: check duplicate identifiers across list-no-order patters

* match: document that list-no-order doesn't support duplicate ids between sub-pats

* match: put duplicate id docs in a margin note between the two variants
2018-04-11 00:00:14 -04:00
Robby Findler
1e93424f67 adjusted the blame objects so that equality tests (and equal hashing) work better 2018-04-09 14:00:29 -05:00
Robby Findler
853f14b9a5 adjust make-wrapper-class and make-wrapper-object to cooperate better with the way projections are curried 2018-04-09 14:00:05 -05:00
Ryan Culpepper
a48259ba29 syntax/loc: only use loc arg if it has source or position 2018-04-09 11:40:12 +02:00
Ryan Culpepper
7f12dc567c bump version 2018-04-09 11:40:12 +02:00
Ryan Culpepper
84ca256029 rename ??,?@ to ~?,~@ (see PR #2031) 2018-04-09 11:40:12 +02:00
Matthew Flatt
5bb2c1f16e upgrade native libraries
Update the build scripts, patches, and notes.
2018-04-09 09:14:05 +02:00
Kieron Hardy
e0668d895b Update simple.rkt
Fix typo in comment.
2018-04-07 16:06:11 -04:00
Ryan Culpepper
93a899cf4c db/sqlite3: support create-{function,aggregate} 2018-04-04 12:31:54 +02:00
Ryan Culpepper
aadbe1a7d2 db/sqlite3: add support for loading extensions 2018-04-04 12:31:54 +02:00
Ryan Culpepper
1e40af55bc db: more db/../function updates, factor out checks better 2018-04-04 12:31:54 +02:00
Ryan Culpepper
7c50113ced db: move some non-essential code to db-lib pkg
Also provide more from private modules to allow impl sharing.
2018-04-04 12:31:54 +02:00
Ryan Culpepper
bcb6299b4b wrap-expr/c: don't put build-time paths in expansion (closes #2006) 2018-04-01 02:50:29 +02:00
Ryan Culpepper
262ed468d0 remove rename-transformer (causes demodularizer problems) 2018-04-01 01:42:17 +02:00
Ryan Culpepper
6f628b2531 fix error messages 2018-03-30 12:43:36 +02:00
Matthew Flatt
d3aa7e90e7 rktio: fix Windows file timestamp dst correction
The old correction was broken in at least a couple of ways; use
the more tested DST calculation in the implementation of
`seconds->date`.
2018-03-29 20:45:26 -06:00
Matthew Flatt
e95c3fe6d5 sgc: fix unmapping of temporary GC space
Instead of unmapping directly, return temporary space to
the page-allocation cache.
2018-03-29 14:48:11 -06:00
Ryan Culpepper
0f3f338b22 delay evaluation of default-make-fail argument until use
This reverts part of 778b1845.
2018-03-29 11:48:59 +02:00
Ryan Culpepper
0083f5c858 fix error reporting for define/syntax-parse (closes #2003) 2018-03-29 11:41:01 +02:00
Ryan Culpepper
c2eab77cec update version number and fix history for syntax/?@/?? 2018-03-29 11:40:35 +02:00
Ryan Culpepper
8d607b83f9 merge syntax/parse's template into core (syntax, syntax/loc, etc) 2018-03-29 11:40:35 +02:00
Matthew Flatt
2c627c300b unwind: avoid passing NULL to memcpy
In response to #2021
2018-03-28 05:31:30 -06:00
Matthew Flatt
330bb2cfb8 expander flattener: recognize gensym
An unreferenced call to `gensym` can be discarded.
2018-03-27 20:33:21 -06:00
Ryan Culpepper
5fadcb38b8 update openssl .so version list 2018-03-27 22:31:10 +02:00
Ryan Culpepper
5f68f0d5a5 trim requires 2018-03-27 22:31:10 +02:00
Ryan Culpepper
778b184526 avoid generating macro definition; use compile-time helper instead 2018-03-27 22:31:10 +02:00
Matthew Flatt
f6424ff7c2 Windows: adjust DLL embedding implementation
Define `__pfnDliNotifyHook2` instead of declaring it as `extern` seems
to make it work in more build environments.
2018-03-27 13:57:41 -06:00
Matthew Flatt
5ec71d45e8 Restrict W+X based on signal handlers to intended pages
Make 9d0ab74e9e more responsible by limiting permission changes to
pages that are intended to be both writable and executable for code
generation. That way, the signal handler doesn't just reopen holes in
loaded foreign libraries that W^X would close.
2018-03-27 11:34:42 -06:00
Kieron Hardy
9498f52c71 Update misc.rkt 2018-03-27 10:01:13 -05:00
Matthew Flatt
f67d4f349e Windows: unbreak loading of "longdouble.dll"
Changes to support embedded DLLs make loading worked only
in embedded mode.
2018-03-26 18:15:18 -06:00
Matthew Flatt
bf0a739991 raco exe: fix section alignment for PE rewriting
A new resource section was aligned based on the old section's
virtual address, instead of the PE's specified section
alignment. That could make alignment round up too far, leaving
a disallowed gap in the sections' virtual addresses.
2018-03-26 17:41:59 -06:00
Matthew Flatt
f8dac3d47d byte compiler: fix excessive fixnum assumptions in unsafe mode
The comparison operations `=`, `<`, etc., were incorrectly compiled as
fixnum operations in the expander's implementation.
2018-03-26 17:27:54 -06:00
Matthew Flatt
9d0ab74e9e OpenBSD: follow the letter of W^X
Conform to W^X by using a signal handler that switches between W and X
mode on any fault. That's not the spirit of W^X, certainly, but it
should make Racket work without special configuration.

Beware that this change can turn some crashes into infinite loops.
It may be possible to detect those loops, but I didn't find a
good and portable way, so far.
2018-03-26 14:08:16 -06:00
Michael Myers
a70e6bdfc9 Fix typo 2018-03-26 08:08:51 -05:00
Matthew Flatt
e01a21db0c raco exe: add --embed-dlls for Windows
Creating an executable with embedded DLLs means that the executable
can be truly stand-alone, instead of needing to be kept with its
DLLs in a relative subdirectory.

DLL embedding works by bypassing the OS's LoadLibrary and
GetProcAddress functions, and instead maps the DLL into memory
and performs relocations explicitly. Joachim Bauch's MemoryModule
(Mozilla license) implements those steps.
2018-03-25 16:35:42 -06:00
Matthew Flatt
1803e647e1 net/win32-ssl: repairs for RacketCS 2018-03-24 07:04:31 -06:00
Matthew Flatt
7fd6e07ad7 io: another repair to Windows path parsing 2018-03-23 21:46:12 -06:00
Matthew Flatt
2754f22844 cs & io: repairs for locks & DLL errors 2018-03-23 19:20:14 -06:00
Matthew Flatt
f048f23ade schemify: fix problem with inlining
Recently added support for inlining functions with a "rest" arg
exposed a problem in constructing an inlining environment.
2018-03-23 17:01:21 -06:00
Kieron Hardy
e0a8f475a7 Update misc.rkt 2018-03-23 14:31:03 -05:00
Matthew Flatt
0ebcb23244 io: repairs for Windows path maniplation
Perpetuate a failure to make Windows paths behave reasonably with
path-manipulation functions.

In one case, the new implementation seemed better than the old one, so
I've changed the old implementation (by deleting code) and test cases.
The old code would split "x /y" to "\\?\REL\x " and "y", and the new
one splits to "x /" and "y"; the trailing separator is now enough to
preserve the space character, and it also preserves the directoryness
of the path. Of course, "x /" splits to 'relative and "\\?\REL\x " as
it strips away the trailing "/".

A remaining problem in both implementations: some Windows API
functions implicitly erase a trailing "." in a directory name, making
"x./y" equivalent to "x/y". The Racket path-manipulation functions
don't do that, so splitting and recombining "x./y" does not access the
same path as the original. This apparently hasn't been a problem in
practice, and there are so many terrible hacks already, so I left it
alone.

The new implementation perpetuates also the implementation mistake of
representing paths internally as byte strings. If, in some terrible
universe, I'm forced to do this again, the right choice is probably to
keep the path in a parsed form with enough information to reconstruct
the original, but with the information sorted nicely to make various
normalizations and combinations easy.
2018-03-23 10:37:59 -06:00
Robby Findler
e031e04f62 improve error message for xml contract violation 2018-03-23 08:45:34 -05:00
Kieron Hardy
13c31221d6 Update thread.c
Fix typo in comment.
2018-03-21 11:49:35 -05:00
Matthew Flatt
b0424737a7 places: handle impersonated values by copying
Recognize vector, hash table, and prefab impersoantors/chaperones,
and allow them as place0channel messages by copying.

Closes #2001
2018-03-21 08:57:16 -06:00
Matthew Flatt
f4db704b5b --help on Windows: fix misleading description of "racketrc.rktl"
The path usually is found some other way than through `HOMEDIRVE`
and `HOMEPATH`.
2018-03-21 07:20:05 -06:00
Matthew Flatt
808bdb6d0b JIT-inline symbol-interned? 2018-03-20 17:44:35 -06:00
Matthew Flatt
811ae4f72a change unsafe immutable hash table iteration 2018-03-20 17:44:35 -06:00
Matthew Flatt
3fef5de8b9 cs: fix options-argument handling in compile-linklet 2018-03-20 08:27:54 -06:00
Robby Findler
c442e9707f fix bugs with error checking for ->* and ->
closes 1997
2018-03-20 08:34:27 -05:00
Matthew Flatt
93e3b44fd2 expander: repair phase >= 1 undefined-variable checking
Closes #1996
2018-03-20 07:20:24 -06:00
Matthew Flatt
5ed0cdf563 expander: sync cify with recently newly used operations 2018-03-19 16:54:47 -06:00
Matthew Flatt
b177a5c908 hash-update! and similar: minor performance reorg
Reorganize the implementation of `hash-update!` and related fuctions
to help the bytecode compiler a little.
2018-03-19 10:42:09 -06:00
Matthew Flatt
f138469464 reverse and map: skip checks in unsafe mode
Since only the expander is compiled in unsafe mode right now, the
checks are skipped only when the implementations of `reverse`, `map`,
etc., are part of the flattened expander.
2018-03-19 10:11:48 -06:00
Matthew Flatt
b82d6e2204 expander: remove backend-specific vector handling
Backend-specific handling is no longer useful, since the rules have
changed for code inspectors, bytecode, and unsafe operations.
2018-03-19 08:01:50 -06:00
Matthew Flatt
77a978fb10 expander: another cache layer for binding
Add a cache on binding lookup that is like the old expander --- a
small cache that is consulted before the more general cache that is
already in place.

The new cache layer primarily helps when a single identifier is
compared to a sequence of other identifiers.
2018-03-18 15:28:51 -06:00
Matthew Flatt
60471c2691 improve continuation-mark fast path
Follow the metacontinuation chain, and also distinguish between
"definitely not found" and "not easily found, so try the slow path".
2018-03-18 13:10:01 -06:00
Matthew Flatt
f03cb9144e unbreak cify build
Handle `(case-lambda)`.
2018-03-17 08:27:49 -06:00
Matthew Flatt
a62e159e33 expander: performance tweak 2018-03-17 08:27:43 -06:00
Matthew Flatt
37a985a681 compile expander in "static" linklet mode
The expander as a linklet will be instantiated once, so there's no
need to capture references in closures among functions within the
expander. Add a "static" linklet compilation mode to inline the
variable addresses that would otherwise be referenced via a closure.

Although the change is intended to speed up the expander by avoiding
some indrections, it also reduces the bytecode size of the expander.
Bitmaps that track which linklet variables are used in closures turn
out to have been about 25% of the expander's bytecode size, since the
linklet has so many definitions.
2018-03-17 07:24:50 -06:00
Matthew Flatt
ad3ab8b352 optimizer: fix guarded-constructor tracking
Some parts of the optimizer were inconsistent in whether a tracked
structure type needed to have a constructor that always succeeds
(i.e., no associated guard). Increase precision to track both kinds of
structure types, and avoid some unnecessary space-safety clearing in
the vicinity of nonfailing constructors.
2018-03-17 07:24:50 -06:00
Matthew Flatt
600469d164 expander & bytecode compiler: performance tweaks 2018-03-17 07:24:49 -06:00
Jakub Jirutka
f23b27e393 Fix bashism in Makefile for better portability
Syntax `[[ "foo" != /* ]]` is not defined by POSIX Shell Command
Language. It's supported only by ksh, Bash and ZSH. Other POSIX
shells, such as ash or dash, does not support it.

This patch replaces this problematic syntax with simple case statement
that is supported by all POSIX-sh compatible shells, including (but not
limited to) ash, bash, dash, ZSH.
2018-03-14 20:43:31 -06:00
Matthew Flatt
67a982ad6a cs: add lock on equal?-based weak hash table
Also, repair a test that didn't properly retain weak-hash keys.
2018-03-14 14:37:41 -06:00
Matthew Flatt
aad799f09e racket/cmdline: add missing checks in command-line
Closes #1989
2018-03-14 06:32:50 -06:00
Matthew Flatt
145b3d840e remove unused function 2018-03-13 20:15:07 -06:00
Matthew Flatt
1dd0a83333 racket/path: add #:more-than-same? argument to find-relative-path
Closes #1980
2018-03-13 20:14:04 -06:00
Matthew Flatt
6db03c7eb9 racket/promise: fix promise/force on the result of delay/sync
Closes #1933
2018-03-13 19:39:52 -06:00
Matthew Flatt
0cda14300d non-original code inspector => mark loaded bytecode as non-runnable
This change adjusts the way that trust is threaded through bytecode
and the code inspector. In Racket v6.x, reading bytecode would fail if
the code inspector is non-original and if the bytecode contains a
reference to an unsafe operation. Now, reading bytecode doesn't fail
for that reason, but all bytecode is marked as non-runnable (even
without references to unsafe operations) when loaded under a
non-original code inspector. A `read` operation by itself remains as
safe as ever.

This commit also disables the bytecode validator. For now, the
validate can be re-enabled with `PLT_VALIDATE_LOAD`.
2018-03-13 17:26:50 -06:00
Matthew Flatt
85ff4eee74 racket/fasl: switch to version-independent format
Make `s-exp->fasl` generate an encoding that can be parsed by any
future version of `fasl->s-exp`. The new format does not rely on the
runtime system's bytecode writer and reader.
2018-03-13 16:32:01 -06:00
Sam Tobin-Hochstadt
0a00e82ca1 Copy source location to generate runtime paths.
Fix found by @lexi-lambda. Bug reported by dbenoit@fedoraproject.org.
2018-03-13 18:21:46 -04:00
Matthew Flatt
efe5d2d83f expander: fix module-path?
Fix `module-path?` to check the first character of a path string.

Closes #1988
2018-03-12 20:50:58 -06:00
Matthew Flatt
68a96e094e bytecode optimizer repair
Closes #1986
2018-03-12 20:17:54 -06:00
Matthew Flatt
994a4d4a35 expander: fix problem with syntax-local-expand-expression
Closes #1984
2018-03-12 07:11:31 -06:00
Matthew Flatt
2f930dd6f3 add syntax-property-remove 2018-03-11 11:31:56 -06:00
Matthew Flatt
13242b06d6 expander: fix an error message 2018-03-11 10:37:37 -06:00
Sarah Spall
14448eb1bd Moved release of lock to fix use after free 2018-03-10 08:55:21 -07:00
Matthew Flatt
f3596d96c2 bytes-converter: avoid unnecessary custodian registration
Some built-in bytes-converter combinations that were not
supposed to require custodian registration were neveretheless
registered, which created a small leak for some programs.
2018-03-10 07:20:41 -07:00
Matthew Flatt
3f2fd06cb0 expander: fix namespace-require/copy 2018-03-09 16:32:19 -07:00
Matthew Flatt
0d06ba2848 expander: treat unbound and top-level-bound as free-identifier=?
Restores quetionable but traditional behavior.
2018-03-09 16:07:37 -07:00
Matthew Flatt
35dc59ee07 expander: preserve syntax properties on let[rec]-values clauses 2018-03-09 15:44:11 -07:00
Matthew Flatt
af4c23fa72 variable-reference->namespace: ensure that module is available 2018-03-09 11:06:49 -07:00
Matthew Flatt
234e47a58f remove accidentally committed debugging output
Attempting to write the output could cause places to crash
on Windows.
2018-03-08 18:14:33 -07:00
Matthew Flatt
97721be2af Windows: fix extflonum infinity and NaN without longdouble.dll
Since the reader's implementation includes quoted references
to infinity and NaN extflonums, make sure it reads and writes
and compiles correctly before "longdouble.dll" is installed.
2018-03-08 18:14:33 -07:00
Matthew Flatt
3cf2138841 expander: avoid equal?-based hash table for module cache
Since a thread can be terminated while accessing the cache, it
can't be an `equal?`-based table where the lock can get lost.
2018-03-08 16:36:16 -07:00
Matthew Flatt
e4e17db51d expander: fix origin tracking with a set! transformer 2018-03-08 14:14:28 -07:00
Matthew Flatt
83d792fca5 reader: fix locations on various kinds of errors 2018-03-08 10:14:44 -07:00
Tony Garnock-Jones
32d119dfe6 Correct name of integer->integer-bytes in contract error message 2018-03-08 15:37:54 +00:00
Matthew Flatt
407c1b49c5 reader: repair #lang change
Commit d5d8249c12 added too many syntax wrappers on
list forms.
2018-03-07 18:08:18 -07:00
Matthew Flatt
d5d8249c12 reader: fix "original?" property on #lang-derived module name 2018-03-07 17:59:21 -07:00
Matthew Flatt
ab48afda7a expander: further repair for implicit-form errors
The previous change didn't report a top-level unbound identifier
correctly.
2018-03-07 13:53:27 -07:00
Matthew Flatt
909fed6f2f expander: reapirs for implicit-form errors
Add missing source for unavailable `#%datum`, etc., and
other similar adjustments.
2018-03-07 10:54:32 -07:00
Matthew Flatt
ac2addeeb6 expander: fix 'origin on let-syntax-bound id-macro expansions 2018-03-07 08:20:57 -07:00
Matthew Flatt
3861da41ed remove debugging temporary 2018-03-07 08:16:56 -07:00
Matthew Flatt
d8dce77984 input-port-append: add #:name argument 2018-03-06 20:01:47 -07:00
Matthew Flatt
9d77ffe6d5 avoid crashes while reading ill-formed bytecode 2018-03-06 18:33:49 -07:00
Matthew Flatt
c29e072f7e identifier-binding: don't lose nominals
Repairs ebef94435c
2018-03-06 13:33:24 -07:00
Matthew Flatt
ebef94435c identifier-binding: bias nominal to most recent require
The `identifier-binding` function doesn't promise to give back any
particular `require` as the nominal binding site, but some tests rely
on the most recent `require` as the binding site. Also, the arrows
in DrRacket look nicest that way.
2018-03-06 13:12:57 -07:00
Matthew Flatt
dffcbc1cb2 thread & io: code clean-ups
Remove unused `require`s and fix some indentation.
2018-03-06 13:04:27 -07:00
Matthew Flatt
82b5ec8d18 expander: fix registry-lock retry path
Provoking the retry path is extremely difficult, so it's unlikely to
have caused any problem so far.
2018-03-06 09:47:22 -07:00
Matthew Flatt
050cdb5983 xform: avoid problems with __signbitf128
Closes #1962 and uses the suggested patch there, among other changes.
2018-03-06 09:05:08 -07:00
Matthew Flatt
c5653b5bdd expander: code clean-ups
Use `define/who` consistently, remove some unused `require`s, and fix
some bad indentation.
2018-03-05 19:34:41 -07:00
Matthew Flatt
bbefc9ed50 expander: fix taint propagation
A taint on a syntax object without scopes to propagate was propagated
incorrectly to a nested syntax object that also has pending scopes to
propagate.
2018-03-05 18:08:42 -07:00
Milo Turner
275d7974cd Added #:cut pattern directive 2018-03-05 15:03:45 +01:00
Matthew Flatt
112aa6eb07 fix -m command-line flag for new expander 2018-03-04 11:44:00 -07:00
Matthew Flatt
fc1da5f037 reader: fix quoting in some error messages 2018-03-04 11:22:18 -07:00
Matthew Flatt
c6579bbdcf expander: fix provide of prop:exn:missing-module 2018-03-04 07:21:18 -07:00
Matthew Flatt
983a35a024 expander: repair handling of non-interned provides 2018-03-03 16:46:53 -07:00
Matthew Flatt
77028b9c95 fix potential error misreporting on a file-open failure 2018-03-03 10:02:12 -07:00
Matthew Flatt
ea7f973102 expander: repairs for top-level define-values and begin-for-syntax 2018-03-02 18:00:02 -07:00
Matthew Flatt
88b066e1b2 expander: correct scope of added #%module-begin wrapper
Also, fix a problem rendering module path indexes.
2018-03-02 15:17:37 -07:00
Matthew Flatt
e78eb0563a expander: fix shadowing require after shadowing define
Refines the repair in 11fd70c3dd to properly handle a `require` that
should be allowed to shadow the initial require.
2018-03-02 13:37:48 -07:00
Matthew Flatt
2104d02a23 reduce non-determinism in serialized syntax 2018-03-02 13:37:47 -07:00
Matthew Flatt
f439ab6b4e add some missing checks in the bytecode reader 2018-03-02 13:37:46 -07:00
Matthew Flatt
11fd70c3dd expander: fix require after shadowing define 2018-03-01 14:14:24 -07:00
Matthew Flatt
7069510d67 expander: bind U+3BB as a macro, not a core form 2018-03-01 11:55:35 -07:00
Matthew Flatt
ae0ce206f8 reader: source location for #lang language 2018-03-01 09:40:33 -07:00
Matthew Flatt
a668a6a674 expander: fix compilation of top-level begin-for-syntax 2018-03-01 08:22:22 -07:00
Matthew Flatt
618d362f09 load, ...: make sure load handlers receive paths 2018-03-01 07:56:44 -07:00
Matthew Flatt
c59c961ebc read: restore some lost source-location reporting 2018-03-01 07:54:03 -07:00
Matthew Flatt
57b6a1402f fix evaluation of #%variable-reference variants 2018-03-01 06:00:21 -07:00
Matthew Flatt
e6bab71e8a unbreak namespace-variable-value
Repair a mistake in b4f0499256.
2018-02-28 20:33:43 -07:00
Matthew Flatt
8f9fcb02f3 expander: fix sealed initial parameterization 2018-02-28 19:36:28 -07:00
Matthew Flatt
9cd4f44d42 vector*-set!: repair to disallow an impersonator 2018-02-28 18:57:48 -07:00
Matthew Flatt
6fc9368d5c revert a keyword-argument expansion that confuses TR
A change in keyword-argument expansion was intended to avoid
copy-propagation wrok in later passes. That saving does not appear to
be worthwhile, so revert it.

Reverting the change exposed weakness in the expander flattener and an
unsoundness in its simplification pass. That unsoundness has to do
with the assumption that variables are defined before use. The unsound
assumption is likely to be fine for code that is flattened --- all the
more considering that flattened code is routinely run in unsafe mode
--- but it's a departure from the intended safety of the simplifier.
Improving the analysis to so that it's sound and good enough will
require sometimes inferring when a structure-type property guard (for
`prop:evt`, at least) will succeed.
2018-02-28 18:49:58 -07:00
Matthew Flatt
b4f0499256 expander: add 'protected property to protected references
As documented and as implemented by the old expander.
2018-02-28 17:14:06 -07:00
Matthew Flatt
24a4882e5d linklet evaluation: correctly install prompt in a no-JIT build 2018-02-28 16:23:51 -07:00
Matthew Flatt
6018dcfdf6 expander: propagate module properties to #%module-begin
Closes #1968
2018-02-28 14:23:22 -07:00
Matthew Flatt
de27be536d expander: propagate srcloc on rename-transformer expansion 2018-02-28 13:59:13 -07:00
Matthew Flatt
3c69a1296a expander: pay more attention to (error-print-source-location)
When source locations are disabled, don't include a source location in
an error message from `raise-syntax-error`.
2018-02-28 13:08:22 -07:00
Matthew Flatt
25b0c23db7 expander: adjust bindings in module->namespace
Make the module path index for bindings in a `module->namespace` be a
"self" MPI (with #f for path and base), instead of the MPI associated
with bindings as view from the outside of the module instance. That
makes interactive evalaution in the namespace more closely approximate
expansion within the original module.

Example use: ASL detects a "self" MPI to determine when it should
allow assignment to module-defined variables in the REPL.
2018-02-28 10:30:24 -07:00
Matthew Flatt
4eacbbd296 change makefile to be more helpful for "seletc-startup.rkt" failure 2018-02-28 06:56:16 -07:00
Matthew Flatt
e4296f5c1e add stdout logging in the same style as stderr logging
Use stdout log reporting instead of stderr log reporting for status
reporting during the build, so that the status report is not
misinterpreted as an error.
2018-02-28 06:52:55 -07:00
Ryan Culpepper
19df146ccf expand and expand-to-top-form unset observer parameter
This change means that if a macro transformer calls expand (not
local-expand, but top-level expand), the macro debugger won't
receive the inner expand's events. Previously, the macro debugger
tried to parse and then discard the inner expand, but that was
brittle and complicated the grammar.
2018-02-28 06:11:00 -07:00
Ryan Culpepper
ceee75b5ce make symbols consistent with macro debugger, send events as symbols 2018-02-28 05:37:22 -07:00
Ryan Culpepper
2f7c0dd9fa fix/simplify logging for main expand and expand-to-top-form 2018-02-28 05:36:52 -07:00
Ryan Culpepper
3a40125168 add arity checks for log-expand, fix some uses 2018-02-28 05:36:52 -07:00
Ryan Culpepper
ed3d2d0082 fix typo 2018-02-28 05:36:52 -07:00
Matthew Flatt
408a8cb79e compiler/cm: repair for chained compiled-file roots 2018-02-27 20:23:13 -07:00