bpt/guile.git
9 years agodefconst, defvar: proclaim special at compile-time
Robin Templeton [Tue, 5 Aug 2014 03:08:12 +0000 (23:08 -0400)]
defconst, defvar: proclaim special at compile-time

9 years agoelisp @@ macro
Robin Templeton [Tue, 5 Aug 2014 03:06:59 +0000 (23:06 -0400)]
elisp @@ macro

9 years agocompile-elisp fn
Robin Templeton [Tue, 5 Aug 2014 03:06:26 +0000 (23:06 -0400)]
compile-elisp fn

9 years agofix `nil?' type inference
Robin Templeton [Thu, 24 Jul 2014 22:58:38 +0000 (18:58 -0400)]
fix `nil?' type inference

9 years agofix symbol-function
Robin Templeton [Fri, 18 Jul 2014 21:43:20 +0000 (17:43 -0400)]
fix symbol-function

9 years agorestore special operator handling
Robin Templeton [Fri, 18 Jul 2014 21:42:59 +0000 (17:42 -0400)]
restore special operator handling

9 years agodefine-module for elisp special modules
Robin Templeton [Fri, 18 Jul 2014 21:42:07 +0000 (17:42 -0400)]
define-module for elisp special modules

9 years agoconstant-interning fix
Robin Templeton [Fri, 18 Jul 2014 21:41:48 +0000 (17:41 -0400)]
constant-interning fix

9 years agodefvar affects default value
Robin Templeton [Tue, 24 Jun 2014 04:10:10 +0000 (00:10 -0400)]
defvar affects default value

9 years agosymbol default value procedures
Robin Templeton [Tue, 24 Jun 2014 04:01:56 +0000 (00:01 -0400)]
symbol default value procedures

9 years agoread nil/t as #nil/#t
Robin Templeton [Fri, 20 Jun 2014 03:37:36 +0000 (23:37 -0400)]
read nil/t as #nil/#t

9 years agotree-il evaluator
Robin Templeton [Wed, 18 Jun 2014 02:42:14 +0000 (22:42 -0400)]
tree-il evaluator

9 years agoelisp updates
Robin Templeton [Tue, 3 Jun 2014 00:01:55 +0000 (20:01 -0400)]
elisp updates

9 years agoguile-snarf fix
Robin Templeton [Sat, 14 Jun 2014 20:16:32 +0000 (16:16 -0400)]
guile-snarf fix

9 years agoprefer compilers earlier in list
Robin Templeton [Wed, 18 Jun 2014 02:41:45 +0000 (22:41 -0400)]
prefer compilers earlier in list

9 years agoRevert "Add thread-local lock-free, TLS-free freelists."
Robin Templeton [Sat, 14 Jun 2014 07:35:27 +0000 (03:35 -0400)]
Revert "Add thread-local lock-free, TLS-free freelists."

This reverts commit aef1fcf94e635c51bc1d0849ad1f60a1d1274276.

Conflicts:
libguile/threads.c

9 years agoallow arbitrary constants in cps
Robin Templeton [Sat, 14 Jun 2014 07:33:22 +0000 (03:33 -0400)]
allow arbitrary constants in cps

9 years agoguile-private-ref
BT Templeton [Fri, 23 Aug 2013 07:01:36 +0000 (03:01 -0400)]
guile-private-ref

* module/language/elisp/compile-tree-il.scm (compile-guile-private-ref):
  New special operator.

9 years agomultiple obarrays
BT Templeton [Wed, 31 Jul 2013 02:50:24 +0000 (22:50 -0400)]
multiple obarrays

