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

1328 commits

Author SHA1 Message Date
Andy Wingo
f34688ad25 New instructions load-f64, load-u64
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add word
  types for immediate f64 and u64 values.
  (TYPE_WIDTH): Bump up by a bit, now that we have 32 word types.
  (NOP, parse_instruction): Use 64-bit meta type.

* libguile/vm-engine.c (load-f64, load-u64): New instructions.

* module/language/bytecode.scm (compute-instruction-arity): Add parser
  for new instruction word types.

* module/language/cps/compile-bytecode.scm (compile-function): Add
  special-cased assemblers for new instructions, and also for scm->u64
  and u64->scm which I missed before.

* module/language/cps/effects-analysis.scm (load-f64, load-u64): New
  instructions.

* module/language/cps/slot-allocation.scm (compute-needs-slot): load-f64
  and load-u64 don't need slots.
  (compute-var-representations): Update for new instructions.

* module/language/cps/specialize-primcalls.scm (specialize-primcalls):
  Specialize scm->f64 and scm->u64 to make-f64 and make-u64.

* module/language/cps/types.scm (load-f64, load-u64): Wire up to type
  inference, though currently type inference only runs before
  specialization.

* module/language/cps/utils.scm (compute-defining-expressions): For some
  reason I don't understand, it's possible to see two definitions that
  are equal but not equal? here.  Allow for now.
  (compute-constant-values): Punch through type conversions to get
  constant u64/f64 values.

* module/system/vm/assembler.scm (assembler): Support for new word
  types.  Export the new assemblers.
2015-12-01 11:30:55 +01:00
Andy Wingo
bdfa1c1b42 Add tagged and untagged arithmetic ops with immediate operands
* libguile/vm-engine.c (add/immediate, sub/immediate)
  (uadd/immediate, usub/immediate, umul/immediate): New instructions.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/slot-allocation.scm (compute-needs-slot):
* module/language/cps/types.scm:
* module/system/vm/assembler.scm (system):
* module/language/cps/effects-analysis.scm: Support
  for new instructions.

* module/language/cps/optimize.scm (optimize-first-order-cps): Move
  primcall specialization to the last step -- the only benefit of doing
  it earlier was easier reasoning about side effects, and we're already
  doing that in a more general way with (language cps types).
* module/language/cps/specialize-primcalls.scm (specialize-primcalls):
  Specialize add and sub to add/immediate and sub/immediate, and
  specialize u64 addition as well.  U64 specialization doesn't work now
  though because computing constant values doesn't work for U64s; oh
  well.
2015-12-01 11:30:55 +01:00
Andy Wingo
8f18b71b7a Remove add1 and sub1
* libguile/vm-engine.c: Remove add1 and sub1 instructions.  Will replace
  with add/immediate and sub/immediate.
* module/language/tree-il/peval.scm (peval): If we reify a new
  <primcall>, expand it.  Removes 1- and similar primcalls.
* module/language/tree-il/primitives.scm: Don't specialize (+ x 1) to 1+.
  (expand-primcall): New export, does a single primcall expansion.
  (expand-primitives): Use the new helper.
* module/language/cps/effects-analysis.scm:
* module/language/cps/primitives.scm:
* module/language/cps/types.scm:
* module/system/vm/assembler.scm: Remove support for add1 and sub1 CPS
  primitives.
* test-suite/tests/peval.test ("partial evaluation"): Adapt tests that
  expect 1+/1- to expect +/-.
2015-12-01 11:30:55 +01:00
Andy Wingo
e003466039 Specialize u64 arithmetic
* module/language/cps/specialize-numbers.scm (specialize-operations):
  (specialize-u64-binop): Specialize u64 addition, subtraction, and
  multiplication.
2015-12-01 11:30:55 +01:00
Andy Wingo
d2808b16e5 Better range inference for indexes of vector-ref, string-ref et al
* module/language/cps/types.scm (vector-ref, vector-set!)
  (string-ref, string-set!, struct-ref, struct-set!)
  (define-bytevector-accessors, define-bytevector-uaccessors): Clamp
  range of object and index to be within the range of indices, with a
  maximum of *max-size-t*.
2015-12-01 11:30:55 +01:00
Andy Wingo
672853657c Slower range saturation in type inference
* module/language/cps/types.scm (*max-size-t*): New definition.
  (type-entry-saturating-union): Saturate more slowly, first stopping at
  [0,*max-size-t*] then at [&range-min, &range-max] before saturating to
  [-inf.0, +inf.0].  This allows most offset phi variables to have their
  range inferred within the u64 range.
