Commit Graph

38922 Commits

Author SHA1 Message Date
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
9c104a8ea4 improve zo-{parse,marshal} test
After a RacketCS build, a random ".zo" file may not work for the
current Racket variant, so only try ".zo" files that can work.
2018-06-27 17:21:54 -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
Sam Tobin-Hochstadt
30eb06874b Retry fetching from unicode.org when it fails. 2018-06-22 11:18:54 -04: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
61f59a2476 ffi/unsafe docs: clarify C->Racket transtion for _[std]bool
Closes #1817
2018-06-20 18:25:25 -06:00
Matthew Flatt
6ec6b39827 reference: document the synchronizaion result of delay/sync
... and, by implication, `delay/therad`.

Closes 1820
2018-06-20 18:19:57 -06:00
Matthew Flatt
4f658904b5 reference: mention that a place is managed by a custodian
Closes #1824
2018-06-20 18:18:15 -06:00
Matthew Flatt
2a5f8408d1 ffi/unsafe docs: clarify allocation by (_ptr o ...)
Closes #1827
2018-06-20 18:08:17 -06:00
Matthew Flatt
f3fc583c6f ffi/unsafe: document make-late-weak-{box,hasheq}
Closes #1828
2018-06-20 18:05:41 -06: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
76c30df8e6 fix docs of make-custom-set-types
Notice that the vales returned by make-custom-hash-types have a
different order.

Thanks to Jos Koot for the report.
2018-06-20 19:39:26 -03: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
Matthew Flatt
0b71883833 reference: further corrections to the surrogate docs 2018-06-19 20:01:59 -06:00
Leif Andersen
b7cb35fd66 Update technical bugs in the surrogate docs.
It claimed two extra methods were generated when no
(#:use-wrapper-proc) was provided: (set/get)-surrogate-wrapper-proc.

Removes that claim from the docs.

Also fix a few minor stray punctuation marks.
2018-06-19 19:43:44 -06:00
Winston Weinert
99a627b195 Add key phrase "best practices" to style guide
I tried Googling for Racket best practices, and could not easily find
the style guide. Adding these key words to the text should improve
discovery of the style guide when one forgets the key word "style" :)
2018-06-19 19:34:35 -06:00
Gustavo Massaccesi
17acb7458b avoid compiler warning in jit 2018-06-19 19:27:35 -06:00
Matthew Flatt
a9601e3fe7 adjust some filesystem tests to work as root
Closes #2137
2018-06-19 18:01:41 -06:00
Matthew Flatt
ea31e6c810 docs: typo repairs in the linklets chapter 2018-06-19 16:04:27 -06:00
Matthew Flatt
b9401a7a2a docs: fix "linklet directory" that should be "linklet bundle"
Closes #2138
2018-06-19 16:04:27 -06:00
Matthew Flatt
931db97fc0 docs: correct and improve docs for instance-set-variable-value!
Closes #2139
2018-06-19 16:04:27 -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
f95fcb64c0 syntax:read-xml: test that src argument becomes the syntax-source 2018-06-18 19:52:52 -04:00
AlexKnauth
7ec97942c0 add documentation for src argument to syntax:read-xml 2018-06-18 19:52:52 -04:00