Commit Graph

39006 Commits

Author SHA1 Message Date
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
Matthew Flatt
bfa08e40b1 remove debugging output from test 2018-07-16 21:11:48 -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
Tong-Kiat Tan
cc4daf074f Typo (#2169)
* Fix typo for style.scrbl

* Fix typo for scribble.scrbl
2018-07-13 13:49:00 -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
6bc8369af5 remove accidentally committed debugging in test 2018-07-11 04:17:42 -06:00
Sam Tobin-Hochstadt
738fe8a44f decompiler: print void in a read-able form except under quote. 2018-07-10 11:24:51 -04:00
Sam Tobin-Hochstadt
044359c53d decompiler: track primitives from #%linklet module. 2018-07-10 11:24:51 -04: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
shuhung
4d158a8cb8 Fix build-[chaperone-]contract-property document
The keyword argument `#:late-neg-projection [get-late-neg-projection #f]` takes a curried function. The documentation is missing an arrow.
2018-07-05 23:25:37 -10: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
0b022b2ef4 makefile: add cs-base and cs-in-place targets 2018-07-03 09:11:07 -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
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