2015-12-01 11:30:55 +01:00
Andy Wingo
d294d5d1e1 Add unsigned 64-bit arithmetic operators: uadd, usub, umul
* libguile/vm-engine.c (uadd, usub, umul): New ops.
* module/language/cps/effects-analysis.scm (uadd, usub, umul): Add
  effects analysis.
* module/language/cps/slot-allocation.scm (compute-var-representations):
  The new ops define 'u64 values.
* module/language/cps/types.scm (uadd, usub, umul): Add type checkers
  and inferrers.
* module/system/vm/assembler.scm (emit-uadd, emit-usub, emit-umul): New
  assemblers.
2015-12-01 11:30:55 +01:00
Andy Wingo
2906d963ea Unbox u64 phi values
* module/language/cps/specialize-numbers.scm
  (compute-specializable-vars): Refactor to work on any kind of
  unboxable value, not just f64 values.
  (compute-specializable-f64-vars, compute-specializable-u64-vars): New
  helpers.
  (apply-specialization): Support for u64 values.
2015-12-01 11:30:55 +01:00
Andy Wingo
4305b39336 Beginning of u64 phi unboxing
* module/language/cps/specialize-numbers.scm
  (compute-specializable-u64-vars): New stub.
* module/language/cps/specialize-numbers.scm
  (compute-specializable-phis): Rename from
  compute-specializable-f64-phis, and return an intmap instead of an
  intset.  The values distinguish f64 from u64 vars.
* module/language/cps/specialize-numbers.scm (apply-specialization):
  Start of u64 phi unboxing.
* module/language/cps/specialize-numbers.scm (specialize-phis):
  (specialize-numbers): Adapt.
2015-12-01 11:30:55 +01:00
Andy Wingo
163fcf5adb Specialize u64 comparisons
* module/language/cps/specialize-numbers.scm
  (specialize-u64-comparison): New function.
* module/language/cps/specialize-numbers.scm (specialize-operations):
  Rename from specialize-f64-operations, as it will specialize both
  kinds.  Add a case to specialize u64 comparisons.
* module/language/cps/specialize-numbers.scm (specialize-numbers): Adapt
  to specialize-operations name change.
2015-12-01 11:30:55 +01:00
Andy Wingo
07607f66b8 Add instructions to branch on u64 comparisons
* libguile/vm-engine.c (BR_U64_ARITHMETIC): New helper.
  (br-if-u64-=, br-if-u64-<, br-if-u64->=): New instructions.

* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/effects-analysis.scm:
* module/language/cps/primitives.scm (*branching-primcall-arities*):
* module/language/cps/type-fold.scm:
* module/language/cps/types.scm (u64-=, infer-u64-comparison-ranges):
  (define-u64-comparison-inferrer, u64-<, u64-<=, u64->=, u64->):
* module/system/vm/assembler.scm:
* module/system/vm/disassembler.scm (code-annotation):
  (compute-labels): Compiler and toolchain support for the new
  instructions.
2015-12-01 11:30:54 +01:00
Andy Wingo
87cc8b0f97 bv-f{32,64}-{ref,set!} take unboxed u64 index
* module/language/tree-il/compile-cps.scm (convert): bv-f32-ref,
  bv-f32-set!, bv-f64-ref, and bv-f64-set! take the index as an untagged
  u64 value.
* module/language/cps/types.scm (define-bytevector-uaccessors): New
  helper, used while migrating bytevectors to take unboxed indexes.
  Adapt f32/f64 accessors to use this definition helper.
* libguile/vm-engine.c (BV_FLOAT_REF, BV_FLOAT_SET): The index is
  unboxed.
2015-12-01 11:30:54 +01:00
Andy Wingo
8464cc576c Add bv-length instruction
* libguile/vm-engine.c (bv-length): New instruction.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/effects-analysis.scm (bv-length):
* module/language/cps/primitives.scm (*instruction-aliases*):
* module/language/cps/slot-allocation.scm (compute-var-representations):
* module/language/cps/types.scm (bv-length):
* module/language/tree-il/compile-cps.scm (convert): Add support for
  bv-length.
