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

555 commits

Author SHA1 Message Date
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
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
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
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
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
6708acbf66 Fix eta-conversion edge cases in peval.
Fixes <https://bugs.gnu.org/29520>.
Reported by Stefan Israelsson Tampe <stefan.itampe@gmail.com>.

* module/language/tree-il/peval.scm (peval)[lift-applied-lambda]: Before
performing eta-conversion, check that the variable(s) passed to the
inner 'apply' are not referenced from the inner lambda, and that the
number of required arguments would not be reduced by the conversion.
2018-08-07 11:40:54 +02:00
Andy Wingo
76eac85084 Use intrinsics for top-level refs outside captured scopes
* module/language/tree-il/compile-cps.scm (toplevel-box): Reify
  intrinsic calls for top-level references outside captured scopes.
* module/language/cps/reify-primitives.scm (compute-known-primitives):
  Update set of macro-instructions.
2018-05-14 16:25:50 +02:00
Andy Wingo
ceffb5e990 Compile "define!" via intrinsic
* libguile/intrinsics.c (scm_bootstrap_intrinsics):
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Add new define!
  intrinsic.
* module/language/cps/compile-bytecode.scm (compile-function): Adapt
  compilation for define! to take two arguments.
* module/language/cps/effects-analysis.scm (current-module): Update
  define! for two arguments.
* module/language/tree-il/compile-cps.scm (convert): When reifying
  "define", grab the current module.
* module/system/vm/assembler.scm (define!): Define assembler as
  intrinsic.
2018-05-14 15:15:22 +02:00
Andy Wingo
dff85f6f9f Explode atomic box ops to new atomic instructions
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add C8_S24
  word type.
* libguile/vm-engine.c (UNPACK_8_24): New helper.
  (atomic-scm-ref/immediate, atomic-scm-set!/immediate)
  (atomic-swap-scm!/immediate, atomic-scm-compare-and-swap!/immediate):
  New instructions.
  (make-atomic-box, atomic-box-ref, atomic-box-set!, atomic-box-swap!)
  (atomic-box-compare-and-swap!): Disable these ops.
* module/language/bytecode.scm (compute-instruction-arity): Add C8_S24
  support.
* module/system/vm/assembler.scm: Add C8_S24 support.  Export assemblers
  for new opcodes.
* module/system/vm/disassembler.scm (disassembler): Support C8_S24.
* module/language/cps/compile-bytecode.scm (compile-function): Replace
  old atomic-box assemblers with the new instructions.
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
* module/language/cps/types.scm (annotation->type): Add cases for atomic
  boxes.  Mark as all memory kinds because atomic ops serialize memory
  accesses.
* module/language/tree-il/compile-cps.scm (make-atomic-box):
  (ensure-atomic-box, atomic-box-ref, atomic-box-set!):
  (atomic-box-swap!, atomic-box-compare-and-swap!): Explode these ops to
  more basic instructions.
* module/system/base/types/internal.scm (%tc7-atomic-box): Add forgotten
  export.
2018-04-13 10:09:56 +02:00
Andy Wingo
3047bcaefb Remove dead code in CPS converter
* module/language/tree-il/compile-cps.scm: Remove dead primcall
  expanders.
2018-04-10 14:10:03 +02:00
Andy Wingo
21d5897b4c Instruction explosion for char->integer
* module/language/cps/effects-analysis.scm:
* module/language/cps/slot-allocation.scm (compute-var-representations):
* module/language/cps/types.scm:
* module/language/cps/compile-bytecode.scm (compile-function): Remove
  char->integer cases.
* module/system/vm/assembler.scm: Remove emit-char->integer export.
* module/language/tree-il/compile-cps.scm (char->integer): Define
  instruction exploder.
2018-04-10 13:45:33 +02:00
Andy Wingo
880d68ea22 Instruction explosion for integer->char
* module/language/tree-il/compile-cps.scm (integer->char): Instruction
  explosion!
2018-04-10 13:22:59 +02:00
Andy Wingo
2964abad05 Explode "string-set!"
* module/language/cps/effects-analysis.scm (string-ref): Remove effects
  declaration, given that the primitive is exploded now.
* module/language/cps/reify-primitives.scm (compute-known-primitives):
  Add string-set!.
* libguile/vm-engine.c (string-set!): Disable opcode.
* module/language/cps/types.scm (string-ref, string-set!): Remove type
  checker and inferrers for string-ref and string-set!, as both are
  exploded.  In the case of string-set! there are still type-check
  effects in the intrinsic call but they can't be elided by the checker,
  as we don't track when strings are read-only.
* module/language/tree-il/compile-cps.scm (ensure-char): New helper.
  (string-set!): New primcall exploded converter.
2018-04-10 12:14:47 +02:00
Andy Wingo
7a109dddd7 Lower string-ref in CPS conversion
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
* module/language/cps/types.scm (annotation->type): Hackily consider
  stringbuf memory to be string memory.
