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

1603 commits

Author SHA1 Message Date
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
Ludovic Courtès
d49453259b Fix expansion of 'error' primitive with a non-constant argument.
Fixes <https://bugs.gnu.org/39509>.
Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>.

* module/language/tree-il/primitives.scm (error): Remove extra "?"
argument when the first argument is not a constant.
* test-suite/tests/tree-il.test ("primitives")["error"]: New test
prefix.
2020-03-06 18:06:51 +01:00
Andy Wingo
7dc90a17e0 Add type checkers for lsh/immediate and rsh/immediate
* module/language/cps/types.scm (lsh/immediate, rsh/immediate): New type
  checkers.
2020-02-12 15:57:12 +01:00
Andy Wingo
a706b7e465 Fold (logior 0 INT) to INT
* module/language/cps/type-fold.scm (logior): Integer-valued operands
  to (logior 0 EXPR) should fold to EXPR.
2020-02-12 15:40:14 +01:00
Ludovic Courtès
7e7d8b778c Remove duplicate procedure in slot-allocation.scm.
* module/language/cps/slot-allocation.scm (add-live-slot)
(kill-dead-slot, compute-slot): Move higher up in the file.
(compute-shuffles): Remove duplicate 'add-live-slot' procedure.
2020-02-08 11:28:59 +01:00
Andy Wingo
bea8660c44 Disable eta-expansion in letrectification
* module/language/tree-il/letrectify.scm: Disable eta-expansion, as we
  now do that after peval.
2020-01-15 16:11:20 +01:00
Andy Wingo
2993c2d873 Add eta-expansion pass after peval
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add eta-expand.scm.
* module/language/tree-il/eta-expand.scm: New file.
* module/language/tree-il/optimize.scm (optimize)
  (tree-il-optimizations): Add eta-expansion at level 2.
2020-01-15 16:11:15 +01:00
Andy Wingo
b6dfc84fd4 Declarative variables optimization limits eta-expansion
* module/language/tree-il/letrectify.scm (compute-procedures-without-identity):
  (letrectify): Only eta-expand lambda references that appear outside
  the operator position more than once.  This should restore peoples'
  expectations that (eqv? f f) without penalizing optimization.
