Commit Graph

62 Commits

Author SHA1 Message Date
Matthew Flatt
d7eddb91ef fix compiler/zo-marshal
Missed some updates for recent local-type changes. Also, fix up a
few field names in the demodularizer.
2012-11-15 06:18:05 -07:00
Matthew Flatt
bdf1c3e165 bytecode compiler: generalize local-type tracking for unboxing
Track fixnum results in the same way as flonum results to enable
unboxing, if that turns out to be useful. The intent of the change,
though, is to support other types in the future, such as "extnums".

The output `raco decompile' no longer includes `#%in', `#%flonum',
etc., annotations, which are mostly obvious and difficult to
keep in sync with the implementation. A local-binding name now
reflects a known type, however.

The change includes a bug repair for he bytecode compiler that
is independent of the generalization (i.e., the new test case
triggered the old problem using flonums).
2012-11-14 19:37:01 -07:00
Matthew Flatt
d7bf677645 track import "shapes" as procedure or structure type
Shape information allows the linker to check the importing
module's compile-time expectation against the run-time
value of its imports. The JIT, in turn, can rely on that
checking to better inline structure-type predicates, etc.,
and to more directy call JIT-generated code across
module boundaries.

In addition to checking the "shape" of an import, the import's
JITted vs. non-JITted state must be consistent. To prevent shifts
in JIT state, the `eval-jit-enabled' parameter is now restricted
in its effect to top-level bindings.
2012-10-30 13:29:28 -06:00
Matthew Flatt
e59066debe bytecode validator: check "constant" annotations on variable references
Bytecode changes in two small ways to help the validator:
 * a cross-module variable reference preserves the compiler's
   annotation on whether the reference is constant, fixed, or other
 * lifted procedures now appear in the module body just before the
   definitions that use them, instead of at the beginning of the
   module body
2012-10-19 11:27:52 -06:00
Matthew Flatt
0bd53a3549 compiler/zo-marshal: repair mashaling of import info in syntax 2012-08-06 15:32:27 -06:00
Matthew Flatt
577cf4592e fix problems with references to bindings at higher phases 2012-06-27 09:57:50 -06:00
Matthew Flatt
6173b7eb05 fix zo-parse, zo-struct, etc. for context in whole-module import 2012-06-23 05:21:53 -07:00
Matthew Flatt
d93f4214a4 fix `compiler/zo-parse', etc. for phase-shift addition 2012-05-13 09:00:28 -06:00
Matthew Flatt
f099eec2af save modidx submodule path in bytecode form
This change should have been part of 9ba663aa77.
2012-04-26 21:45:00 -06:00
Matthew Flatt
3d69dfab86 first cut at submodules 2012-03-09 10:34:56 -07:00
Matthew Flatt
779b419c03 first cut at cross-module function inlining
Inline only trivial functions, such as `(empty? x)' -> `(null? x)',
to avoid generating too much code.

Bytecode includes a new `inline-variant' form, which records a
version of a function that is suitable for cross-module inlining.
Mostly, the variant let the run-time system to retain a copy
of the bytecode while JITting (and dropping the bytecode of)
the main variant, but it may be different from the main variant
in other ways that make it better for inlining (such a less loop
unrolling).
2011-11-30 07:39:36 -07:00
Matthew Flatt
d3c56c9f13 generalized `begin-for-syntax' 2011-09-08 14:06:00 -06:00
Matthew Flatt
7eb2042bd9 fix compiler handling of top-/module-level constants
The JIT and bytecode compiler disagreed on the definition of
"constant". Now there are two levels: "constant" means constant across
all instantiations, and "fixed" means constant for a given instantation.
The JIT uses this distinction to generate direct-primitive calls
or not. (Without the distinction, a direct jump to `reverse' could
be wrong, because `racket/base' might get instantiated with the
JIT disabled or not.)

Also, fixed a bug in the JIT's `vector-set!' code in the case that
the target vector is a top-/module-level reference that is ready,
fixed, or constant.
2011-08-19 06:32:44 -06:00
Matthew Flatt
69ad39d45c fix `compiler/zo-parse' & co. 2011-06-30 08:24:41 -06:00
Matthew Flatt
8ad8d5b7f7 fix tl-map parse & marshal 2011-05-09 12:24:05 -06:00
Matthew Flatt
a4da2a3f4c fix varref' in compiler/zo-structs', etc.
and sync docs better with implementation
2011-05-09 09:43:32 -06:00
Matthew Flatt
e9721058fb reorgnize datatypes of less common bytecode forms
removing a layer of indirection, and setting up
 for an internal reorganization of the compiler code
2011-05-06 06:56:23 -06:00
Matthew Flatt
87a4132b40 fix zo-marshal' for #f toplevel-map in lam' 2011-05-03 14:43:27 -06:00
Matthew Flatt
2ada6d0e89 break link to namespaces from from closures over top-/module-level vars
- the `lam' structure from `compiler/zo-struct' changed to include a
   `toplevel-map' field

 This change helps solve a finalization problem in `racket/draw',
 which in turn sigificantly reduces the peak memory use of `raco setup'
 during the doc-building phase (because some documents load `racket/draw'
 to render images, and multiple copies of `racket/draw' were retained
 before finalization was fixed).

 The change is an extreme way to solve a specific finalization
 problem, but it's a kind of space-safety improvement; space safety
 almost never matters, but when it does, then working around a lack of
 space safety is practically impossible. In this case, it's not clear
 how to otherwise solve the `racket/draw' finalization problem.

 The improvement doesn't change the representation of closures, but it
 requires special cooperation with the GC. All closures in a module
 continue to share the same array of globals (plus syntax objects);
 that is, instead of completely flat closures, Racket uses a two-level
 environment where top-/module-level variables are grouped
 together. The code half of a closure now records which
 top-/module-level variables the body code actually uses, and the mark
 phase of GC consults this information to retain only parts of the
 top-/module-level environment frame that are actually used by some
 closure (or all of the frame if it is accessible through some other
 route).  In other words, the GC supports a kind of "dependent
 reference" to an array that is indexed by positions into the array
 --- except that the code is more in the "Racket" directory instead of
 the "GC" directory, since it's so specific to the closure
 representation.