* module/language/tree-il/compile-cps.scm (string-ref): Add horrible
  lowering conversion for string-ref.
2018-04-09 10:13:09 +02:00
Andy Wingo
39fb7e540b CPS conversion lowers string-length
* module/language/cps/types.scm (annotation->type):
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
  Add case for string memory kinds.  Remove special type and effect
  inferrers for string-length.
* module/language/cps/slot-allocation.scm (compute-var-representations):
  Remove string-length.
* module/language/tree-il/compile-cps.scm (ensure-string): New helper.
  (string-length): Add custom converter.
2018-04-08 10:27:52 +02:00
Andy Wingo
dd203e5d7d Remove optimizer and backend support for struct ops
* module/language/cps/compile-bytecode.scm:
* module/language/cps/cse.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/reify-primitives.scm:
* module/language/cps/specialize-primcalls.scm:
* module/language/cps/types.scm:
* module/language/tree-il/cps-primitives.scm:
* module/system/vm/assembler.scm: Remove support for struct-ref,
  struct-set!, allocate-struct, struct-vtable CPS primcalls and bytecode
  instructions.
2018-01-22 07:51:08 +01:00
Andy Wingo
91bf9b1db3 Lower "make-struct/simple" to CPS
* module/language/tree-il/cps-primitives.scm (struct-init!): Add
  primitive, just used in internal translations.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*primitive-constructors*): Recognize "make-struct/simple" instead of
  allocate-struct.
* module/language/tree-il/compile-cps.scm (ensure-vtable): New helper.
  (allocate-struct, struct-init!): New lowerers.
  (convert): Add struct-init! case.
  (canonicalize): Convert make-struct/simple like vector.
2018-01-22 07:28:11 +01:00
Andy Wingo
557acdbbba Instruction explosion for struct-ref, struct-set!
* module/language/cps/effects-analysis.scm (&memory-kind-mask): Add
  &bitmask, for the bitmask in vtables.
  (annotation->memory-kind): Add 'bitmask case.
* module/language/tree-il/compile-cps.scm (ensure-struct-index-in-range):
  (prepare-struct-scm-access): New helpers.
  (struct-ref/immediate, struct-set!/immediate): New exploded lowering
  routines.
  (struct-ref, struct-set!): New lowering routines that just do a call.
  (canonicalize): Remove struct-ref hack; lowering procedures will
  handle it.
* module/language/tree-il/cps-primitives.scm (bytevector-length): Define
  struct-set! as returning a value.
2018-01-19 21:57:03 +01:00
Andy Wingo
42837e9108 Instruction explosion for bv-length
* module/language/tree-il/compile-cps.scm (ensure-vector):
  (prepare-bytevector-access): Add assumptions on lengths.
  (bv-length): New lowerer.
2018-01-16 16:43:10 +01:00
Andy Wingo
94fdc5cad9 Instruction explosion for bytevector setters
* module/language/cps/compile-bytecode.scm (compile-function): Fix
  emitters for u64-set! et al.
* module/language/tree-il/compile-cps.scm (bytevector-set-converter):
  New helper.  Lower bytevector setters to pointer ops.
2018-01-16 10:05:03 +01:00
Andy Wingo
1b955b01c3 Add f32-ref, f64-ref lowering procs
* module/language/tree-il/compile-cps.scm (bytevector-ref-converter):
  Take kind as tag, not boolean.  Support floats.  Adapt and add
  lowerers for float-ref procedures.
2018-01-15 20:51:00 +01:00
Andy Wingo
0270d235bd Instruction explosion for integer bytevector ref procedures
* module/language/cps/compile-bytecode.scm (compile-function): Fix
  emitters for u16-ref et al.
* module/language/tree-il/compile-cps.scm (bytevector-ref-converter):
  (define-bytevector-ref-converter, define-bytevector-ref-converters):
  New helpers.  Use to define lowerers for bv-s32-ref et al.
2018-01-15 20:25:53 +01:00
Andy Wingo
535d6fad80 Custom bv-u8-ref lowering procedure
* module/language/tree-il/compile-cps.scm (untag-bytevector-index):
  (ensure-bytevector, prepare-bytevector-access): New helpers.
  (bv-u8-ref): New lowerer.
* module/language/cps/types.scm (annotation->type):
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
  Support bytevectors.
2018-01-14 14:38:35 +01:00
Andy Wingo
c7b3379a4c Instruction explosion for struct-vtable
* module/language/tree-il/compile-cps.scm (ensure-struct): New helper.xo
  (struct-vtable): New lowering procedure.
* module/language/cps/types.scm (annotation->type): Add struct.
  (scm-ref/tag, scm-set!/tag): Fix to get type from annotation.
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
  Add struct.