2020-01-14 09:39:28 +01:00
Andy Wingo
cf53854d42 Fix peval bug that ignored excess args
* module/language/tree-il/peval.scm (peval): Fix arity check for type
  confusion (empty value of "rest" in this context was (), not #f).  The
  effect was that we'd silently allow extra arguments to inlined calls.
  Thanks to Christopher Lam for the report!  Fixes #38617.
* test-suite/tests/peval.test ("partial evaluation"): Add a test.
2020-01-12 21:11:09 +01:00
Andy Wingo
8fcfcabec8 Fix bug in closure conversion
* module/language/cps/closure-conversion.scm (convert-one):
  Strongly-connected components of letrec bindings that do not share a
  closure may include member functions that have a single free variable,
  or even no free variables as a result of free variable pruning.
  Handle this case instead of erroring out.  Thanks to Stefan Israelsson
  Tampe for the report.
2020-01-11 11:50:44 +01:00
Andy Wingo
70ad8a2e72 Reduce quo, rem, mod for power-of-two divisors
* module/language/cps/type-fold.scm (power-of-two?): New helper.
  (quo, rem, mod): New reducers for when the denominator is a power of
  two.
2019-12-09 21:48:20 +01:00
Andy Wingo
2178de4d38 Allow for inexact integers in quo, rem, and so on
* module/language/cps/types.scm (&integer): New helper definition.
  (quo, rem, mod): Fix to allow inexact integer results :(
  (even?): Allow inexact integer arguments.
2019-12-09 21:08:43 +01:00
Andy Wingo
6c6867d570 Effects analysis treats the fixed parts of objects specially
* module/language/cps/effects-analysis.scm (&header): New memory kind,
  for the fixed parts of objects.  Distinguishing init-only memory
  allows us to determine that vector-set! doesn't stomple
  vector-length.
  (annotation->memory-kind*): New helper, mapping references to fixed
  offsets to &header.  Use for scm-ref/immediate et al.
2019-12-06 10:23:53 +01:00
Andy Wingo
e63e266105 Allocations and raw mutating operations restrict to mutable types
* module/language/cps/types.scm (annotation->mutable-type): New helper.
  (allocate-words, allocate-words/immediate): Define objects of mutable
  type.
  (scm-set!/tag, scm-set!, scm-set!/immediate, word-set!)
  (word-set!/immediate): Restrict to mutable types.
2019-12-05 17:04:43 +01:00
Andy Wingo
8304b15807 Fix range inference on division in unreachable code
* module/language/cps/types.scm (div-result-range): It is possible for a
  max value to be less than a minimum.  In this bug from zig:

    (define (benchmark x)
      (let loop ((count 0)
                 (sum 0))
        (if (= count 10)
            (exact->inexact (/ sum 10)))
        (loop (+ count 1) x)))

  Here the first iteration gets peeled, and thus the first "if" can't be
  true, because "count" is zero.  However on the true branch of the if,
  range inference produces bogus ranges -- notably, the variable bound
  to 10 is inferred to have a min of 10 and a max of 0.  This is fine,
  because it's unreachable; but that then infects the division, because
  the same variable bound to 10 is used there, resulting in division by
  zero.
2019-11-27 16:03:59 +01:00
Andy Wingo
08bd2f0dcb Fix range inference for right-shifts
* module/language/cps/types.scm (compute-ash-range): Fix rsh range
  inference, broken during refactoring.  Fixes
  https://bugs.gnu.org/38369.
2019-11-26 11:03:24 +01:00
Andy Wingo
cc7d394490 Deprecate passing a non-zero size to make-module
* module/ice-9/boot-9.scm (make-module): Issue a deprecation warning if
  users pass a non-zero size.
  (nested-define-module!, make-modules-in, beautify-user-module!)
  (resolve-interface, make-autoload-interface, %cond-expand-table):
* module/ice-9/popen.scm (port/pid-table):
* module/ice-9/session.scm (make-fold-modules):
* module/language/ecmascript/function.scm (*program-wrappers*):
* module/scripts/api-diff.scm (read-api-alist-file):
* module/srfi/srfi-10.scm (reader-ctors): Update callers.  Also remove
  some make-hash-table sizes.
2019-09-27 22:57:38 +02:00
Andy Wingo
4e89d0c061 Use "G_" as the conventional alias for gettext
Since the change in 2.2 noted in the NEWS as "Fix literal matching for
module-bound literals", defining `_' makes `syntax-rules' and `match'
fail to recognize `_' as the catch-all literal.  This change adapts the
recommendations to current practice in 2.2, as users have had to adapt
to this change.

* doc/ref/api-i18n.texi (Gettext Support): Update documentation.
* module/language/tree-il/analyze.scm (proc-ref?, gettext?): G_ is the
  conventional abbreviation, not _.
* test-suite/tests/tree-il.test: Adapt.
* module/ice-9/command-line.scm: Use G_ instead of _.
2019-09-12 21:50:35 +02:00
Andy Wingo
d1cf892880 Optimize fixnum or s64 -> f64 conversions
* libguile/intrinsics.c (scm_bootstrap_intrinsics):
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Add "inexact"
  intrinsic.
* libguile/jit.c (compile_s64_to_f64): New compiler.
* libguile/vm-engine.c (s64->f64): New instruction.
* module/language/cps/effects-analysis.scm (heap-numbers-equal?):
* module/language/cps/reify-primitives.scm (compute-known-primitives):
* module/language/cps/slot-allocation.scm (compute-var-representations):
* module/language/cps/specialize-numbers.scm (fixnum->f64):
  (specialize-operations):
* module/language/cps/type-fold.scm (scm->f64, inexact):
* module/language/cps/types.scm (inexact, s64->f64):
* module/language/tree-il/cps-primitives.scm (exact->inexact):
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*):
* module/system/vm/assembler.scm: Recognize exact->inexact as a
  primitive, and optimize it.  Add compiler support for new "inexact"
  and "s64->f64" primcalls.
2019-09-01 20:46:04 +02:00
Andy Wingo
887aac28d2 At optimization level -O3, seal declarative module-private bindings
* module/language/tree-il/letrectify.scm (compute-private-toplevels):
  New function; computes the subset of declarative bindings that are
  private to a module.  If the module exports a macro, all bindings are
  public, as we have no way to know what binding might be exported.
 (letrectify): Add #:seal-private-bindings? keyword arg.  If true, avoid
  making boxes for private definitions.
* module/language/tree-il/optimize.scm (optimize): Add
  -Oseal-private-bindings, enabled at -O3.
2019-08-28 10:44:44 +02:00
Andy Wingo
a2f5f9eda4 Fix bug in CSE auxiliary definitions
* module/language/cps/cse.scm (compute-equivalent-subexpressions): When
  CSE sees a definition like `(cons a b)', it will also record an
  "auxiliary definition" for `(car x)', where x is the variable defined
  by the cons, whereby calling `(car x)' can reduce to `a' if there is
  no intervening effect that clobbers the definitions.  However, when
  the successor of the cons is a control-flow join, then any variables
  defined there have multiple definitions.  It's incorrect to add the
  aux definition in that case.
* test-suite/tests/compiler.test ("cse auxiliary definitions"): New
  test.
2019-08-28 10:44:44 +02:00
Andy Wingo
b02d1b08d7 Compiler allocates boxed flonums in unmarked space
This fixes a bug whereby the compiler would sometimes allocate floats in
marked space.

* libguile/gc-inline.h (scm_inline_gc_malloc_pointerless_words): New
  internal helper.
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
* libguile/intrinsics.c (allocate_pointerless_words):
  (allocate_pointerless_words_with_freelist): New intrinsics.
* libguile/jit.c (compile_allocate_pointerless_words):
  (compile_allocate_pointerless_words_immediate): New compilers.
* libguile/vm-engine.c (allocate_pointerless_words)
  (allocate_pointerless_words_immediate): New opcodes.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/effects-analysis.scm (param):
* module/language/cps/reify-primitives.scm (reify-primitives):
* module/language/cps/specialize-primcalls.scm (specialize-primcalls):
* module/language/cps/types.scm (allocate-words):
(allocate-words/immediate):
* module/system/vm/assembler.scm (system): Add support for the new
  opcodes.
2019-08-26 10:19:24 +02:00
Andy Wingo
31cb10af81 Letrectify only on -O2; update docs
* doc/ref/api-evaluation.texi (Compilation): Document the -O options.
* doc/ref/api-modules.texi (Using Guile Modules): @@ docs refer to
  declarative modules.
  (Creating Guile Modules): Use when for 1-armed if.
  (Declarative Modules): Make implications of declarative bindings more
  explicit, and explicitly document ways to disable the optimization.
* module/language/tree-il/optimize.scm (tree-il-optimizations): Punt
  letrectification to -O2.
2019-08-25 12:51:03 +02:00
Andy Wingo
b1564df298 Unbox floor/ceiling and trigonometric functions where possible
* libguile/intrinsics.c (scm_atan1): New intrinsic, wrapping scm_atan.
  (scm_bootstrap_intrinsics): Add new intrinsics.
* libguile/intrinsics.h (scm_t_f64_from_f64_f64_intrinsic): New
  intrinsic type.
  (SCM_FOR_ALL_VM_INTRINSICS): Add intrinsics for floor, ceiling, sin,
  cos, tan, asin, acos, atan, and their unboxed counterparts.
* libguile/jit.c (sp_f64_operand): New helper.
  (compile_call_f64_from_f64, compile_call_f64_from_f64_f64): Call out
  to intrinsics.
* libguile/vm-engine.c (call-f64<-f64-f64): New opcode.
* module/language/cps/effects-analysis.scm: Add new intrinsics.
* module/language/cps/reify-primitives.scm (compute-known-primitives):
  Add new intrinsics.
* module/language/cps/slot-allocation.scm (compute-var-representations):
  Add 'f64 slot types for the new unboxed intrinsics.
* module/language/cps/specialize-numbers.scm (specialize-operations):
  Support unboxing the new intrinsics.
* module/language/cps/types.scm: Define type inferrers for the new
  intrinsics.
* module/language/tree-il/cps-primitives.scm: Define CPS translations
  for the new intrinsics.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*, atan): Define primitive resolvers.
* module/system/vm/assembler.scm: Export assemblers for the new
  intrinsics.
  (define-f64<-f64-f64-intrinsic): New helper.
2019-08-24 11:56:18 +02:00
Andy Wingo
25be9f9c31 Skip tests that don't work under letrectification
* test-suite/tests/srfi-64-test.scm: Skip a couple of tests that have
  unspecified result due to eq? being unspecified on procedures.
* module/language/tree-il/letrectify.scm (letrectify): Add a comment.
2019-08-18 22:27:12 +02:00
Andy Wingo
648bd5c431 Enable letrectification
* module/language/tree-il/optimize.scm: Enable letrectification at -O1
  and higher.
2019-08-18 22:27:12 +02:00
Andy Wingo
356ea09719 Add notion of declarative modules
* doc/ref/api-modules.texi (Declarative Modules): New subsection.
* module/ice-9/boot-9.scm (module): Change eval-closure slot, which was
  deprecated and unused, to be a "declarative?" slot, indicating that
  definitions from the module are declarative.
  (user-modules-declarative?): New parameter.
  (make-fresh-user-module): Set declarative according to parameter.
  (define-module*, define-module): Add #:declarative? keyword argument,
  defaulting to the value of user-modules-declarative? parameter when
  the module was expanded.
  (guile-user): This module is not declarative.

* module/language/tree-il/letrectify.scm (compute-declarative-toplevels):
  Use the new declarative? module flag.
2019-08-18 22:27:12 +02:00
Andy Wingo
d7bbf6d5db Add letrectify tree-il pass
* module/language/tree-il/letrectify.scm: New pass, not wired up yet.
  Adds lexical definitions for declarative top-level definitions, for
  better inlining and contification within a compilation unit.
* am/bootstrap.am:
* module/Makefile.am: Add to build.
2019-08-18 22:27:12 +02:00
Andy Wingo
35d19661e3 Add primitive support for working with module variables
* module/language/tree-il/compile-cps.scm (%box-ref, %box-set!): New
  expanders.
  (box-ref, box-set!): Expand in terms of %box-ref, %box-set!.
* module/language/tree-il/cps-primitives.scm (%variable-ref):
(%variable-set!, module-ensure-local-variable!): New primitives.
* module/language/tree-il/effects.scm (make-effects-analyzer):
  Understand effects of new primitives.
* module/language/tree-il/primitives.scm (define!):
(module-define!): Define expanders.
2019-08-18 22:27:12 +02:00
Andy Wingo
e7cfd6dbab Simplify the define-primitive-expander macro
* module/language/tree-il/primitives.scm (primitive-expander):
(define-primitive-expander!): New helpers.
(define-primitive-expander): Rewrite in terms of syntax-case.
(error, make-vector, eqv?, equal?, call-with-prompt)
(abort-to-prompt*, abort-to-prompt): Use new helper.
2019-08-18 22:27:12 +02:00
Andy Wingo
79a40cf717 Add "mod" field to tree-il toplevel ref, set, define
Add "mod" field to <toplevel-ref>, <toplevel-set>, and
<toplevel-define>, indicating the expander's idea of what the current
module is when a toplevel variable is accessed or created.  This will
help in later optimizations.

* libguile/expand.c (TOPLEVEL_REF, TOPLEVEL_SET, TOPLEVEL_DEFINE)
  (expand, expand_define, expand_set_x, convert_assignment):
* libguile/expand.h (SCM_EXPANDED_TOPLEVEL_REF_FIELD_NAMES):
(SCM_MAKE_EXPANDED_TOPLEVEL_REF, SCM_EXPANDED_TOPLEVEL_SET_FIELD_NAMES):
(SCM_MAKE_EXPANDED_TOPLEVEL_SET, SCM_EXPANDED_TOPLEVEL_DEFINE_FIELD_NAMES):
(SCM_MAKE_EXPANDED_TOPLEVEL_DEFINE):
* module/ice-9/compile-psyntax.scm (translate-literal-syntax-objects):
* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm:
* module/language/tree-il.scm:
* module/language/tree-il.scm (parse-tree-il, make-tree-il-folder):
(pre-post-order):
* module/language/tree-il/analyze.scm (goops-toplevel-definition):
(macro-use-before-definition-analysis, proc-ref?, format-analysis):
* module/language/tree-il/compile-cps.scm (convert):
* module/language/tree-il/debug.scm (verify-tree-il):
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/fix-letrec.scm (free-variables):
* module/language/tree-il/peval.scm (peval):
* test-suite/tests/tree-il.test: Adapt uses.
2019-08-18 22:27:12 +02:00
Andy Wingo
4bb5834d75 Fix bug in which codegen accessed data beyond end of stack
* module/language/cps/compile-bytecode.scm (compile-function): When
  shuffling return values, we need to reset the frame after any "extra"
  values are read and before any "extra" values may be set.
2019-08-18 22:27:12 +02:00
Andy Wingo
e2f8ccc5ba Update peval tests for fix-letrec
* module/language/tree-il/fix-letrec.scm (fix-scc): Initial binding of
  letrec values is unspecified, not false.
* test-suite/tests/peval.test (pass-if-peval): Fix letrec before
  pevalling.  Update tests.  A couple got better, no regressions.
2019-08-13 15:07:57 +02:00
Andy Wingo
cd4d4e70c5 Run fix-letrec before peval
* module/language/tree-il/optimize.scm (optimize): Change to run
  fix-letrec before peval.  Also, run it unconditionally, so that later
  passes don't have to deal with letrec.
* module/language/tree-il/peval.scm (build-var-table, peval): Remove
  letrec cases.
2019-08-13 13:59:14 +02:00
Andy Wingo
615430874f Implement "Fixing Letrec (reloaded)"
* module/language/tree-il/fix-letrec.scm: Update algorithm to use
  approach from "Fixing Letrec (reloaded)", which sorts mutually
  recursive bindings by using Tarjan's algorithm to partition the
  bindings into strongly-connected components.  The result is that users
  can use letrec* or internal definitions and get a result that is as
  efficient as manual placement of let / letrec.
2019-08-13 12:53:10 +02:00
Andy Wingo
bba4ce222d Split graph utilities out of (language cps utils)
* module/language/cps/graphs.scm: New file.
* module/language/cps/utils.scm: Re-export functions from graphs.scm.
* am/bootstrap.am:
* module/Makefile.am: Add to build.
2019-08-13 12:53:10 +02:00
Andy Wingo
382cc5c246 Add support for optimized unboxed abs and sqrt
Some components of this have been wired up for a while; this commit
finishes the compiler, runtime, and JIT support.

* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
* libguile/intrinsics.c (scm_bootstrap_intrinsics): Declare the new
  intrinsics.
* libguile/jit.c (compile_call_f64_from_f64): Define code generators for
  the new intrinsics.
* libguile/vm-engine.c (call-f64<-f64): New instruction.
* module/language/cps/effects-analysis.scm:
* module/language/cps/reify-primitives.scm (compute-known-primitives):
* module/language/cps/slot-allocation.scm (compute-var-representations):
* module/language/cps/specialize-numbers.scm (specialize-operations):
* module/language/tree-il/cps-primitives.scm (abs):
* module/system/vm/assembler.scm (system, define-f64<-f64-intrinsic):
  (sqrt, abs, fsqrt, fabs):
* module/language/cps/types.scm (fsqrt, fabs): Add new f64<-f64
  primitives.
2019-08-04 21:54:51 +02:00
Andy Wingo
ba94bcafea Fix intmap-intersect edge case
* module/language/cps/intmap.scm (intmap-intersect): If intersection of
  same-level intmaps is empty, return empty intmap.
2019-06-11 12:56:23 +02:00
Andy Wingo
3bbdf22312 Enable closure elision.
* module/language/cps/closure-conversion.scm (convert-one): Elide
  closures when possible.
2019-06-07 17:01:43 +02:00
Andy Wingo
73a769fc2b Add support no closure in $callk
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/contification.scm (compute-contification-candidates):
* module/language/cps/cse.scm (apply-cse):
* module/language/cps/dce.scm (compute-live-code):
* module/language/cps/devirtualize-integers.scm (compute-use-counts):
* module/language/cps/peel-loops.scm (rename-cont):
* module/language/cps/renumber.scm (renumber):
* module/language/cps/rotate-loops.scm (rotate-loop):
* module/language/cps/simplify.scm (compute-singly-referenced-vars):
(beta-reduce):
* module/language/cps/slot-allocation.scm (compute-defs-and-uses):
(compute-lazy-vars):
(compute-shuffles):
(compute-frame-size):
(allocate-lazy-vars):
(allocate-slots):
* module/language/cps/specialize-numbers.scm (compute-significant-bits):
* module/language/cps/verify.scm (check-valid-var-uses): Allow for the
  $callk proc to be #f.
* module/language/cps/compile-bytecode.scm (compile-function): Reset
  frame to appropriate size.
2019-06-07 17:01:43 +02:00
Andy Wingo
f6c07e4eb2 Add compiler support for eliding closure bindings
* module/language/cps/closure-conversion.scm (compute-elidable-closures):
  New function.
  (convert-one, convert-closures): Add ability to set "self" variable of
  $kfun to $f, hopefully avoiding passing that argument in some cases.
* module/language/cps/compile-bytecode.scm (compile-function): Pass the
  has-closure? bit on through to the assembler.
* module/system/vm/assembler.scm (begin-standard-arity)
  (begin-opt-arity, begin-kw-arity): Only reserve space for the closure
  as appropriate.
* module/language/cps/slot-allocation.scm (allocate-args)
  (compute-defs-and-uses, compute-needs-slot)
  (compute-var-representations): Allow for closure slot allocation
  differences.
* module/language/cps/cse.scm (compute-defs):
* module/language/cps/dce.scm (compute-live-code):
* module/language/cps/renumber.scm (renumber, compute-renaming):
(allocate-args):
* module/language/cps/specialize-numbers.scm (compute-significant-bits):
(compute-defs):
* module/language/cps/split-rec.scm (compute-free-vars):
* module/language/cps/types.scm (infer-types):
* module/language/cps/utils.scm (compute-max-label-and-var):
* module/language/cps/verify.scm (check-distinct-vars):
(compute-available-definitions): Allow closure to be #f.
2019-06-07 17:01:37 +02:00
Andy Wingo
1b98734c82 Fix eta-reduction of prompts
* module/language/cps/simplify.scm (eta-reduce): Fix renaming of labels
  referenced by prompts.  Thanks a million to Stefan Israelsson Tampe
  for the report and the fix!  Fixes #33652.
2019-05-08 22:26:35 +02:00
Andy Wingo
39729e8448 Rename $closure to $const-fun
* module/language/cps.scm ($const-fun): Rename from $closure, as we
  always use this now with nfree == 0.
* module/language/cps/closure-conversion.scm:
* module/language/cps/compile-bytecode.scm:
* module/language/cps/contification.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/devirtualize-integers.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/licm.scm:
* module/language/cps/peel-loops.scm:
* module/language/cps/renumber.scm:
* module/language/cps/rotate-loops.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/specialize-numbers.scm:
* module/language/cps/types.scm:
* module/language/cps/utils.scm:
* module/language/cps/verify.scm: Adapt users.
2018-10-03 22:58:45 +02:00
Andy Wingo
41100f7786 Merge branch 'master' into lightning
This includes a manual cherry-pick of relevant stable-2.2 commits up to
4c91de3e45.
2018-08-07 12:43:25 +02:00
Ludovic Courtès
c6f70e4b04 Add -Wshadowed-toplevel.
* module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): New
variable.
* module/language/tree-il/compile-cps.scm (%warning-passes): Add it.
* module/system/base/message.scm (%warning-types): Add it.
* test-suite/tests/tree-il.test ("warnings")["shadowed-toplevel"]: New
test prefix.
* module/ice-9/boot-9.scm (%auto-compilation-options): Add it.
* doc/ref/api-evaluation.texi (Compilation): Add 'shadowed-toplevel' and
'macro-use-before-definition'.
2018-08-07 12:34:32 +02:00
Mark H Weaver
8a3cca464e Add copyright header for (language elisp falias), and fix typo.
* module/language/elisp/falias.scm: Add copyright header.
* module/language/elisp/spec.scm: Fix typo in header.
2018-08-07 12:07:27 +02:00
Mark H Weaver
a72e296176 elisp: Fix cross-compilation support.
* module/system/base/target.scm (with-native-target): New exported
procedure.
* module/language/elisp/spec.scm: In the top-level body expression, call
'compile-and-load' within 'with-native-target' to compile native code.
* module/language/elisp/compile-tree-il.scm
(eval-when-compile, defmacro): Compile native code.
2018-08-07 12:07:18 +02:00
Mark H Weaver
fe92bc26a6 Avoid inexact arithmetic in the type inferrer for 'sqrt'.
* module/language/cps/types.scm: Use 'exact-integer-sqrt' and avoid
inexact arithmetic in the range analysis of the type inferrer for
'sqrt'.
2018-08-07 12:02:16 +02:00
Mark H Weaver
c6f6edcc50 Fix type inference for bitwise logical operators.
Fixes <https://bugs.gnu.org/31474> and related bugs.
Reported by Jan Nieuwenhuizen <janneke@gnu.org>.

* module/language/cps/types.scm (next-power-of-two): Remove procedure.
(non-negative?, lognot*, saturate+, saturate-, logand-bounds)
(logsub-bounds, logior-bounds, logxor-bounds): New procedures.  Use them
to improve and fix bugs in the range analysis of the type inferrers for
'logand', 'logsub', 'logior', 'ulogior', 'logxor', 'ulogxor', and
'lognot'.
2018-08-07 12:01:48 +02:00