2011-05-03 06:57:49 -06:00
Matthew Flatt
0754ad0114 safe-for-space repairs for functions with rest args 2011-04-22 15:59:33 -06:00
Matthew Flatt
97ce26b182 cache loaded compiled modules
using a SHA1 hash stored in the marshaled bytecode; this cache
 lowers the cost of sandboxes or other uses of multiple namespaces
 when the code inspector doesn't change; the caching is almost
 transparent, but an eval handler might be called with compiled
 code that cannot be written
2011-04-16 13:24:58 -06:00
Blake Johnson
a315f79ebd rolling back some unnecessary changes 2010-10-29 19:50:12 -06:00
Blake Johnson
43e151f340 using hasheq in zo-marshal 2010-10-29 19:50:11 -06:00
Blake Johnson
77c46d07ee debugging 2010-10-29 19:50:11 -06:00
Blake Johnson
7bffbc31a2 Avoiding cycles in everything but closures 2010-10-29 19:50:11 -06:00
Blake Johnson
d84b78daab offset calculation fix 2010-10-29 19:50:11 -06:00
Blake Johnson
c88eb704c7 removing indirects from zo handling 2010-09-16 12:45:37 -06:00
Blake Johnson
3433af0a30 fixing pr11175, added only-rest-arg-not-used flag 2010-09-10 14:46:04 -06:00
Blake Johnson
170ab47dc2 fixing pr11036 by adding plain certificates 2010-09-10 14:46:04 -06:00
Blake Johnson
6338a97e0a removing debugging information 2010-09-10 14:46:04 -06:00
Blake Johnson
0d136ba4c7 never sharing hashes and trace debugging 2010-09-10 14:46:03 -06:00
Blake Johnson
32a9e60abe traversing inside closures and using a seen set for lists 2010-09-10 14:46:03 -06:00
Blake Johnson
2dfaab00f4 fixing closure problem 2010-09-10 14:46:03 -06:00
Blake Johnson
ecc9ceb842 zo-marshal fixes and switching back to prefabs 2010-09-10 14:46:03 -06:00
Blake Johnson
c2fee2a2f0 handling closures while writing symbol table 2010-09-10 14:46:03 -06:00
Blake Johnson
893294674a quoting parameter and not prefab structs 2010-09-10 14:46:02 -06:00
Blake Johnson
54f2d34a2e encoding wraps and fixes for zo-marshal sharing 2010-09-10 14:46:02 -06:00
Blake Johnson
88dcab6b5a traverse while writing rather than a separate step 2010-09-10 14:46:02 -06:00
Blake Johnson
9599304ca9 zo-marshal fixes and read.c fix for hash tables in symbol table 2010-09-10 14:46:02 -06:00
Blake Johnson
37f07cb68b zo-marshal single out-anything function and zo-parse debugging 2010-09-10 14:46:01 -06:00
Matthew Flatt
0d9f5016ba fix bytecode-writing inconsistencies related to syntax objects and paths
and improve organization of the docs
2010-08-17 17:18:24 -06:00
Blake Johnson
f4abd35f5c better traversal for more sharing in zo-marshal and some refactoring. 2010-08-04 17:09:57 -06:00
Blake Johnson
b062c900a1 cases for more complicated lexical renames 2010-08-03 15:40:41 -06:00
Blake Johnson
551ef5ba30 applying make-prefab-struct 2010-08-02 19:27:28 -06:00
Blake Johnson
7653ce037b another all-from-module fix 2010-08-02 19:26:32 -06:00
Blake Johnson
63c6cc5d2c Added case in zo-marshal for prefab structs
Made quoted not-prefab so it isn't captured by prefab case
2010-07-30 15:44:52 -06:00
Blake Johnson
80c6ba482d better certificate handling in zo-parse and zo-marshal 2010-07-30 14:37:17 -06:00
Blake Johnson
2dfd340031 added another case for all-from-module renames 2010-07-28 14:45:07 -06:00
Blake Johnson
53fdc09e7a Do not use CPT_ESCAPE for every CPT_QUOTE, instead if it was a protect-quote, then just put the CPT_QUOTE in. 2010-07-27 13:39:43 -06:00
Jay McCarthy
8d36dfad81 Fixing parts of zo-marshal re protect-quote; parallelizing zo-test; there is no the path error again in zo-marshal though 2010-07-27 11:10:54 -06:00