2018-01-10 19:47:58 +01:00
Andy Wingo
24f998e4d2 Lower box, box-ref, box-set! primcalls
* module/language/tree-il/compile-cps.scm (box, ensure-box):
  (box-ref, box-set!): Lower box primcalls.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/cse.scm (compute-equivalent-subexpressions):
* module/language/cps/dce.scm (compute-live-code):
* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm: Remove special support for boxes.  What
  a pleasure!
2018-01-10 07:59:21 +01:00
Andy Wingo
55a8483435 Improve make-vector compilation for known big sizes
* module/language/tree-il/compile-cps.scm
  (emit-initializations-as-loop): New helper.
  (make-vector): Use new helper.
  (make-vector/immediate): Emit a loop if the number of words is greater
  than or equal to 32.  An arbitrary limit that could be adjusted later.
2018-01-07 23:07:12 +01:00
Andy Wingo
5e1109a97f Better compilation of vector constructors and initializers
* module/language/tree-il/cps-primitives.scm (allocate-vector)
  (vector-init!): Declare these primitives which later go away when
  lowering to CPS.
* module/language/tree-il/compile-cps.scm (vector-init!): New
  converter.
  (allocate-vector): New converter.
2018-01-07 22:51:17 +01:00
Andy Wingo
49fa4980bb Expand pair-related primcalls
* module/language/tree-il/compile-cps.scm (ensure-pair): New helper.
  (cons, car, cdr, set-car!, set-cdr!): New expanders.
* module/language/cps/closure-conversion.scm (convert-one):
* module/language/cps/contification.scm (apply-contification): Emit
  lower-level instructions for making pairs.
2018-01-07 18:44:48 +01:00
Andy Wingo
9a1d2d8ec8 Minor compile-cps refactor for cons
* module/language/tree-il/compile-cps.scm (build-list): Pass cons
  through an expander.
2018-01-07 17:57:45 +01:00
Andy Wingo
ee84af1311 Compiler frontend support for vector mutability checks
* module/language/tree-il/compile-cps.scm (ensure-vector):
  (prepare-vector-access, prepare-vector-access/immediate):
  (vector-length, vector-ref, vector-ref/immediate):
  (vector-set!, vector-set!/immediate): Use mutable-vector? predicate
  for write access.
2018-01-07 17:38:40 +01:00
Andy Wingo
3cedc108d8 Add CPS compilation support for mutable-vector?
* module/system/base/types/internal.scm (heap-tags): Add
  immutable-vector? and mutable-vector?.
* module/language/tree-il/cps-primitives.scm:
* module/system/vm/disassembler.scm: Bump copyright lines.
2018-01-07 16:41:40 +01:00
Andy Wingo
f488bc53e7 Instruction explosion for /immediate variants of vector prims
* module/language/tree-il/compile-cps.scm
  (prepare-vector-access/immediate): New helper.
* module/language/tree-il/compile-cps.scm (vector-ref/immediate):
  (vector-set!/immediate, make-vector/immediate): New expanders.
2018-01-07 15:42:39 +01:00
Andy Wingo
c766a883d3 Instruction explosion for make-vector
* module/language/tree-il/compile-cps.scm (untag-fixnum-in-imm-range):
  New helper.
  (make-vector): New custom expander.  Gnarly; to refactor.
2018-01-07 15:42:39 +01:00
Andy Wingo
7486806ba3 Improve compilation of make-vector without init
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Add
  expansion for one-argument make-vector.
2018-01-05 15:18:16 +01:00
Andy Wingo
a821042480 Allow peval to gnaw on string->symbol, symbol->string
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*): Add string->symbol and symbol->string.
2018-01-05 15:17:46 +01:00
Andy Wingo
6fdbd3b17b Instruction explosion for vector-{length,ref,set!}
* module/language/tree-il/compile-cps.scm (ensure-vector)
  (untag-fixnum-index-in-range, compute-vector-access-pos)
  (prepare-vector-access): New helpers.
  (vector-length, vector-ref, vector-set!): New expanders.
2018-01-05 14:42:40 +01:00
Andy Wingo
51fd5952cb Disable resolve-primitives pass below -O2
* module/language/tree-il/optimize.scm (optimize): Disable
  resolve-primitives below -O2.  This is because compile-cps is going to
  start expanding all primcalls it sees.
2018-01-05 10:40:03 +01:00
Andy Wingo
16db934bbc Add (system base optimize) module
* module/system/base/optimize.scm: New module.
* module/Makefile.am (SOURCES):
* am/bootstrap.am (SOURCES): Add new module.
* module/language/tree-il/optimize.scm (tree-il-optimizations): Rename
  from tree-il-default-optimization-options.  Directly specify the
  optimization level at which a pass should be enabled.
* module/language/cps/optimize.scm (cps-optimizations): Likewise, rename
  from cps-default-optimization-options.
* module/scripts/compile.scm (%options, show-optimization-help): Adapt
  to use new module.
2018-01-05 10:19:54 +01:00