1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-04 08:40:21 +02:00
Commit graph

4452 commits

Author SHA1 Message Date
Andy Wingo
099784ca91 Beta reduction over first-order CPS
* module/language/cps2/simplify.scm (beta-reduce): Handle $closure.
2015-07-16 07:32:52 +02:00
Andy Wingo
e419e9e3df DCE works on first-order CPS
* module/language/cps2/dce.scm (compute-live-code): Use the live-labels
  set to indicate function liveness.  $closure and $callk mark their
  associated functions as live.
  (process-eliminations): Handle $closure.

* module/language/cps2/effects-analysis.scm (expression-effects): Handle
  $closure.
2015-07-16 07:24:51 +02:00
Andy Wingo
1b95487501 compute-reachable-functions refactor
* module/language/cps2/utils.scm (compute-reachable-functions): New
  function.

* module/language/cps2/verify.scm (check-label-partition)
  (compute-reachable-labels): Use the new function.

* module/language/cps2/simplify.scm (compute-singly-referenced-vars):
  Allow $closure.
  (compute-eta-reductions, compute-beta-reductions): Use
  compute-reachable-functions, which besides being a simplification also
  allows simplification to work on first-order CPS.
2015-07-16 07:22:59 +02:00
Andy Wingo
263b409918 Prepare DCE pass for first-order CPS2
* module/language/cps2/dce.scm (compute-live-code): Prepare for handling
  first-order CPS by tracking functions in the live label set.
2015-07-15 17:15:03 +02:00
Andy Wingo
030e9b7603 Enable CPS2 closure conversion
* module/language/cps2/closure-conversion.scm: Remove debug printfs.
* module/language/cps2/compile-cps.scm (compile-cps):
* module/language/cps/compile-bytecode.scm (compile-bytecode): Use CPS2
  closure conversion by default.
2015-07-15 16:44:49 +02:00
Andy Wingo
6cfb7afb61 CPS2 closure conversion bugfixes
* module/language/cps2/closure-conversion.scm
  (rewrite-shared-closure-calls): Fix to make shared closures call the
  right label.
  (closure-label): New helper.
  (prune-free-vars): If a shared closure is not well-known, don't use
  the alias optimization.
  (convert-one): Fix for shared closures with one not-well-known
  closure.
2015-07-15 16:31:10 +02:00
Andy Wingo
e9e6da1902 closure-conversion docstring tweak
* module/language/cps2/closure-conversion.scm (prune-free-vars): Fix
  docstring.
2015-07-15 15:15:41 +02:00
Andy Wingo
981802c4c2 Wire up new closure conversion pass
* module/language/cps/compile-bytecode.scm (compile-bytecode): Only
  convert closures if the #:cps2-convert? option is not passed.

* module/language/cps2/compile-cps.scm (conts->fun*, compile-cps): Add
  support for CPS2 closure conversion, disabled by default.
2015-07-15 09:43:33 +02:00
Andy Wingo
285f62a077 Add CPS2 closure conversion module
* module/language/cps2/closure-conversion.scm: New module.
* module/Makefile.am: Add new file.
2015-07-14 16:14:53 +02:00
Andy Wingo
bf5c7954ff Verify pass works on first-order CPS
* module/language/cps2/verify.scm: Work with first-order CPS.
2015-07-14 16:14:09 +02:00
Andy Wingo
e0ef087ceb Beginnings of first-order CPS optimization
* module/language/cps2/optimize.scm (optimize-higher-order-cps): Renamed
  from "optimize".
  (optimize-first-order-cps): New function.

* module/language/cps2/compile-cps.scm: Adapt.
2015-07-14 16:14:09 +02:00
Andy Wingo
363d6498e5 Tweak intset printing
* module/language/cps/intset.scm: Print members of set as absolute
  values, not diffs from set minumum.
2015-07-14 16:14:09 +02:00
Andy Wingo
a15a14203e CPS2 renumber works with first-order CPS
* module/language/cps2/renumber.scm (compute-renaming): Add support for
  $closure and $callk.
2015-07-14 16:14:09 +02:00
Andy Wingo
dc27708f0b Fix intset-subtract to reliably produce empty-intset
* module/language/cps/intset.scm (intset-subtract): Reliably produce
  empty-intset if the result is empty.
