1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

661 commits

Author SHA1 Message Date
Andy Wingo
6f1b620b82 Add -Ooptimize-known-return-types at -O2
* module/language/cps/optimize.scm (optimize-first-order-cps):
* module/system/base/optimize.scm (available-optimizations): Add
optimize-known-return-types at -O2.
2021-11-15 15:32:54 +01:00
Andy Wingo
dad113d80f Add new pass to optimize away return value count checks
* module/language/cps/return-types.scm: New file.
* module/Makefile.am (SOURCES):
* am/bootstrap.am (SOURCES): Add new file.
* module/language/tree-il/compile-cps.scm (sanitize-meta): Strip
  "noreturn" and "return-type" properties -- these should only be
  computed by Guile.
2021-11-15 15:32:54 +01:00
Andy Wingo
5c76381625 Allow callk to continue to kargs
* module/language/cps/verify.scm (check-arities): If a callk continues
to kargs, the caller knows the number of return values that the callee
provides and no number-of-values check is needed.
* module/language/cps/contification.scm (apply-contification): Allow
contification of known-return-values calls.
* module/language/cps/reify-primitives.scm (uniquify-receive)
(reify-primitives): No need for uniquify-receive any more as receive
shuffles are attached to the call, not the continuation.
* module/language/cps/compile-bytecode.scm (compile-function): Add kargs
case.
2021-11-15 15:32:54 +01:00
Andy Wingo
4fcd643adb Refactor send and receive shuffles in slot allocation
* module/language/cps/slot-allocation.scm (lookup-send-parallel-moves):
Rename from `lookup-parallel-moves'.
(lookup-receive-parallel-moves): New function.  Now we attach "receive
moves" to call and prompt conts instead of to their continuations.
(compute-shuffles): Refactor to allow a continuation to have both send
and receive shuffles.
(compute-frame-size): Refactor for new shuffles mechanism
(allocate-slots): Allow calls to proceed directly to kargs.
2021-11-15 15:32:54 +01:00
Andy Wingo
a227c84a76 Refactor compile-bytecode
* module/language/cps/compile-bytecode.scm (compile-function): Treat
$kreceive as a forwarding cont, and refactor the treatment of calls and
$values.
2021-11-15 15:32:54 +01:00
Daniel Llorens
c6b1171c6b Avoid ash with arguments that might overflow in (language cps types)
Fixes https://debbugs.gnu.org/50609

* module/languages/cps/types.scm (ulsh): As stated.
2021-11-05 10:26:57 +01:00
Andy Wingo
e60469c8b6 Add primitive alias analysis to CSE
* module/language/cps/effects-analysis.scm (compute-known-allocations):
(compute-clobber-map): Add "conts" parameter, and use it to compute
primcalls that access known allocations.  A write to a known allocation
only clobbers a read to a known allocation if they are the same.
* module/language/cps/cse.scm (eliminate-common-subexpressions-in-fun):
Pass conts also to compute-clobber-map.
2021-10-03 21:39:46 +02:00
Andy Wingo
71e201d5c4 Use more logtest in cse.scm
* module/language/cps/effects-analysis.scm (causes-effect?):
(effect-clobbers?): Use logtest.
2021-10-03 21:09:41 +02:00
Andy Wingo
c9c16db694 Allow primcalls with multiple defs
* module/language/cps/types.scm (infer-types): Allow multiple defs.
2021-10-01 11:33:13 +02:00
Andy Wingo
426867ac7d Add CPS pretty-printer
* module/language/cps/dump.scm: New file.
* module/Makefile.am (SOURCES): Add to build.
2021-10-01 11:33:10 +02:00
Andy Wingo
c8c35c6987 Allow unchecked functions to have unboxed arguments
* module/language/cps/utils.scm (compute-var-representations): Use
'arg-representations from metadata for arg representations.
* module/language/tree-il/compile-cps.scm (sanitize-meta):
(convert): Make sure incoming terms have no arg representations.
2021-10-01 11:28:22 +02:00
Andy Wingo
8fab68f8b1 Move live variable computation routines to utils and graphs.
* module/language/cps/graphs.scm (rename-keys, rename-intset)
(rename-graph, compute-reverse-control-flow-order)
(compute-live-variables): Move here from slot-allocation.
* module/language/cps/utils.scm: Remove duplicate compute-idoms
definition.
(compute-defs-and-uses, compute-var-representations): Move here from
slot-allocation.
* module/language/cps/slot-allocation.scm: Move routines out to utils
and graphs.
2021-10-01 11:28:22 +02:00
Andy Wingo
17aab66e75 Fix bug in eq-constant? propagation in CSE if kf == kt
* module/language/cps/cse.scm (compute-out-edges): Only propagate
constant to successor if successor not kf.
* test-suite/tests/compiler.test ("cse auxiliary definitions"):
("closure conversion"): Refactor.
("constant propagation"): New test.

Fixes #48368.
2021-05-24 11:09:24 +02:00
Andy Wingo
12fa7d115d Fix closure-conversion bug for SCC with all free vars pruned
* module/language/cps/closure-conversion.scm (convert-one): Fix bug when
getting value of SCC whose free variables have been elided.  Thanks to
abcdw for the report!
* test-suite/tests/compiler.test ("cse auxiliary definitions"): Remove
spurious newline.
("closure conversion"): New test.
2021-04-27 14:51:38 +02:00
Andy Wingo
b7822d9e4a Allow contification for $callk
* module/language/cps/contification.scm (compute-first-class-functions):
(compute-functions-called-by-label):
(compute-functions):
(compute-arities):
(compute-contification-candidates):
(compute-call-graph):
(compute-contification):
(apply-contification):
(contify): Given that the frontend will produce $callk now, allow it to
be contified if such callees are all called with the same continuation.
2021-04-26 16:05:21 +02:00
Andy Wingo
2b58c49e59 Fix CPS optimizations to allow callk in front half
* module/language/cps/closure-conversion.scm: Use standard
compute-reachable-functions and intmap-select from utils to filter
reachable functions, allowing us to pick up callk.  Adapt some uses to
expect callk for calls.
* module/language/cps/self-references.scm (resolve-self-references):
Subst the proc, if it's there.
* module/language/cps/split-rec.scm (compute-free-vars): Add a case for
callk.
2021-04-26 16:05:13 +02:00
Andy Wingo
83023160b1 Simplify module variable lookup slow-path
* libguile/intrinsics.h:
* libguile/intrinsics.c (lookup_bound_public, lookup_bound_private): Two
new intrinsics.
(scm_bootstrap_intrinsics): Wire them up.
* libguile/jit.c (compile_call_scm_from_scmn_scmn):
(compile_call_scm_from_scmn_scmn_slow):
(COMPILE_X8_S24__N32__N32__C32): Add JIT support for new instruction
kind.
* libguile/vm-engine.c (call-scm<-scmn-scmn): New instruction, takes
arguments as non-immediate offsets, to avoid needless loads and register
pressure.
* module/language/cps/effects-analysis.scm: Add cases for new
primcalls.
* module/language/cps/compile-bytecode.scm (compile-function): Add new
primcalls.
* module/language/cps/reify-primitives.scm (cached-module-box): If the
variable is bound, call lookup-bound-public / lookup-bound-private as
appropriate instead of separately resolving the module, name, and doing
the bound check.
* module/language/tree-il/compile-bytecode.scm (emit-cached-module-box):
Use new instructions.
* module/system/vm/assembler.scm (define-scm<-scmn-scmn-intrinsic):
(lookup-bound-public, lookup-bound-private): Add assembler support.
2021-04-26 09:48:52 +02:00
Andy Wingo
976433d667 Fix cached-module-box cache keys
* module/language/cps/reify-primitives.scm (cached-module-box): Include
public? in cache key, so we don't accidentally alias private and
exported names.  Also include bound?, to avoid a window in which thread
A resolves and caches var V in preparation for setting it, but thread B
sees V for ref before it was initialized.
2021-04-25 20:27:34 +02:00
Andy Wingo
5809279b99 Fix bugs introduced when allowing $kfun -> $kargs
* module/language/cps/dce.scm (compute-known-allocations):
* module/language/cps/simplify.scm (eta-reduce): Allow the case-lambda
without clauses.
2021-04-25 13:33:06 +02:00
Andy Wingo
39619988e4 Fix comments in cps/compile-bytecode
* module/language/cps/compile-bytecode.scm (compile-function): Fix
unfinished comments.
2021-04-23 21:42:44 +02:00
Andy Wingo
86e86ec1c7 New pass: elide-arity-checks
* module/language/cps/elide-arity-checks.scm: New file.  Elides argument
count checks for known callers.
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add new file.
* module/language/cps/optimize.scm (optimize-first-order-cps):
* module/system/base/optimize.scm (available-optimizations): Add new
pass.
2021-04-21 22:41:12 +02:00
Andy Wingo
8aacaad96a Allow $kargs as entry of $kfun
* module/language/cps.scm:
* module/language/cps/contification.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/types.scm: Allow $kargs to follow $kfun.  In that
case, the function must be well-known and callers are responsible for
calling with the appropriate arity.
* module/language/cps/compile-bytecode.scm: Emit "unchecked-arity" for
$kargs following $kfun.
* module/system/vm/assembler.scm: Adapt.
2021-04-21 22:41:12 +02:00
Andy Wingo
f5b3506ece Optimize eof-object?
* module/language/cps/types.scm (constant-type): Add case for EOF.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect+exception-free-primitives*): Add case for eof-object?.
  (eof-object?): Expand to eq? on the-eof-object.
2021-02-03 23:02:27 +01:00
Andy Wingo
8b994be59f CSE computes online map of constant values, uses it to fold branches
* module/language/cps/cse.scm (intset-intersect*): New helper.  Use it
  to replace manual uses.
  (lset-unionq, meet-constants, adjoin-constant, set-constants): New
  helpers.
  (compute-consts): New function, to compute constants at each label,
  using not only definitions but flow.
  (<analysis>): Add consts to analysis.
  (elide-predecessor, prune-branch, forward-branch, compute-out-edges)
  (propagate-analysis, eliminate-common-subexpressions-in-fun): Plumb
  consts through the algorithm.
  (fold-branch): Fold an eq-constant? using the flow-determined constant
  info.  Finally allows compile-bytecode to fold to switch statements!
* module/language/cps/optimize.scm (optimize-first-order-cps): Move
  branch chain optimization before the final CSE/DCE pass.
2020-08-26 10:04:20 +02:00
Andy Wingo
03998db647 Add new pass to optimize branch chains to table dispatch
* module/language/cps/switch.scm: New pass.

* module/Makefile.am (SOURCES):
* am/bootstrap.am (SOURCES): Add switch.scm.

* module/system/base/optimize.scm (available-optimizations):
* module/language/cps/optimize.scm (optimize-first-order-cps): Run
  switch optimization at level 2.

* libguile/hash.c (JENKINS_LOOKUP3_HASHWORD2): Add note regarding
  cross-compilation.

* module/language/cps/graphs.scm (intmap-select): New definition.
* module/language/cps/utils.scm (compute-singly-referenced-labels): Move
  here, from various places.  Doesn't take a body intset argument.

* module/language/cps/contification.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/simplify.scm: Use compute-singly-referenced-labels
  from utils.

* module/language/cps/effects-analysis.scm (annotation->memory-kind*):
  (annotation->memory-kind): Add symbol annotation cases.
2020-08-12 23:30:08 +02:00
Andy Wingo
cd5ab6377b Add $switch CPS term kind
* module/language/cps.scm ($switch): New term.
* doc/ref/compiler.texi (CPS in Guile): Add documentation.

* module/language/cps.scm (build-term, parse-cps, unparse-cps)
* module/language/cps/closure-conversion.scm (compute-non-operator-uses)
  (compute-singly-referenced-labels, rewrite-shared-closure-calls)
  (compute-free-vars, convert-one)
* module/language/cps/compile-bytecode.scm (compile-function)
* module/language/cps/contification.scm (compute-singly-referenced-labels)
  (compute-contification-candidates, apply-contification)
* module/language/cps/cse.scm (compute-truthy-expressions)
  (forward-cont, term-successors, eliminate-common-subexpressions-in-fun)
* module/language/cps/dce.scm (compute-known-allocations)
  (compute-live-code, process-eliminations)
* module/language/cps/devirtualize-integers.scm (compute-use-counts)
  (peel-trace)
* module/language/cps/effects-analysis.scm (compute-effects)
* module/language/cps/licm.scm (hoist-one, hoist-in-loop)
* module/language/cps/loop-instrumentation.scm (compute-loop-headers)
* module/language/cps/peel-loops.scm (rename-cont)
* module/language/cps/renumber.scm (sort-labels-locally, renumber)
* module/language/cps/rotate-loops.scm (rotate-loop)
  (rotate-loops-in-function)
* module/language/cps/self-references.scm (resolve-self-references)
* module/language/cps/simplify.scm (compute-singly-referenced-vars)
  (eta-reduce, compute-singly-referenced-labels, beta-reduce)
* module/language/cps/slot-allocation.scm (compute-defs-and-uses)
  (add-prompt-control-flow-edges, compute-var-representations)
* module/language/cps/specialize-numbers.scm (compute-significant-bits)
* module/language/cps/split-rec.scm (compute-free-vars)
* module/language/cps/type-fold.scm (local-type-fold)
* module/language/cps/types.scm (successor-count, infer-types)
* module/language/cps/utils.scm (compute-function-body)
  (compute-successors, compute-predecessors)
* module/language/cps/verify.scm (compute-available-definitions)
  (check-valid-var-uses, check-arities): Add support for new term.
2020-08-12 23:30:08 +02:00
Andy Wingo
d238566d0e CPS compiler reduces eq? on constant to eq-constant?
* module/language/cps/compile-bytecode.scm (compile-function): Expect
  eq-constant? instead of eq-null?, etc.
* module/language/cps/effects-analysis.scm: Likewise.
* module/language/cps/reify-primitives.scm (reify-primitives): For
  eq-constant?, reify a $const unless the constant is an immediate whose
  encoding fits in 16 bits.
* module/language/cps/type-fold.scm (materialize-constant): Helper to
  make a constant from a type, min, and max.
  (fold-eq-constant?): New helper.
  (eq-constant?): New folder.
  (undefined?): Define specifically.
  (define-nullish-predicate-folder): Renamd from
  define-special-immediate-predicate-folder.  Use only for null?, false,
  and nil?.
  (*branch-reducers*): New mechanism.  Reduce eq? to eq-constant? if
  possible.
  (local-type-fold): Refactor to use materialize-constant, and to allow
  reducing branches.
* module/language/cps/types.scm (constant-type): Return three values
  instead of a type entry.
  (constant-type-entry): New function that returns a type entry.  Adapt
  callers.
  (infer-constant-comparison): New helper.
  (eq-constant?): New inferrer.
  (undefined?): New inferrer.
* module/language/tree-il/compile-bytecode.scm (eq-constant?): Fix
  truncate-bits signed arg.
  (define-immediate-type-predicate): Adapt to visit-immediate-tags
  change.
* module/language/tree-il/compile-cps.scm (convert): Convert eq? to
  constant to eq-constant?.  Advantaged is that it gets fixnums and
  chars in addition to special immediates.
* module/language/tree-il/cps-primitives.scm (define-immediate-type-predicate):
  Adapt to allow #f as pred.
* module/system/base/types/internal.scm (immediate-tags): Use #f as pred
  for false, nil, etc.
  (immediate-bits->scm): Adapt.
* module/system/vm/assembler.scm (emit-eq-null?, emit-eq-nil?)
  (emit-eq-false?, emit-eq-true?, emit-unspecified?, emit-eof-object?):
  Remove specialized emitters.
* module/system/vm/assembler.scm (define-immediate-tag=?-macro-assembler):
  Allow for pred to be #f.
* module/system/vm/disassembler.scm (define-immediate-tag-annotation):
  Adapt to pred being #f.
2020-08-03 22:19:18 +02:00
Andy Wingo
fc139231a6 Make CSE more robust
* module/language/cps/cse.scm (eliminate-common-subexpressions-in-fun):
  I think it's possible to get an orphan loop, with predecessors
  after successors in the original RPO.  Handle that here.
2020-06-12 15:58:54 +02:00
Andy Wingo
411954c961 Fix typo causing performance problems!!!
* module/language/cps/cse.scm (eliminate-common-subexpressions-in-fun):
  Amazingly this typo causes Guile to be 10% slower or so.  Fixed!
2020-05-29 16:59:08 +02:00
Andy Wingo
4c59ff7e95 CSE forward-propagates changes to CFG
* module/language/cps/cse.scm (propagate-analysis): New helper.
  (eliminate-common-subexpressions-in-fun): Recompute avail and bool set
  in response to simplifications in predecessor CFG.  Allows much better
  compilation of pattern-matching idioms!
2020-05-29 16:33:48 +02:00
Andy Wingo
d9143c32c5 CSE forwards branch predecessors where the branch folds
* module/language/cps/cse.scm (forward-cont, forward-branch)
  (compute-avail-and-bool-edge): New helpers.
  (add-equivalent-expression!): Allow idempotent adds; can happen now
  when revisiting a cont after changes to its predecessors.
  (fold-branch): New helper.
  (eliminate-common-subexpressions-in-fun): Allow for reductions to
  branch predecessors.  In that case, revisit the branch, as the CFG
  will have changed.
2020-05-29 16:33:48 +02:00
Andy Wingo
4837e68315 CSE refactor
* module/language/cps/cse.scm (eliminate-common-subexpressions-in-fun):
  Separate the paths for handling expressions and branches.
2020-05-29 16:33:48 +02:00
Andy Wingo
19ab4d6947 Use intmaps in CSE equivalent expression table
* module/language/cps/cse.scm (make-equivalent-expression-table)
  (intmap-select, add-equivalent-expression!)
  (lookup-equivalent-expressions): New helpers.
  (eliminate-common-subexpressions-in-fun): Adapt.
2020-05-29 16:33:48 +02:00
Andy Wingo
a92c623a66 Eager graph pruning in CSE
* module/language/cps/cse.scm (elide-predecessor, prune-branch)
  (prune-successors, term-successors): New helpers.
  (eliminate-common-subexpressions-in-fun): When we modify the CFG,
  update the analysis.  Also, thread the substs map through CSE so that
  closures in high-level CPS can take advantage of eliminated variables.
  (fold-renumbered-functions): Take multiple seeds.
  (eliminate-common-subexpressions): Thread var substs map through CSE.
2020-05-29 16:33:48 +02:00
Andy Wingo
3c4d4acbd4 Thread flow analysis through CSE pass
* module/language/cps/cse.scm (<analysis>): New data type, grouping
  available expression analysis, predecessor map, etc.
  (eliminate-common-subexpressions-in-fun): Instead of having a static
  analysis, thread it through the CSE pass so that we can update the CFG
  as we go.
2020-05-29 16:33:48 +02:00
Andy Wingo
6fb0635358 CSE eliminates expressions at continuations
* module/language/cps/cse.scm (compute-available-expressions): Take a
  clobber map instead of an effects map.
  (compute-singly-referenced): Remove unused function.
  (eliminate-common-subexpressions-in-fun): Keep a preds map.  Use it
  add entries to the equiv-set and var-substs at expression
  continuations instead of at the expression terms themselves.
2020-05-29 16:33:48 +02:00
Andy Wingo
2318e7238f Refactor CSE to analyze and transform in a single pass
* module/language/cps/cse.scm (compute-truthy-expressions): Operate on a
  single function.
  (eliminate-common-subexpressions-in-fun): Instead of computing a set
  of labels to eliminate, go ahead and do the elimination as we go.
  (fold-renumbered-functions): Can just use a single seed now.
  (eliminate-common-subexpressions): Simplify to just fold over
  functions, building up renamed output as we go.
2020-05-29 16:33:48 +02:00
Andy Wingo
6e91173334 Refactor CSE to take advantage of RPO numbering
* module/language/cps/cse.scm (fold-renumbered-functions): New helper.
  (compute-equivalent-expressions): Use new helper.
  (compute-equivalent-expressions-in-fun): Lift to top-level.
  (eliminate-common-subexpressions): Adapt.
2020-05-29 16:33:48 +02:00
Andy Wingo
cf948e0f6f Renumber before CSE
* module/language/cps/cse.scm (compute-equivalent-subexpressions):
  Assume renumbered program.
  (eliminate-common-subexpressions): Renumber.  Will allow optimizations
  later.
2020-05-29 16:33:48 +02:00
Andy Wingo
d36b9f0422 Slight optimization to invert-bijectiono
* module/language/cps/graphs.scm (invert-bijection): Use a transient
  intmap.
2020-05-28 10:58:09 +02:00
Andy Wingo
11878e1603 Fix truthy expression analysis in CSE
* module/language/cps/cse.scm (compute-truthy-expressions): The "meet"
  function here is union, not intersection.
2020-05-28 10:02:41 +02:00
Andy Wingo
c5da9d65a7 Fix optimizers after language lowerer refactor
* module/language/cps/optimize.scm (define-optimizer):
  (optimize-higher-order-cps, optimize-first-order-cps):
  (make-cps-lowerer):
* module/language/tree-il/optimize.scm (optimize, make-lowerer): In an
  embarrassing bug, after parsing optimization arguments, we were
  aconsing them instead of the expected cons*.  This meant the bootstrap
  was running all Tree-IL optimizations!  Change to have optimizers not
  have defaults and use alists after parsing.
2020-05-13 09:04:16 +02:00
Andy Wingo
b5108ccb2a Avoid having "guild compile" load optimizers
* module/language/cps/optimize.scm (cps-optimizations):
* module/language/tree-il/optimize.scm (tree-il-optimizations):
* module/system/base/optimize.scm (available-optimizations): Invert the
  dependency tree to hold the names and default optimization levels in a
  central place instead of in the optimizers.  It moves definitions
  farther from uses, but it avoids us having to load the CPS optimizer
  if we don't need it, which improves bootstrap times.
2020-05-11 15:42:20 +02:00
Andy Wingo
85124b0d69 Top-level lookups raise exceptions in run-time
* module/language/cps/reify-primitives.scm (reify-lookup):
* module/language/tree-il/compile-cps.scm (toplevel-box): Instead of
  checking that the result of module-variable is a variable, and
  possibly checking that it's bound, we just call intrinsics that throw
  exceptions if the variable isn't bound.  This reduces useless inlining
  that can't inform CPS optimizations, as they are tangled in diamond
  control flow.
2020-05-11 10:22:56 +02:00
Andy Wingo
4274d615cc Add new lookup, lookup-bound intrinsics
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
* libguile/intrinsics.c (lookup, lookup_bound):
* libguile/intrinsics.c (scm_bootstrap_intrinsics): New intrinsics.
* module/language/cps/reify-primitives.scm (reify-primitives):
* module/language/cps/effects-analysis.scm (current-module):
* module/language/cps/compile-bytecode.scm (compile-function):
* module/system/vm/assembler.scm: Add compiler support.
2020-05-11 10:22:34 +02:00
Andy Wingo
d6b6392cfb Rename "lookup" intrinsic to "module-variable"
It can return #f, unlike scm_(module_)?lookup.

* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
* libguile/intrinsics.c (module_variable, scm_bootstrap_intrinsics):
  Rename.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/effects-analysis.scm (current-module):
* module/language/cps/reify-primitives.scm (reify-lookup)
  (compute-known-primitives):
* module/language/tree-il/compile-bytecode.scm (emit-cached-module-box)
  (emit-cached-toplevel-box, emit-toplevel-box):
* module/language/tree-il/compile-cps.scm (toplevel-box):
* module/system/vm/assembler.scm (module-variable): Adapt users.
2020-05-11 09:46:40 +02:00
Andy Wingo
4311dc9858 Define new "lowering" phase in compiler
* module/language/cps/compile-bytecode.scm (compile-bytecode):
* module/language/tree-il/compile-bytecode.scm (compile-bytecode):
* module/language/tree-il/compile-cps.scm (compile-cps): Rely on
  compiler to lower incoming term already.
* module/language/tree-il/optimize.scm (make-lowerer): New procedure.
* module/system/base/compile.scm (compute-lowerer): New procedure,
  replaceing add-default-optimizations.
  (compute-compiler): Lower before running compiler.
* module/system/base/language.scm (<language>): Change
  optimizations-for-level field to "lowerer".
* module/scripts/compile.scm (%options, compile): Parse -O0, -O1 and so
  on to #:optimization-level instead of expanding to all the
  optimization flags.
* module/language/cps/optimize.scm (lower-cps): Move here from
  compile-bytecode.scm.
  (make-cps-lowerer): New function.
* module/language/cps/spec.scm (cps): Declare lowerer.
2020-05-08 17:07:56 +02:00
Andy Wingo
06709d77b9 Replace bit-position with bitvector-position
The old name was wonky and had bad argument order.

* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/bitvectors.h:
* libguile/bitvectors.c (scm_bitvector_position): New function.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bit_position): Deprecate.
* module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-position
  with bitvector-position.
* module/language/cps/intset.scm (bitvector->intset): Use
  bitvector-position.
* module/system/vm/frame.scm (available-bindings): Use
  bitvector-position.
* test-suite/tests/bitvectors.test ("bitvector-position"): Add test.
2020-04-12 22:39:55 +02:00
Ludovic Courtès
f8f8986e4a 'sort-labels-locally' uses a transient intset.
* module/language/cps/renumber.scm (sort-labels-locally): Use a
transient intset.
2020-03-23 22:49:47 +01:00
Andy Wingo
ef6f7ce70b Fix fixpoint computation in compute-significant-bits
* module/language/cps/specialize-numbers.scm (preserve-eq?): New
  helper.
  (sigbits-union): Use the new helper.  Fixes bugs.gnu.org/38486.
  Thanks to Zack Marvel for the bug report and Matt Wette for tracking
  it down.
2020-03-23 14:49:03 +01:00