* libguile/symbols.c (lookup_uninterned_symbol)
  (lookup_interned_latin1_symbol, lookup_interned_utf8_symbol)
  (scm_i_str2symbol): Take an `obarray' argument. All callers changed.

  (scm_make_obarray, scm_find_symbol, scm_intern, scm_unintern)
  (scm_obarray_for_each): New functions.

9 years agocheck symbols constants uninterned
Robin Templeton [Wed, 11 Jun 2014 02:57:05 +0000 (22:57 -0400)]
check symbols constants uninterned

9 years agointern arbitrary constants
Robin Templeton [Tue, 10 Jun 2014 22:48:07 +0000 (18:48 -0400)]
intern arbitrary constants

9 years agolibguile/Makefile.am (snarfcppopts): Remove CFLAGS
Robin Templeton [Tue, 10 Jun 2014 20:03:17 +0000 (16:03 -0400)]
libguile/Makefile.am (snarfcppopts): Remove CFLAGS

9 years agoBetter simplification of literal constants that continue to branches
Andy Wingo [Sun, 20 Jul 2014 18:52:06 +0000 (20:52 +0200)]
Better simplification of literal constants that continue to branches

* module/language/cps/simplify.scm (eta-reduce): Constants that continue
  to branches eta-reduce to the true or false branch.

9 years agoCPS will not see "not" primcalls
Andy Wingo [Sun, 20 Jul 2014 18:19:01 +0000 (20:19 +0200)]
CPS will not see "not" primcalls

* module/language/tree-il/compile-cps.scm (convert): Remove "not"
  primcalls.

* module/language/cps/effects-analysis.scm (values):
* module/language/cps/types.scm: Remove special cases for the "not"
  primcall.

9 years agoSimplify pass rewrite scope tree to reflect dominator tree
Andy Wingo [Sun, 6 Jul 2014 10:38:26 +0000 (12:38 +0200)]
Simplify pass rewrite scope tree to reflect dominator tree

* module/language/cps/simplify.scm (redominate): Add micropass to
  rewrite the scope tree to reflect the dominator tree.  Will enable
  better eta reduction.

9 years agoRemove dead case in CSE
Andy Wingo [Sun, 6 Jul 2014 10:17:58 +0000 (12:17 +0200)]
Remove dead case in CSE

* module/language/cps/cse.scm (apply-cse): Remove a case that couldn't
  occur.

9 years agoCSE allocate-struct fix
Andy Wingo [Mon, 21 Jul 2014 15:30:16 +0000 (17:30 +0200)]
CSE allocate-struct fix

* module/language/cps/cse.scm (compute-equivalent-subexpressions):
  Fix handling of allocate-struct in tail position.

9 years agoFix typo in arities.scm
Andy Wingo [Mon, 21 Jul 2014 15:03:51 +0000 (17:03 +0200)]
Fix typo in arities.scm

* module/language/cps/arities.scm (fix-arities*): Fix typo.

9 years agoStabilize renumber.scm:sort-conts.
Andy Wingo [Mon, 21 Jul 2014 10:19:33 +0000 (12:19 +0200)]
Stabilize renumber.scm:sort-conts.

* module/language/cps/renumber.scm (sort-conts): Prevent spurious
  continuation reordering.

9 years agomaybe_annotate_source does not annotate negative positions
Andy Wingo [Mon, 21 Jul 2014 19:37:20 +0000 (21:37 +0200)]
maybe_annotate_source does not annotate negative positions

* libguile/read.c (maybe_annotate_source): Don't annotate with negative
  lines or columns.

9 years agoSoft port fill-input doesn't alter line or column
Andy Wingo [Mon, 21 Jul 2014 19:36:30 +0000 (21:36 +0200)]
Soft port fill-input doesn't alter line or column

* libguile/vports.c (sf_fill_input): Save and restore the line/column
  info around the ungetc.

9 years agoscm_ungetc_unlocked should not result in negative columns
Andy Wingo [Mon, 21 Jul 2014 19:35:49 +0000 (21:35 +0200)]
scm_ungetc_unlocked should not result in negative columns

* libguile/ports.c (scm_ungetc_unlocked): Use DECCOL in all cases, to
  avoid negative columns.

9 years agoFix allocate-slots for $kreceive with multiple predecessors
Andy Wingo [Mon, 21 Jul 2014 09:47:43 +0000 (11:47 +0200)]
Fix allocate-slots for $kreceive with multiple predecessors

* module/language/cps/slot-allocation.scm (allocate-slots): For
  continuations of $call, $callk, and $values with multiple
  predecessors, recalculate the set of live slots.  Fixes miscompilation
  of ice-9/futures.scm:process-future!, broken since the previous patch,
  now that $kreceive continuations can have multiple predecessors.

9 years agoBlock sorting to keep loop bodies together
Andy Wingo [Sat, 5 Jul 2014 13:46:48 +0000 (15:46 +0200)]
Block sorting to keep loop bodies together

* module/language/cps/renumber.scm (compute-new-labels-and-vars):
  (compute-tail-path-lengths, sort-conts): Arrange to visit successors
  in such a way that if branches are unsorted, the longest path length
  will appear first.  This keeps loop bodies together.

9 years agologbit? strength reduction
Andy Wingo [Fri, 4 Jul 2014 10:05:31 +0000 (12:05 +0200)]
logbit? strength reduction

* module/language/cps/type-fold.scm (fold-and-reduce): Don't require
  types to check out; it could be that the reduced expression can
  exhibit the same type-check effects.  Reduce for all continuations,
  even $kreceive.  Pass dfg to reducer.
  (mul): Check types.
  (logbit?): New reducer.

9 years agoFix logand range analysis.
Andy Wingo [Fri, 4 Jul 2014 09:54:03 +0000 (11:54 +0200)]
Fix logand range analysis.

* module/language/cps/types.scm (logand): Fix range analysis.

9 years agoFix range analysis for mul and div
Andy Wingo [Fri, 4 Jul 2014 09:14:16 +0000 (11:14 +0200)]
Fix range analysis for mul and div

* module/language/cps/types.scm (mul): Avoid producing nans in the
  resulting range.
  (div): Fix range analysis.

9 years agoType-driven strength reduction
Andy Wingo [Fri, 4 Jul 2014 08:46:31 +0000 (10:46 +0200)]
Type-driven strength reduction

* module/language/cps/type-fold.scm (*primcall-reducers*):
  (define-primcall-reducer, define-unary-primcall-reducer):
  (define-binary-primcall-reducer, mul): Beginnings of strength
  reduction.
  (fold-and-reduce): Rename from compute-folded.
  (fold-constants*): Adapt.

9 years agoSmall type-fold cleanup
Andy Wingo [Fri, 4 Jul 2014 07:18:36 +0000 (09:18 +0200)]
Small type-fold cleanup

* module/language/cps/type-fold.scm (fold-constants*): Remove stale
  branches that were there when we only type folded on limited-size
  branches.

9 years agoCompiler emits br-if-logtest
Andy Wingo [Thu, 3 Jul 2014 13:03:40 +0000 (15:03 +0200)]
Compiler emits br-if-logtest

* module/language/cps/compile-bytecode.scm (compile-fun):
* module/language/cps/primitives.scm (*branching-primcall-arities*):
* module/language/cps/type-fold.scm (logtest):
* module/language/cps/types.scm (logtest):
* module/system/vm/assembler.scm (system):
* module/system/vm/disassembler.scm (compute-labels): Add backend
  support for the logtest instruction.

9 years agoAdd br-if-logtest opcode
Andy Wingo [Thu, 3 Jul 2014 12:50:50 +0000 (14:50 +0200)]
Add br-if-logtest opcode

* libguile/vm-engine.c (br-if-logtest): New opcode.
* module/system/vm/disassembler.scm (code-annotation): Add branch
  annotation support.

9 years agoOptimizer support for logtest and logbit?
Andy Wingo [Thu, 3 Jul 2014 12:45:12 +0000 (14:45 +0200)]
Optimizer support for logtest and logbit?

* module/language/cps/effects-analysis.scm: Add entries for logtest and
  logbit?.
* module/language/cps/types.scm (logtest, logbit?): New checkers and
  inferrers.
* module/language/tree-il/peval.scm (peval): Convert (zero? (logand a
  b)) to (logtest a b), in anticipation of opcode support for logtest.
*
  module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*): Add logtest and logbit?.

9 years agoConvert slot allocation to use intsets
Andy Wingo [Thu, 3 Jul 2014 09:24:37 +0000 (11:24 +0200)]
Convert slot allocation to use intsets

* module/language/cps/dfg.scm (compute-live-variables): Convert to use
  intsets, and fold in compute-maximum-fixed-point.
  (print-dfa): Update.

* module/language/cps/slot-allocation.scm (dead-after-def?)
  (dead-after-use?, allocate-slots): Convert to use intsets.

9 years agoAdd bitvector->intset.
Andy Wingo [Thu, 3 Jul 2014 08:37:20 +0000 (10:37 +0200)]
Add bitvector->intset.

* module/language/cps/intset.scm (bitvector->intset): New interface.

9 years agoRestrict intsets and maps to non-negative integers
Andy Wingo [Thu, 3 Jul 2014 07:37:30 +0000 (09:37 +0200)]
Restrict intsets and maps to non-negative integers

* module/language/cps/intmap.scm (intmap-add):
* module/language/cps/intset.scm (intset-add): Restrict to only hold
  non-negative integers.

9 years agoAdapt visit-prompt-control-flow to use intsets.
Andy Wingo [Thu, 3 Jul 2014 07:20:11 +0000 (09:20 +0200)]
Adapt visit-prompt-control-flow to use intsets.

* module/language/cps/dfg.scm (compute-reachable): Use intsets.
  (compute-interval): Adapt.
  (visit-prompt-control-flow): Adapt.

9 years agoCSE comments
Andy Wingo [Thu, 3 Jul 2014 07:03:45 +0000 (09:03 +0200)]
CSE comments

* module/language/cps/cse.scm (compute-available-expressions): Add
  clarifying comment.

9 years agoAdd intset-subtract.
Andy Wingo [Thu, 3 Jul 2014 07:02:31 +0000 (09:02 +0200)]
Add intset-subtract.

* module/language/cps/intset.scm (intset-subtract): New interface.

9 years agoFix intset on 32-bit machines
Andy Wingo [Tue, 1 Jul 2014 09:30:29 +0000 (11:30 +0200)]
Fix intset on 32-bit machines

* module/language/cps/intset.scm (*leaf-bits*): Define to 4 on 32-bit
  machines, to stay in fixnum range.

9 years agoRemove size limit in elide-type-checks
Andy Wingo [Mon, 30 Jun 2014 13:30:39 +0000 (15:30 +0200)]
Remove size limit in elide-type-checks

* module/language/cps/dce.scm (elide-type-checks!): Remove limit on
  label-count, now that complexity is under control.

9 years agoFix intmap-intersect corner case
Andy Wingo [Sun, 29 Jun 2014 17:49:41 +0000 (19:49 +0200)]
Fix intmap-intersect corner case

* module/language/cps/intmap.scm (intmap-intersect): Fix a corner case,
  as was recently fixed for intsets.

9 years agoCSE truth inference pass uses intsets
Andy Wingo [Sun, 29 Jun 2014 17:25:54 +0000 (19:25 +0200)]
CSE truth inference pass uses intsets

* module/language/cps/cse.scm (compute-truthy-expressions): Rewrite to
  use intsets instead of bitvectors.
  (apply-cse): Adapt.

9 years agoResult of intsect-intersect will share structure with A if it can
Andy Wingo [Sun, 29 Jun 2014 17:47:25 +0000 (19:47 +0200)]
Result of intsect-intersect will share structure with A if it can

* module/language/cps/intset.scm (intset-intersect): Ensure that the
  result shares structure with A if possible, as intmaps do.

9 years agoFix an intset-intersect corner case
Andy Wingo [Sun, 29 Jun 2014 17:40:43 +0000 (19:40 +0200)]
Fix an intset-intersect corner case

* module/language/cps/intset.scm (intset-intersect): Avoid creating
  invalid intsets when lowering an intset with a higher shift.

9 years agoFix intset pruning for empty intsets
Andy Wingo [Sun, 29 Jun 2014 17:31:27 +0000 (19:31 +0200)]
Fix intset pruning for empty intsets

* module/language/cps/intset.scm (make-intset/prune): Fix empty intset
  case.

9 years agoRemove namesets.
Andy Wingo [Sun, 29 Jun 2014 12:29:20 +0000 (14:29 +0200)]
Remove namesets.

This was a failed experiment.  It had good space complexity but terrible
time complexity.

* module/Makefile.am: Update.
* module/language/cps/nameset.scm: Remove.

9 years agoRewrite type inference to use intmaps
Andy Wingo [Sun, 29 Jun 2014 12:20:52 +0000 (14:20 +0200)]
Rewrite type inference to use intmaps

* module/language/cps/types.scm: Rewrite to use intmaps instead of
  namesets.

9 years agoNew module (language cps intmap)
Andy Wingo [Sun, 29 Jun 2014 08:41:57 +0000 (10:41 +0200)]
New module (language cps intmap)

* module/language/cps/intmap.scm: New file.
* module/Makefile.am: Add to build.

9 years agoRewrite CSE to use intsets.
Andy Wingo [Sun, 29 Jun 2014 12:20:26 +0000 (14:20 +0200)]
Rewrite CSE to use intsets.

* module/language/cps/cse.scm: Rewrite using intsets.

9 years agoNew module: (language cps intset)
Andy Wingo [Sun, 29 Jun 2014 12:09:04 +0000 (14:09 +0200)]
New module: (language cps intset)

* module/Makefile.am: Add to build.
* module/language/cps/intset.scm: New file.

9 years agoFix bit-count* bug
Andy Wingo [Sat, 28 Jun 2014 13:24:29 +0000 (15:24 +0200)]
Fix bit-count* bug

* libguile/bitvectors.c (scm_bit_count_star): Fix typo introduced in
  2005 refactor (!) in which the second arg was erroneously taken from
  the first arg.

* test-suite/tests/bitvectors.test: Add test.

* doc/ref/api-compound.texi: Fix doc example for u32vector selector.

9 years agoRewrite type inference pass to use namesets
Andy Wingo [Thu, 19 Jun 2014 06:49:05 +0000 (08:49 +0200)]
Rewrite type inference pass to use namesets

* module/Makefile.am: Build types.scm early, but don't block the rest of
  the build on it.

* module/language/cps/types.scm: Rewrite to use namesets.

* module/language/cps/dce.scm:
* module/language/cps/type-fold.scm: Adapt to interface changes.

9 years agoNew module: (language cps nameset)
Andy Wingo [Sun, 8 Jun 2014 16:50:07 +0000 (18:50 +0200)]
New module: (language cps nameset)

* module/language/cps/nameset.scm: New file.
* module/Makefile.am: Add new file.

9 years agoRefactor dominator computation
Andy Wingo [Sun, 15 Jun 2014 20:02:29 +0000 (22:02 +0200)]
Refactor dominator computation

* module/language/cps/cse.scm:
* module/language/cps/dfg.scm (compute-idoms, compute-dom-edges): Move
  these procedures from cse.scm to dfg.scm.
  Remove loop-detection code; that can come back later but it is
  bitrotten for now.

9 years agoConstant folding for (list) and (vector) in peval
Andy Wingo [Sun, 8 Jun 2014 12:46:18 +0000 (14:46 +0200)]
Constant folding for (list) and (vector) in peval

* module/language/tree-il/peval.scm (peval): Add cases for (list) -> '()
  and (vector) -> #().

9 years agoUse the right GC version macros.
Ludovic Courtès [Mon, 9 Jun 2014 17:26:38 +0000 (19:26 +0200)]
Use the right GC version macros.

Reported by Doug Evans <xdje42@gmail.com>.

* libguile/gc.c (scm_storage_prehistory): Use GC_VERSION_MICRO, not
  GC_ALPHA_VERSION.

9 years agoRemove $kif
Andy Wingo [Sun, 1 Jun 2014 01:43:12 +0000 (21:43 -0400)]
Remove $kif

* module/language/cps.scm: Remove $kif.

* module/language/cps/compile-bytecode.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/dfg.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/prune-top-level-scopes.scm:
* module/language/cps/renumber.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/type-fold.scm:
* module/language/cps/types.scm:
* module/language/cps/verify.scm: Adapt.

9 years agoCPS conversion produces $branch nodes, not $kif
Andy Wingo [Sun, 1 Jun 2014 01:13:33 +0000 (21:13 -0400)]
CPS conversion produces $branch nodes, not $kif

* module/language/tree-il/compile-cps.scm (unbound?, convert): Create
  $branch nodes instead of $kif nodes.

9 years agoAdd $branch expression type
Andy Wingo [Tue, 27 May 2014 15:49:42 +0000 (11:49 -0400)]
Add $branch expression type

* module/language/cps.scm ($branch): New expression type; will replace
  $kif.

* module/language/cps/arities.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/compile-bytecode.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/dfg.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/primitives.scm:
* module/language/cps/renumber.scm:
* module/language/cps/self-references.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/type-fold.scm:
* module/language/cps/types.scm:
* module/language/cps/verify.scm: Adapt to $branch expression type.

9 years agoFix source-line-for-user for unknown line
Andy Wingo [Fri, 30 May 2014 15:54:56 +0000 (11:54 -0400)]
Fix source-line-for-user for unknown line

* module/system/vm/debug.scm (source-line-for-user): Fix to allow for
  unknown lines.

9 years agoFix off-by-one in dump-dfg
Andy Wingo [Wed, 28 May 2014 16:50:15 +0000 (12:50 -0400)]
Fix off-by-one in dump-dfg

* module/language/cps/dfg.scm (dump-dfg): Fix bug where the last
  continuation wasn't printed.

9 years agoFix compute-predecessors bug in frame.scm
Andy Wingo [Wed, 28 May 2014 14:46:19 +0000 (10:46 -0400)]
Fix compute-predecessors bug in frame.scm

* module/system/vm/frame.scm (compute-predecessors): Fix bug in
  resolving targets of backwards branches.

9 years agoUpdate effects-analysis docstring.
Andy Wingo [Fri, 16 May 2014 14:57:58 +0000 (16:57 +0200)]
Update effects-analysis docstring.

* module/language/cps/effects-analysis.scm: Update docs.

9 years agoRedefine memory kind part of effects to be enumeration, not flags
Andy Wingo [Fri, 16 May 2014 14:17:53 +0000 (16:17 +0200)]
Redefine memory kind part of effects to be enumeration, not flags

* module/language/cps/effects-analysis.scm (define-enumeration): New
  helper.
  (&memory-kind-mask): Define as an enumeration, not a bitfield.  Add
  &unknown-memory-kinds.
  (&all-effects, effect-clobbers?, make-prompt-tag, expression-effects):
  Adapt.

Note that this change requires dce.go and cse.go to be recompiled.

9 years agoDCE uses type analysis to elide type checks
Andy Wingo [Wed, 14 May 2014 14:59:08 +0000 (16:59 +0200)]
DCE uses type analysis to elide type checks

* module/language/cps/dce.scm (elide-type-checks!, compute-live-code):
  Replace old ad-hoc type check elision with one driven from type
  analysis.  Type check elision only operates on smallish functions, to
  avoid n**2 explosion in type inference.

9 years agoLimit impact of O(n^2) type analysis by imposing limit
Andy Wingo [Wed, 14 May 2014 19:42:09 +0000 (21:42 +0200)]
Limit impact of O(n^2) type analysis by imposing limit

* module/language/cps/types.scm (infer-types): Add #:max-label-count
  argument.

* module/language/cps/type-fold.scm (compute-folded, fold-constants*):
  Disable for big functions.  Perhaps we can relax this if we find an
  O(n log n) way to represent types.

9 years agoCompile language/cps/types.scm early
Andy Wingo [Wed, 14 May 2014 14:15:15 +0000 (16:15 +0200)]
Compile language/cps/types.scm early

* module/Makefile.am (BOOT_SOURCES, BOOT_GOBJECTS): New variables.
  (CLEANFILES, nobase_mod_DATA, nobase_ccache_DATA, EXTRA_DIST)
  (ETAGS_ARGS): Use the new variables.

  (CPS_LANG_SOURCES): Remove language/cps/types.scm, as it is a boot
  file.

9 years agoEnable type folding
Andy Wingo [Wed, 14 May 2014 14:02:08 +0000 (16:02 +0200)]
Enable type folding

* module/language/cps/compile-bytecode.scm (optimize): Enable type
  folding.

9 years agoType and range inference for CPS
Andy Wingo [Tue, 13 May 2014 14:14:35 +0000 (16:14 +0200)]
Type and range inference for CPS

* module/language/cps/types.scm: New file, implementing type and range
  inference over CPS.

* module/language/cps/type-fold.scm: New file, implementing abstract
  constant folding for CPS.

* module/Makefile.am: Add the new files.

* module/language/cps/compile-bytecode.scm: Wire up type-fold, but
  currently disabled.

9 years agoAdd syntax-parameterize indentation to .dir-locals.el.
Andy Wingo [Mon, 12 May 2014 07:41:58 +0000 (09:41 +0200)]
Add syntax-parameterize indentation to .dir-locals.el.

* .dir-locals.el: Add syntax-parameterize indentation.

9 years agoRewrite effects analysis to be precise for fields.
Andy Wingo [Thu, 8 May 2014 08:39:49 +0000 (10:39 +0200)]
Rewrite effects analysis to be precise for fields.

* module/language/cps/effects-analysis.scm: Rewrite so that instead of
  the depends/causes effects, there is just &type-check, &allocation,
  &read, and &write.  The object kind is a separate part of the
  bitfield, and the field in the object (if appropriate) is another
  field.  Effects are still a fixnum.  This enables precise effects for
  vectors and structs on all architectures.

  This kind of effects analysis was not possible in Tree-IL because
  Tree-IL relied on logior-ing effects of subexpressions, whereas with
  CPS we have no sub-expressions and we do flow analysis instead.

  (effect-clobbers?): Replace effects-commute? with this inherently
  directional and precise predicate.

* module/language/cps/cse.scm (compute-always-available-expressions):
  (compute-equivalent-subexpressions): Adapt to effects analysis
  change.
* module/language/cps/dce.scm (compute-live-code): Likewise.

9 years agoCSE effects analysis cleanup
Andy Wingo [Wed, 7 May 2014 15:10:15 +0000 (17:10 +0200)]
CSE effects analysis cleanup

* module/language/cps/cse.scm (compute-always-available-expressions):
  Use constant? instead of zero?, to avoid punching through the effects
  abstraction.

9 years agoAdd dump-dfg pretty-printer
Andy Wingo [Wed, 7 May 2014 13:28:50 +0000 (15:28 +0200)]
Add dump-dfg pretty-printer

* module/language/cps/dfg.scm (dump-dfg): New pretty-printer.  Under
  construction.

9 years agoSynthetic definitions take advantage of CSE'd vars
Andy Wingo [Wed, 7 May 2014 13:28:12 +0000 (15:28 +0200)]
Synthetic definitions take advantage of CSE'd vars

* module/language/cps/cse.scm (compute-available-expressions):
  Simplify initialization.
  (compute-equivalent-subexpressions): When synthesizing definitions,
  use substed vars.  Add synthetic definitions after processing an
  expression, to take advantage of the substed vars.

9 years agoFix thinko in synthesize-definition-effects!
Andy Wingo [Wed, 7 May 2014 13:25:13 +0000 (15:25 +0200)]
Fix thinko in synthesize-definition-effects!

* module/language/cps/effects-analysis.scm (synthesize-definition-effects!):
  Fix a boneheaded thinko that caused all primcalls to be marked as
  causing car, cdr, vector, struct, and box effects.

9 years agoFix frame-call-representation for frames from apply-hook
Andy Wingo [Sun, 4 May 2014 20:51:34 +0000 (22:51 +0200)]
Fix frame-call-representation for frames from apply-hook

* module/system/vm/frame.scm (frame-call-representation): Fix when
  called on frames that are created from the apply hook.

9 years agoProgram printing tweaks
Andy Wingo [Sun, 4 May 2014 20:41:48 +0000 (22:41 +0200)]
Program printing tweaks

* module/system/vm/program.scm (print-program): New public interface --
  the guts of write-program, but refactored to be able to work when only
  given an addr.
  (write-program): Use print-program.

* module/system/vm/frame.scm (frame-call-representation): Remove attempt
  to abbreviate procedure representations; was confusing because the
  result would write as a string, quotes and all.

9 years agoRefactorings to apply-hook and push-continuation-hook
Andy Wingo [Sun, 4 May 2014 12:09:42 +0000 (14:09 +0200)]
Refactorings to apply-hook and push-continuation-hook

* libguile/vm-engine.c (vm_engine): Always invoke the apply hook after
  the ip has been reset.  Avoids problems in frame-bindings, which
  builds its bindings map based on the IP.  Invoke push-continuation
  before linking the new frame, so that more locals are available to the
  frame inspector.

* module/system/vm/traps.scm (trap-in-procedure): No need for a
  push-cont handler, as the apply handler will exit the frame.

9 years agoframe-address, frame-stack-pointer return offsets
Andy Wingo [Sun, 4 May 2014 09:46:18 +0000 (11:46 +0200)]
frame-address, frame-stack-pointer return offsets

* libguile/frames.c (scm_frame_address, scm_frame_stack_pointer): Return
  offsets instead of absolute pointers.  This is robust in the presence
  of stack relocation.

* module/system/repl/debug.scm (print-registers): Adapt to print sp and
  fp as integers.

9 years agoframe-call-representation has #:top-frame? as keyword argument
Andy Wingo [Sun, 4 May 2014 09:18:54 +0000 (11:18 +0200)]
frame-call-representation has #:top-frame? as keyword argument

* module/system/vm/frame.scm (frame-call-representation): Change
  top-frame? argument to be a keyword instead of an optional argument.

* module/system/vm/trace.scm (print-application): Adapt caller.

9 years agoSet-car! on a dead pair does not force the pair to be live
Andy Wingo [Fri, 2 May 2014 18:06:30 +0000 (20:06 +0200)]
Set-car! on a dead pair does not force the pair to be live

* module/language/cps/dce.scm (constant-type, lookup-type)
  (default-type-checker, *primcall-type-checkers*)
  (define-primcall-type-checker, define-simple-primcall-types)
  (check-primcall-arg-types): Define a really lame type analysis that
  can elide some expressions causing &type-check.
  (compute-live-code): Wire up the type checker.

9 years agoAdd auxiliary definitions for boxes
Andy Wingo [Sat, 3 May 2014 10:21:20 +0000 (12:21 +0200)]
Add auxiliary definitions for boxes

* module/language/cps/cse.scm (compute-equivalent-subexpressions): Add
  auxiliary definitions for boxes.

9 years agoCSE does scalar replacement of aggregates
Andy Wingo [Fri, 2 May 2014 15:47:20 +0000 (17:47 +0200)]
CSE does scalar replacement of aggregates

* module/language/cps/effects-analysis.scm (effects-clobber): New
  helper.
  (length): Only depend on &cdr.
  (synthesize-definition-effects!): New interface.

* module/language/cps/cse.scm (compute-available-expressions): Don't
  count out constructors here -- we'll do that below.
  (compute-defs): Add a comment.
  (compute-equivalent-subexpressions): Synthesize getter calls at
  constructor/setter sites, so that (set-car! x y) can cause a
  future (car x) to just reference y.  The equiv-labels set now stores
  the defined vars, so there is no need for the defs vector.
  (cse, apply-cse): Adapt to compute-equivalent-subexpressions change.

9 years agoMore inlinable effects-analysis procedures
Andy Wingo [Fri, 2 May 2014 15:29:39 +0000 (17:29 +0200)]
More inlinable effects-analysis procedures

* module/language/cps/effects-analysis.scm (exclude-effects)
  (effect-free?, constant?): Define to be inlinable.
  (allocate-struct/immediate): Add effects.

9 years agoUpdate NEWS
Andy Wingo [Fri, 2 May 2014 09:13:34 +0000 (11:13 +0200)]
Update NEWS

* NEWS: Update.

9 years agoRewrite boot-9 map to be recursive and pure
Andy Wingo [Thu, 1 May 2014 19:14:42 +0000 (21:14 +0200)]
Rewrite boot-9 map to be recursive and pure

* module/ice-9/boot-9.scm (map): Rewrite to be recursive and pure
  instead of iterative and effectful.  At best this is faster; at worst
  it is slower.  In any case it resolves continuation-related issues.

* module/srfi/srfi-1.scm (fold): Specialize the two-arg case.
  (map): Rewrite to be recursive.

* test-suite/tests/r5rs_pitfall.test (8.3): Update for new expected map
  behavior.

9 years agoFix inner and outer stack cuts to match on procedure code
Andy Wingo [Thu, 1 May 2014 12:26:20 +0000 (14:26 +0200)]
Fix inner and outer stack cuts to match on procedure code

* doc/ref/api-debug.texi (Stack Capture): Update make-stack docs.

* libguile/programs.h:
* libguile/programs.c (scm_program_address_range): New internal
  procedure.

* libguile/stacks.c (narrow_stack): Interpret a pair of integers as an
  address range.  If a cut is a procedure, attempt to resolve it to an
  address range.
  (scm_make_stack): Update docstring.

* module/system/vm/program.scm (program-address-range): New exported
  procedure.

* module/statprof.scm (statprof, gcprof): Use program-address-range to
  get the outer-cut, for efficiency.

10 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Mon, 28 Apr 2014 16:51:21 +0000 (18:51 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
.gitignore
doc/example-smob/Makefile
doc/ref/api-smobs.texi
doc/ref/libguile-concepts.texi
doc/ref/libguile-smobs.texi
libguile.h
libguile/finalizers.c
libguile/finalizers.h
libguile/goops.c
module/language/tree-il/compile-glil.scm
module/oop/goops.scm

10 years agoPrefer foreign objects over smobs in manual
Andy Wingo [Mon, 28 Apr 2014 16:00:05 +0000 (18:00 +0200)]
Prefer foreign objects over smobs in manual

* doc/ref/api-memory.texi (Memory Blocks): Recommend against
  scm_gc_free.  Refer to foreign objects instead of smobs.  Remove
  discussion of scm_must_malloc et al.

* doc/ref/guile.texi (API Reference): Rename SMOB menu item.

* doc/ref/libguile-snarf.texi (Function Snarfing): Update example to not
  refer to smobs.
* doc/ref/tools.texi (How guile-snarf works): Likewise.

10 years agoAdd new standalone tests to gitignore
Andy Wingo [Mon, 28 Apr 2014 15:47:54 +0000 (17:47 +0200)]
Add new standalone tests to gitignore

* .gitignore: Add entries.