2015-07-13 11:03:00 +02:00
Andy Wingo
47a4727b78 intset-union fast paths
* module/language/cps/intset.scm (intset-union): Add fast paths for
  union with empty intset.
2015-07-13 11:02:29 +02:00
Andy Wingo
1bb7a7fa7a Reorganizing of intset/intmap helper functions
* module/language/cps2/split-rec.scm (intmap-keys): Move to utils.
* module/language/cps2/utils.scm (trivial-intset): New function.
  (intmap-keys, invert-bijection, invert-partition): New functions.
2015-07-13 11:01:43 +02:00
Ian Price
b147a36751 Add missing simplify.scm to Makefile 2015-06-24 20:31:24 +01:00
Ian Price
89029a54f4 Explicitly test for undefined arguments to handle false values like 0 2015-06-24 19:57:28 +01:00
Ian Price
b631576f13 Fixup binop unparsing 2015-06-23 15:52:42 +01:00
Ian Price
88c052214f Handle more identifier characters 2015-06-23 15:46:26 +01:00
Ian Price
a680a4cb9d Change local type representation and remove var type 2015-06-22 16:18:18 +01:00
Ian Price
e9f37e6a31 Change function type representation 2015-06-22 16:18:12 +01:00
Ian Price
a7b2dfa581 Change program type representation 2015-06-22 16:08:20 +01:00
Ian Price
f0537e39ee Rewrite js-il inliner 2015-06-22 16:08:20 +01:00
Ian Price
2e10f55426 Different types for Continuation and Variable identifiers 2015-06-22 16:08:02 +01:00
Ian Price
78cacbe450 Implement fluid primitives 2015-06-18 04:14:44 +01:00
Ian Price
46597b49dc Use scheme.frame.Prompt objects for prompts on dynstack 2015-06-18 04:14:44 +01:00
Ian Price
6f77715457 Implement apply correctly 2015-06-18 04:14:43 +01:00
Ian Price
b939d51f8a values takes multiple arguments 2015-06-18 04:14:43 +01:00
Ian Price
ee42731b57 abort-to-prompt takes multiple arguments 2015-06-18 04:14:43 +01:00
Ian Price
cf905a7004 Implement call-with-values 2015-06-18 04:14:43 +01:00
Ian Price
56e6c33264 Primitives create multiple argument continuations. 2015-06-18 04:14:43 +01:00
Ian Price
5827ad4f03 Compile cps $prompt form to javascript 2015-06-18 04:14:43 +01:00
Ian Price
48e84c5a2c Add more Scheme Primitives to runtime.js 2015-06-18 04:14:43 +01:00
Ian Price
4622269e68 Primitives should return Scheme Booleans 2015-06-18 04:14:43 +01:00
Ian Price
e84f839463 Implement keyword argument parsing 2015-06-18 04:14:43 +01:00
Ian Price
46905ec322 Simplify output Javascript 2015-06-18 04:14:43 +01:00
Ian Price
e9d0f97410 Add more types of constants 2015-06-18 04:14:43 +01:00
Ian Price
941f8fac01 Implement Optional arguments 2015-06-18 04:14:43 +01:00
Ian Price
f83c651f46 Remove superfluous space 2015-06-18 04:14:42 +01:00
Ian Price
44e04eae0a Handle case-lambda via a jump table 2015-06-18 04:14:42 +01:00
Ian Price
30afdcd976 Add binop type 2015-06-18 04:14:42 +01:00
Ian Price
41023d5b4c Mangle js identifiers 2015-06-18 04:14:42 +01:00
Ian Price
a4003003e2 Compile string constants 2015-06-18 04:14:42 +01:00
Ian Price
86fabef4ca Compile rest args 2015-06-18 04:14:42 +01:00
Ian Price
1bed3f047e fix makefile 2015-06-18 04:14:42 +01:00
Ian Price
a3ddf537dc get rid of unused match case 2015-06-18 04:14:42 +01:00
Ian Price
f8618a522f conditional->branch 2015-06-18 04:14:42 +01:00
Ian Price
3b32d180b1 Simple inlining of immediate calls 2015-06-18 04:14:42 +01:00
Ian Price
d1a663baec Get rid of comments and dead branches 2015-06-18 04:14:42 +01:00