* module/language/tree-il/compile-cps.scm
(emit-initializations-as-loop): New helper.
(make-vector): Use new helper.
(make-vector/immediate): Emit a loop if the number of words is greater
than or equal to 32. An arbitrary limit that could be adjusted later.
* module/language/tree-il/cps-primitives.scm (allocate-vector)
(vector-init!): Declare these primitives which later go away when
lowering to CPS.
* module/language/tree-il/compile-cps.scm (vector-init!): New
converter.
(allocate-vector): New converter.
* module/language/cps/compile-bytecode.scm (compile-function): Add cases
for mutable-vector? and immutable-vector?.
* module/system/vm/assembler.scm: Export emit-mutable-vector? and
emit-immutable-vector?.
* module/language/cps/types.scm (&mutable-vector, &vector): Separate
type bits.
(&vector): New union type.
(constant-type): Constant vectors are immutable.
* module/language/cps/type-fold.scm (mutable-vector?)
(immutable-vector?): New folders.
(vector?): Add union folder.
* libguile/vm-engine.c (ash): Remove instruction, which hasn't been
emitted for a long time.
* module/system/vm/assembler.scm (emit-ash): Remove export.
* module/language/cps/licm.scm (loop-invariant?): Read or write effects
can be guarded by effect-free branches; prevent hoisting of these
expressions if the term isn't always reachable.
* module/language/tree-il/optimize.scm (optimize): Disable
resolve-primitives below -O2. This is because compile-cps is going to
start expanding all primcalls it sees.
* module/system/base/optimize.scm: New module.
* module/Makefile.am (SOURCES):
* am/bootstrap.am (SOURCES): Add new module.
* module/language/tree-il/optimize.scm (tree-il-optimizations): Rename
from tree-il-default-optimization-options. Directly specify the
optimization level at which a pass should be enabled.
* module/language/cps/optimize.scm (cps-optimizations): Likewise, rename
from cps-default-optimization-options.
* module/scripts/compile.scm (%options, show-optimization-help): Adapt
to use new module.
* module/language/cps/devirtualize-integers.scm (peel-trace): Update
comment.
* module/language/cps/contification.scm (apply-contification): Update to
never contify a return of $primcall to $kreceive.
* module/language/cps/verify.scm (check-arities): Require that primcalls
continue to $kargs.
* module/language/cps/slot-allocation.scm (add-prompt-control-flow-edges):
Allow for terms that don't continue, and add them to the minimal
prompt control flow edges set.
* module/language/cps.scm ($branch): Refactor to be its own CPS term
type, not relying on $continue to specify a continuation (which before
was only for the false case) or a source location. Update allllllll
callers.
* module/language/cps/reify-primitives.scm (reify-primitives): Remove
case where $prim could continue to $kreceive; this isn't possible.
However when reifying an unknown primcall, always add a $kreceive, as
the continuation has to be $kargs.
* module/language/tree-il/compile-cps.scm (convert): Unknown primcalls
convert as calls. With this change, all primcalls should continue to
$kargs, with the exception of 'throw.
* module/language/cps/constructors.scm: Remove pass, as "list" and
"vector" are now inlined by CPS conversion, and nothing in the
optimizer reifies "list" or "vector" primcalls.
* module/language/cps/optimize.scm (optimize-higher-order-cps)
(cps-default-optimization-options):
* am/bootstrap.am:
* module/Makefile.am: Remove references to inline-constructors pass.
* module/language/cps/contification.scm (apply-contification): Inline
returns to the corresponding $kargs.
* module/language/cps/licm.scm (loop-invariant?): Remove handling of
"values" primcall, as this doesn't exist any more.
* module/language/tree-il/compile-cps.scm (build-list): New helper.
(convert, canonicalize): Canonicalize "list" earlier. Allow sinking
of any initializer that can't capture the continuation, not just in
cases where all initializers have this property. Reify a cons chain
internally as appropriate.
* module/language/tree-il/cps-primitives.scm: New file,
replacing (language cps primitives). Lists known primitives and their
relation to Tree-IL explicitly, instead of assuming that any Tree-IL
primcall that shares a name with a bytecode instruction is a CPS
primcall.
* module/language/cps/verify.scm: Remove use of (language cps
primitives) and primcall arity checking. Would be nice to add this
back at some point.
* module/language/tree-il/compile-cps.scm (convert): Refactor to use new
tree-il-primitive->cps-primitive+nargs+nvalues helper.
* module/Makefile.am:
* am/bootstrap.am: Adapt.
* module/language/cps/compile-bytecode.scm (compile-function): Organize
emitters and flesh out with more heap type tag predicates. Remove
now-needless (language cps primitives) import.