* module/system/vm/assembler.scm: Export emit-bv-length.
2015-12-01 11:30:54 +01:00
Andy Wingo
870ac91a4e Range inference over the full U64+S64 range
* module/language/cps/types.scm (*min-s32*, *max-s32*): Remove unused
  definitions.
  (&range-min, &range-max): New definitions, replacing min-fixnum and
  max-fixnum as the bounds of precise range analysis.
  (type-entry-min, type-entry-max): Store inf values directly as
  -inf.0/+inf.0.
  (type-entry-clamped-min, type-entry-clamped-max): Remove, as they are
  no longer needed.
  (clamp-min, clamp-max, make-type-entry): Clamp minimum and maximum
  half-ranges in different ways.
  (type-entry-union, type-entry-saturating-union)
  (type-entry-intersection): Adapt to type-entry-min / type-entry-max
  change.
  (bv-u32-ref, bv-u32-set!):
  (bv-s32-ref, bv-s32-set!):
  (bv-u64-ref, bv-u64-set!):
  (bv-s64-ref, bv-s64-set!): Precise range inference.  This will allow
  robust unboxing.
  (ash): Infer 64-bit shifts.
2015-12-01 11:30:54 +01:00
Andy Wingo
dfbe869e24 Add low-level support for unboxed 64-bit unsigned ints
* libguile/frames.c (enum stack_item_representation)
* libguile/frames.c (scm_to_stack_item_representation):
  (scm_frame_local_ref, scm_frame_local_set_x): Support 'u64 slots.
* libguile/frames.h (union scm_vm_stack_element): Add as_u64 member.

* libguile/vm-engine.c (SP_REF_U64, SP_SET_U64): New helpers.
  (scm->u64, u64->scm): New instructions.

* module/language/cps/cse.scm (compute-equivalent-subexpressions):
  Scalar replacement for u64->scm and scm->u64.

* module/language/cps/effects-analysis.scm (scm->u64, u64->scm): Add
  cases.

* module/language/cps/slot-allocation.scm (compute-var-representations):
  (allocate-slots): Represent the result of scm->u64 as a "u64" slot.

* module/language/cps/types.scm (&u64): New type.
  (scm->u64, u64->scm): Add support for these ops.

* module/system/vm/assembler.scm (write-arities):
* module/system/vm/debug.scm (arity-definitions): Support u64
  representations.
2015-12-01 11:30:54 +01:00
Andy Wingo
e5d7c0f13b All arities serialize a "closure" binding
* module/language/cps/compile-bytecode.scm (compile-function): Always
  define a 'closure binding in slot 0.
* module/system/vm/frame.scm (available-bindings): No need to futz
  around not having a closure binding.
* module/system/vm/debug.scm (arity-arguments-alist): Expect a closure
  binding.
* test-suite/tests/rtl.test: Emit definitions for the closure.
2015-12-01 10:57:20 +01:00
Andy Wingo
3e5d4131d2 Don't compile equal? to br-if-equal
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/primitives.scm (*branching-primcall-arities*):
* module/language/cps/type-fold.scm (equal?):
* module/language/cps/types.scm (equal?):
* module/language/tree-il/compile-cps.scm (convert): `equal?' is no
  longer a branching primcall, because it isn't inline.  The
  implementation could lead to bad backtraces also, as it didn't save
  the IP, and actually could lead to segfaults as it didn't reload the
  SP after the return.  There is an eqv? fast-path, though.
* module/system/vm/assembler.scm (br-if-equal): Remove interface.
* module/system/vm/disassembler.scm (code-annotation):
  (compute-labels): No need to handle br-if-equal.
2015-11-12 21:22:19 +01:00
Andy Wingo
92ed7f6989 Fix miscompilation of closures allocated as vectors
* module/language/cps/closure-conversion.scm (convert-one): Fix
  miscompilation of vector closure initialization.
2015-11-11 16:30:59 +01:00
Andy Wingo
7dc3e4ba23 Remove debug printout in specialize-numbers
* module/language/cps/specialize-numbers.scm (apply-f64-specialization):
  Remove printout.  I didn't see any when compiling Guile, which means
  that probably this optimization doesn't hit for any code in Guile
  itself, sadly :P
2015-11-11 10:21:43 +01:00
Andy Wingo
80f2726310 Better f64 unboxing for loop vars that might flow to $ktail
* module/language/cps/specialize-numbers.scm (compute-specializable-f64-vars):
  Tweak to allow f64 values to flow directly to return sites.
2015-11-11 10:21:43 +01:00
Andy Wingo
5b9835e1f8 The compiler can unbox float64 loop variables
* module/language/cps/specialize-numbers.scm: Specialize phi variables
  as well.
2015-11-11 10:21:43 +01:00
Andy Wingo
f0594be035 Fix slot representation computation for fadd, fmul, etc
* module/language/cps/slot-allocation.scm (compute-var-representations):
  fadd, fmul and so on also define f64 values.
2015-11-11 10:21:43 +01:00
Andy Wingo
12e9e2148e Add new pass to specialize "add" into "fadd" where possible
* module/language/cps/specialize-numbers.scm: New pass, to turn "add"
  into "fadd", and similarly for sub, mul, and div.

* module/language/cps/optimize.scm:
* module/Makefile.am:
* bootstrap/Makefile.am: Wire up the new pass.
2015-11-11 10:21:43 +01:00
Andy Wingo
3b4941f3a9 Add fadd, fsub, fmul, fdiv instructions
* libguile/vm-engine.c (fadd, fsub, fmul, fdiv): New instructions.

* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm: Wire up support for new instructions.

* module/system/vm/assembler.scm: Export emit-fadd and friends.
2015-11-11 10:21:28 +01:00
Andy Wingo
c438998e48 Scalar replacement for f64->scm
* module/language/cps/cse.scm (compute-equivalent-subexpressions):
  Scalar replacement for float boxes.
2015-11-11 10:21:16 +01:00
Andy Wingo
b1ac8d68b5 bv-{f32,f64}-{ref,set!} operate on raw f64 values
* module/language/tree-il/compile-cps.scm (convert): Box results of
  bv-f32-ref and bv-f64-ref.  Unbox the argument to bv-f32-set! and
  bv-f64-set!.

* libguile/vm-engine.c (bv-f32-ref, bv-f64-ref): Results are raw.
  (bv-f32-set!, bv-f64-set!): Take unboxed arguments.

* module/system/vm/assembler.scm (emit-scm->f64, emit-f64->scm):
  Export.

* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/effects-analysis.scm: Add support for scm->f64 and
  f64->scm.

* module/language/cps/slot-allocation.scm (compute-var-representations):
  Add cases for primops returning raw values.

* module/language/cps/types.scm (bv-f32-ref, bv-f32-set!)
  (bv-f64-ref, bv-f64-set!): Deal in &f64 values instead of reals.
2015-11-11 10:20:12 +01:00
Andy Wingo
608753982f Type inference distinguishes between untagged and tagged flonums
* module/language/cps/types.scm (&f64): New type, for untagged f64
  values.  Having a distinct type prevents type folding from replacing
  an untagged 3.0 with a tagged 3.0.
  (scm->f64, f64->scm): Support these new primcalls.
2015-11-11 10:14:51 +01:00
Andy Wingo
e3cc0eeb3a Reflection support for unboxed f64 slots
* module/system/vm/assembler.scm (emit-definition): Add representation
  field.
  (write-arities): Emit representations into the arities section.

* module/system/vm/debug.scm (arity-definitions): Read representations.

* module/system/vm/frame.scm (<binding>): Add representation field and
  binding-representation getter.
  (available-bindings): Pass representation to make-binding.
  (frame-binding-set!, frame-binding-ref, frame-call-representation):
  Pass representation to frame-local-ref / frame-local-set!.

* test-suite/tests/rtl.test: Update definition instructions.

* module/language/cps/slot-allocation.scm ($allocation): Add
  representations field.
  (lookup-representation): New public function.
  (allocate-slots): Pass representations to make-$allocation.

* module/language/cps/compile-bytecode.scm (compile-function): Adapt to
  emit-definition change.

* libguile/frames.h:
* libguile/frames.c (scm_frame_local_ref, scm_frame_local_set_x): Take
  representation argument.
  (scm_to_stack_item_representation): New internal helper.
2015-10-28 17:43:55 +00:00
Andy Wingo
e7660a607c VM support for raw slots
* libguile/loader.c (scm_find_slot_map_unlocked): Rename from
  scm_find_dead_slot_map_unlocked.

* libguile/vm.c (struct slot_map_cache_entry, struct slot_map_cache)
  (find_slot_map): Rename, changing "dead_slot" to "slot".
  (enum slot_desc): New type.
  (scm_i_vm_mark_stack): Interpret slot maps as having two bits per
  slot, allowing us to indicate that a slot is live but not a pointer.

* module/language/cps/compile-bytecode.scm (compile-function): Adapt to
  emit-slot-map name change.

* module/system/vm/assembler.scm (<asm>): Rename dead-slot-maps field to
  slot-maps.
  (emit-slot-map): Rename from emit-dead-slot-map.
  (link-frame-maps): 2 bits per slot.

* module/language/cps/slot-allocation.scm (lookup-slot-map): Rename from
  lookup-dead-slot-map.
  (compute-var-representations): New function.
  (allocate-slots): Adapt to encode two-bit slot representations.
2015-10-28 16:40:53 +00:00
Andy Wingo
dd77a818ba Treat tail $values as generating lazy allocations
* module/language/cps/slot-allocation.scm (compute-lazy-vars): Returning
  values in tail position also generates lazy vars.
2015-10-28 13:33:37 +00:00
Andy Wingo
696339a603 Always emit return-values
* module/language/cps/compile-bytecode.scm (compile-function): Remove
  special cases for nullary and unary returns; instead always use
  return-values and rely on hinting to try to place values in the right
  slot already.

* module/system/vm/assembler.scm (emit-init-constants): Use
  return-values.

* module/system/vm/disassembler.scm (code-annotation): Add annotation
  for return-values.
2015-10-28 11:32:15 +00:00
Andy Wingo
2f08838cd6 Replace return primcalls with $values
* module/language/cps/compile-bytecode.scm:
* module/language/cps/contification.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/type-fold.scm:
* module/language/cps/verify.scm:
* module/language/tree-il/compile-cps.scm: Never generate a return
  primcall.  Instead use $values.
2015-10-28 11:11:23 +00:00
Andy Wingo
7c9e477b82 Don't emit redundant reset-frame before return
* module/language/cps/compile-bytecode.scm (compile-function): Don't
  emit reset-frame before return-values.
2015-10-28 11:00:05 +00:00
Andy Wingo
7aee3c74f5 return-values opcode resets the frame
* libguile/vm-engine.c (return-values): Change to also reset the frame,
  if nlocals is nonzero.

* doc/ref/vm.texi (Procedure Call and Return Instructions): Updated
  docs.

* module/language/cps/compile-bytecode.scm (compile-function): Adapt to
  call emit-return-values with the right number of arguments.
2015-10-28 10:47:18 +00:00
Andy Wingo
34f3fb78e0 Fix slot-allocation to make 'return' not need to alloc-frame
* module/language/cps/slot-allocation.scm (compute-frame-sizes): Ensure
  that frames with `return' have space to shuffle the arg into return
  position.
2015-10-28 10:14:30 +00:00
Andy Wingo
3f345f564f Run CSE to clean up after closure conversion
* module/language/cps/optimize.scm: Enable CSE over first-order CPS.
2015-10-28 10:07:38 +00:00
Andy Wingo
04356dabb9 CSE can run on first-order CPS
* module/language/cps/cse.scm (compute-truthy-expressions):
  (compute-equivalent-subexpressions):
  (eliminate-common-subexpressions): Refactor to be able to work on
  first-order CPS.
2015-10-28 09:13:20 +00:00
Andy Wingo
8d79dfddb6 Revert "Bootstrap build doesn't have to expand CPS optimizations"
This reverts commit ce36fb16ff.
2015-10-28 09:12:02 +00:00
Andy Wingo
ce36fb16ff Bootstrap build doesn't have to expand CPS optimizations
* module/language/cps/optimize.scm (define-optimizer)
  (optimize-higher-order-cps, optimize-first-order-cps): Obfuscate a bit
  so that the bootstrap build won't have to expand optimization passes.
  Might marginally speed up the bootstrap process.
2015-10-28 09:10:37 +00:00
Andy Wingo
f169be9fc8 Wire up `guild compile -O0 foo.scm'
* module/scripts/compile.scm (%options): Resurrect -O option and make it
  follow GCC, more or less.  The default is equivalent to -O2.

* module/language/cps/compile-bytecode.scm (lower-cps):
* module/language/cps/optimize.scm (optimize-higher-order-cps): Move
  split-rec to run unconditionally for now, as closure conversion fails
  without it.
  (define-optimizer): Only verify the result if we are debugging, to
  save time.
  (cps-default-optimization-options): New exported procedure.

* module/language/tree-il/optimize.scm
  (tree-il-default-optimization-options): New exported procedure.
2015-10-22 17:44:17 +00:00
Andy Wingo
70c317ab51 SP-relative local addressing
* libguile/vm-engine.c: S24/S12/S8 operands addressed relative to the
  SP, not the FP.  Cache the SP instead of a FP-relative locals
  pointer.  Further cleanups to follow.

* libguile/vm.c (vm_builtin_call_with_values_code): Adapt to mov operand
  addresing change.

* module/language/cps/compile-bytecode.scm (compile-function): Reify
  SP-relative local indexes where appropriate.

* module/system/vm/assembler.scm (emit-fmov*): New helper, exported as
  emit-fmov.
  (shuffling-assembler, define-shuffling-assembler): Rewrite to shuffle
  via push/pop/drop.
  (standard-prelude, opt-prelude, kw-prelude): No need to provide for
  shuffling args.

* test-suite/tests/rtl.test: Update.

* module/language/cps/slot-allocation.scm: Don't reserve slots 253-255.
2015-10-21 11:49:20 +02:00
Andy Wingo
0da0308b84 Prepare for SP-addressed locals
* libguile/vm-engine.c: Renumber opcodes, and take the opportunity to
  fold recent additions into more logical places.  Be more precise when
  describing the encoding of operands, to shuffle local references only
  and not constants, immediates, or other such values.
  (SP_REF, SP_SET): New helpers.
  (BR_BINARY, BR_ARITHMETIC): Take full 24-bit operands.  Our shuffle
  strategy is to emit push when needed to bring far locals near, then
  pop afterwards, shuffling away far destination values as needed; but
  that doesn't work for conditionals, unless we introduce a trampoline.
  Let's just do the simple thing for now.  Native compilation will use
  condition codes.
  (push, pop, drop): Back from the dead!  We'll only use these for
  temporary shuffling though, when an opcode can't address the full
  24-bit range.
  (long-fmov): New instruction, like long-mov but relative to the frame
  pointer.
  (load-typed-array, make-array): Don't use a compressed encoding so
  that we can avoid the shuffling case.  It would be a pain, given that
  they have so many operands already.

* module/language/bytecode.scm (compute-instruction-arity): Update for
  new instrution word encodings.

* module/system/vm/assembler.scm: Update to expose some opcodes
  directly, without the need for shuffling wrappers.  Adapt to
  instruction word encodings change.

* module/system/vm/disassembler.scm (disassembler): Adapt to instruction
  coding change.
2015-10-21 11:49:20 +02:00
Andy Wingo
d7199da8c9 Fix prompt miscompilation
* module/language/cps/compile-bytecode.scm (compile-function): Fix
  miscompilation when the handler body is forwarded.
2015-10-21 11:49:20 +02:00
Mark H Weaver
315adb6347 Fix typo in CPS conversion.
Fixes <http://bugs.gnu.org/21614>.
Reported by tantalum <sph@posteo.eu>.

* module/language/tree-il/compile-cps.scm (convert): Add missing 'cps'
  argument to the continuation passed to 'convert-arg'.
2015-10-06 10:09:12 -04:00
Andy Wingo
78fdc3e673 Remove unused (language tree-il inline) module.
* module/language/tree-il/inline.scm: Remove.
* module/Makefile.am (TREE_IL_LANG_SOURCES): Remove inline.scm.
2015-09-17 12:45:36 +02:00
Andy Wingo
48412395c6 Add closure effects
* module/language/cps/effects-analysis.scm: Add closure effects, to
  enable hoisting/CSE of free-ref/free-set!.
2015-07-27 15:19:45 +02:00
Andy Wingo
90c11483e6 Better codegen for $values terms that don't shuffle
* module/language/cps/compile-bytecode.scm (compute-forwarding-labels):
  Analyze forwarding labels before emitting code.  This lets us elide
  conts that cause no shuffles, allowing more fallthrough.
2015-07-27 14:53:59 +02:00
Andy Wingo
3b60e79879 Loop peeling
* module/language/cps/peel-loops.scm: New pass.  Only enabled if the
  loop has one successor.

* module/language/cps/optimize.scm: Peel instead of doing LICM on
  higher-order CPS, then LICM on first-order CPS.

* module/Makefile.am: Wire up new pass.
2015-07-27 13:45:23 +02:00
Andy Wingo
4792577ab8 solve-flow-equations tweak
* module/language/cps/utils.scm (solve-flow-equations): Revert to take
  separate in and out maps.  Take an optional initial worklist.

* module/language/cps/slot-allocation.scm: Adapt to solve-flow-equations
  change.
2015-07-27 13:25:38 +02:00
Andy Wingo
ce2888701c Simplify rotate-loops.scm
* module/language/cps/rotate-loops.scm: Clean up unused code.
2015-07-27 12:59:09 +02:00