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

252 commits

Author SHA1 Message Date
Matt Wette
a12ca2b999 multiple languages support via file extension or #lang header
From scripts/compile pushed default assumption of #:from as 'scheme down
into system/base/compile where filename and first line can be used to
deduce intended "from" language.  If first line of a file is of the form
  #lang ecmascript
then the file is assumed consist of source language "ecmascript".

* module/scripts/compile.scm (compile): changed default #:from to #f
  from 'scheme

* module/system/base/compile.scm(lang-from-port, %file-extension-map,
  add-lang-extension, lang-extension-for): added global
  %file-extension-map with accessor lang-extension-for and updater
  add-lang-extension.  Also, added lang-from-port to parse  first line,
  looking for #lang.

* test-suite/tests.scm: added "load-lang" test.

* test-suite/Makefile.am(SCM_TESTS): added tests/load-lang.test
2023-02-23 21:41:55 +01:00
Zhang Ning
f3ea8f7fa1 Recognize LoongArch compilation targets.
* module/system/base/target.scm (cpu-endianness): Add case for "Loongarch" variants

Signed-off-by: Zhang Ning <zhangn1985@outlook.com>
2022-12-21 08:49:08 +01:00
Andrew Whatson
eb5ecf4944 Properly display locations in "source vector" form.
Locations are stored in tree-il records in "source vector" form, but
`location-string' was rendering these as <unknown-location>.

* module/system/base/message.scm (location-string): Support locations
passed as a file/line/column vector.
2022-08-26 12:34:39 +02:00
Taylor R Campbell
e4e8afd6c8 Allow empty vendor string in GNU target triplets.
NetBSD and pkgsrc have been using an empty vendor string since the
mid-'90s, such as x86_64--netbsd.  pkgsrc has been carrying around a
workaround just the guile build for a long time.  (Before that,
NetBSD omitted the vendor altogether, so if x86_64 existed then it
might have been `x86_64-netbsd', but that caused more problems.)
This change makes Guile accept an empty vendor string so workarounds
are no longer necessary.

* module/system/base/target.scm (validate-target): Allow empty vendor
string in GNU target triplets.
* test-suite/tests/cross-compilation.test ("cross-compilation"): Add
tests for "x86_64--netbsd".

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 09:42:05 +02:00
Ludovic Courtès
8e2e2ceb17 Deprecate symbol properties.
* libguile/strings.c (scm_i_make_symbol): Remove 'props' argument.  Use
3 words instead of 'scm_double_cell'.
* libguile/strings.h: Adjust accordingly.
* libguile/symbols.c (scm_i_str2symbol, scm_i_str2uninterned_symbol):
Likewise.
(scm_symbol_fref, scm_symbol_pref, scm_symbol_fset_x,
scm_symbol_pset_x): Move to...
* libguile/deprecated.c: ... here.  Rewrite in terms of object
properties.
(symbol_function_slot, symbol_property_slot): New variables.
* libguile/symbols.h (SCM_SYMBOL_FUNC, SCM_SET_SYMBOL_FUNC)
(SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS)
(scm_symbol_fref, scm_symbol_pref, scm_symbol_fset_x)
(scm_symbol_pset_x): Move to...
* libguile/deprecated.h: ... here.  Mark declarations as 'SCM_DEPRECATED'.
* module/system/base/types.scm (cell->object): Remove 'props' field for
%TC7-SYMBOL.
* doc/ref/api-data.texi (Symbol Props): Remove.
* NEWS: Update.
2022-02-04 11:12:28 +01:00
Andy Wingo
9b9149a5bf Rework bootstrap to be reproducible
* configure.ac:
* Makefile.am (SUBDIRS): Replace bootstrap/ with stage0, stage1, and
stage2.
* am/bootstrap.am: Include all files and all rules.
* meta/build-env.in (GUILE_AUTO_COMPILE): Always turn off
auto-compilation.  Take a GUILE_BOOTSTRAP_STAGE argument, which can be
stage0, stage1, stage2, or unset.  Adapt the load-compiled path
accordingly.
* meta/uninstalled-env.in: Include .go files from stage2.
* module/Makefile.am: Rework to use boostrap.am.
* module/system/base/optimize.scm (available-optimizations): Punt the
inlinable-exports machinery to -O2.
* stage0/Makefile.am:
* stage1/Makefile.am:
* stage2/Makefile.am: New files.
2022-02-01 14:50:40 +01:00
Andy Wingo
6f1b620b82 Add -Ooptimize-known-return-types at -O2
* module/language/cps/optimize.scm (optimize-first-order-cps):
* module/system/base/optimize.scm (available-optimizations): Add
optimize-known-return-types at -O2.
2021-11-15 15:32:54 +01:00
Fabrice Fontaine
ffb33fd66b module/system/base/target.scm: support riscv32
Fix the following build failure on riscv32:

system/base/target.scm:132:16: In procedure triplet-pointer-size:
unknown CPU word size "riscv32"

Fixes:
 - http://autobuild.buildroot.org/results/6705630c1484239ec8b73d57ebc2e2570fbfc8f8

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-11-05 10:15:26 +01:00
Vineet Gupta
492bd63883 Add support for arc
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

NB: closes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48816
2021-11-03 10:59:03 +01:00
Andy Wingo
cbfad75fa6 Add support for recording inlinable module exports
* module/language/tree-il/inlinable-exports.scm: New module.
* am/bootstrap.am:
* module/Makefile.am:
* module/language/tree-il/optimize.scm (make-optimizer):
* module/system/base/optimize.scm (available-optimizations): Wire up new
module.
* module/ice-9/boot-9.scm (module): Add inlinable-exports field.
(define-module*): Add #:inlinable-exports kwarg.
2021-05-11 21:39:07 +02:00
Andy Wingo
a892791b43 Add pass to resolve free toplevel references in declarative modules
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES):
* module/language/tree-il/optimize.scm (make-optimizer): Wire up the new
pass.
* module/language/tree-il/resolve-free-vars.scm: New pass.
* module/system/base/optimize.scm (available-optimizations): Enable new
pass at -O1.
2021-05-11 21:39:07 +02:00
Leo Prikler
5c6a944173 bug#45131: [PATCH] Compile directly to target language if no joint is found.
This enables the compilation from "manually" written Tree-IL to
bytecode.  See also <https://bugs.gnu.org/45131>.

* system/base/compile.scm (read-and-compile)[(joint #f)]<? eof-object?>:
Join exps using the default joiner for to.
<exp>: Compute compiler for to.
* test-suite/test/compiler.test ("read-and-compile tree-il"): New test.
2021-05-10 10:16:10 +02:00
Andy Wingo
1432088f27 Minor tweak to truncate-bits
* module/system/base/types/internal.scm (truncate-bits): Use bits-case
in all cases.
2021-05-10 10:07:12 +02:00
Andy Wingo
05614f792b Optimize truncate-bits
* module/system/base/types/internal.scm (truncate-bits): Inline cases
for 16, 32, and 64, to avoid allocating bignums for the boundary
conditions.
2021-05-06 21:51:37 +02:00
Andy Wingo
86e86ec1c7 New pass: elide-arity-checks
* module/language/cps/elide-arity-checks.scm: New file.  Elides argument
count checks for known callers.
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add new file.
* module/language/cps/optimize.scm (optimize-first-order-cps):
* module/system/base/optimize.scm (available-optimizations): Add new
pass.
2021-04-21 22:41:12 +02:00
Andy Wingo
85433fc2b1 Add mkstemp; undocument mkstemp!
* doc/ref/posix.texi (File System): Update to document mkstemp only.
* libguile/filesys.c: Make a mkstemp that doesn't modify the input
template.  Instead the caller has to get the file name from
port-filename.
(scm_mkstemp): Use the new mkstemp to implement mkstemp!.  Can't
deprecate yet though as the replacement hasn't been there for long
enough.
* libguile/posix.c (scm_tempnam): Update to mention mkstemp instead.
* module/system/base/compile.scm (call-with-output-file/atomic): Use
mkstemp.
* test-suite/tests/posix.test:
* test-suite/tests/r6rs-files.test: Use mkstemp.
* NEWS: Update.
2021-03-10 20:40:10 +01:00
Andy Wingo
9d5978a756 New warnings: -Wuse-before-definition, -Wnon-idempotent-definition
* module/ice-9/boot-9.scm (%auto-compilation-options): Add
  use-before-definition and non-idempotent-definition.
* module/language/tree-il/analyze.scm (<use-before-def-info>): New
  analysis info.
  (make-use-before-definition-analysis): New function.
  (goops-toplevel-definition): Move down.
  (unbound-variable-analysis, macro-use-before-definition): Remove, as
  they are subsumed by use-before-def.  There are some deprecated
  bindings though.
  (make-analyzer): Rework to allow for use-before-def analysis to handle
  multiple
* module/system/base/message.scm (%warning-types): Add handlers for the
  new warning types.
* test-suite/tests/tree-il.test: Add tests.
* doc/ref/api-evaluation.texi (Compilation): Update.
2021-01-07 10:26:33 +01:00
Andy Wingo
03998db647 Add new pass to optimize branch chains to table dispatch
* module/language/cps/switch.scm: New pass.

* module/Makefile.am (SOURCES):
* am/bootstrap.am (SOURCES): Add switch.scm.

* module/system/base/optimize.scm (available-optimizations):
* module/language/cps/optimize.scm (optimize-first-order-cps): Run
  switch optimization at level 2.

* libguile/hash.c (JENKINS_LOOKUP3_HASHWORD2): Add note regarding
  cross-compilation.

* module/language/cps/graphs.scm (intmap-select): New definition.
* module/language/cps/utils.scm (compute-singly-referenced-labels): Move
  here, from various places.  Doesn't take a body intset argument.

* module/language/cps/contification.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/simplify.scm: Use compute-singly-referenced-labels
  from utils.

* module/language/cps/effects-analysis.scm (annotation->memory-kind*):
  (annotation->memory-kind): Add symbol annotation cases.
2020-08-12 23:30:08 +02:00
Andy Wingo
d238566d0e CPS compiler reduces eq? on constant to eq-constant?
* module/language/cps/compile-bytecode.scm (compile-function): Expect
  eq-constant? instead of eq-null?, etc.
* module/language/cps/effects-analysis.scm: Likewise.
* module/language/cps/reify-primitives.scm (reify-primitives): For
  eq-constant?, reify a $const unless the constant is an immediate whose
  encoding fits in 16 bits.
* module/language/cps/type-fold.scm (materialize-constant): Helper to
  make a constant from a type, min, and max.
  (fold-eq-constant?): New helper.
  (eq-constant?): New folder.
  (undefined?): Define specifically.
  (define-nullish-predicate-folder): Renamd from
  define-special-immediate-predicate-folder.  Use only for null?, false,
  and nil?.
  (*branch-reducers*): New mechanism.  Reduce eq? to eq-constant? if
  possible.
  (local-type-fold): Refactor to use materialize-constant, and to allow
  reducing branches.
* module/language/cps/types.scm (constant-type): Return three values
  instead of a type entry.
  (constant-type-entry): New function that returns a type entry.  Adapt
  callers.
  (infer-constant-comparison): New helper.
  (eq-constant?): New inferrer.
  (undefined?): New inferrer.
* module/language/tree-il/compile-bytecode.scm (eq-constant?): Fix
  truncate-bits signed arg.
  (define-immediate-type-predicate): Adapt to visit-immediate-tags
  change.
* module/language/tree-il/compile-cps.scm (convert): Convert eq? to
  constant to eq-constant?.  Advantaged is that it gets fixnums and
  chars in addition to special immediates.
* module/language/tree-il/cps-primitives.scm (define-immediate-type-predicate):
  Adapt to allow #f as pred.
* module/system/base/types/internal.scm (immediate-tags): Use #f as pred
  for false, nil, etc.
  (immediate-bits->scm): Adapt.
* module/system/vm/assembler.scm (emit-eq-null?, emit-eq-nil?)
  (emit-eq-false?, emit-eq-true?, emit-unspecified?, emit-eof-object?):
  Remove specialized emitters.
* module/system/vm/assembler.scm (define-immediate-tag=?-macro-assembler):
  Allow for pred to be #f.
* module/system/vm/disassembler.scm (define-immediate-tag-annotation):
  Adapt to pred being #f.
2020-08-03 22:19:18 +02:00
Andy Wingo
daf3e88a81 Rework the way immediate encodings are calculated.
* module/system/base/types/internal.scm (scm->immediate-bits):
  (immediate-bits->scm, sign-extend, truncate-bits): New public
  routines.
* module/system/vm/assembler.scm (immediate-bits): Reimplement in terms
  of scm->immediate-bits and similar.
  (X8_S8_I16, X8_S8_ZI16): Rework operand encodings.
  (load-constant): Use truncate-bits to determine which cases apply.
2020-08-03 22:19:18 +02:00
Andy Wingo
e2066d2e63 Change -O1 compiler to use baseline and also resolve primitives
* bootstrap/Makefile.am (GUILE_OPTIMIZATIONS): Change to just -O1.
* module/language/tree-il/spec.scm (choose-compiler): Use CPS for -O2
  and higher.
* module/system/base/optimize.scm (available-optimizations): CPS for -O2
  and higher, but -Oresolve-primitives now at -O1 also.
2020-06-01 21:15:39 +02:00
Andy Wingo
cb8cabe85f Delay loading CPS unless CPS compiler used
* module/language/tree-il/spec.scm: Remove #:compilers declaration;
  instead rely on choose-compiler.
  (choose-compiler): Load compilers on demand.
* module/system/base/compile.scm (find-language-joint): Use next-pass
  instead of lookup-compilation-order, to avoid loading unused
  compilers.
  (read-and-compile): Adapt to find-language-joint change.
  (compute-compiler): Export.
* module/scripts/compile.scm (compile): Use compute-compiler to load
  compiler modules.
2020-05-12 09:54:19 +02:00
Andy Wingo
b5108ccb2a Avoid having "guild compile" load optimizers
* module/language/cps/optimize.scm (cps-optimizations):
* module/language/tree-il/optimize.scm (tree-il-optimizations):
* module/system/base/optimize.scm (available-optimizations): Invert the
  dependency tree to hold the names and default optimization levels in a
  central place instead of in the optimizers.  It moves definitions
  farther from uses, but it avoids us having to load the CPS optimizer
  if we don't need it, which improves bootstrap times.
2020-05-11 15:42:20 +02:00
Andy Wingo
f711ab85b2 Add compiler chooser implementation; fix bugs with previous commit
* module/system/base/compile.scm (next-pass): Invoke the language's
  compiler chooser if there is more than one compiler.
  (compute-compiler): Ensure from and to are languages.
* module/system/base/language.scm (<language>): Add compiler-chooser
  field.
* module/language/brainfuck/spec.scm (choose-compiler, brainfuck):
  Define a compiler chooser.
2020-05-08 22:56:37 +02:00
Andy Wingo
ded883b6f0 Sketch of how to choose different compiler based on -O0
* module/system/base/compile.scm (next-pass, compute-compiler): Allow
  optimization level to determine pass order.
2020-05-08 17:28:55 +02:00
Andy Wingo
4311dc9858 Define new "lowering" phase in compiler
* module/language/cps/compile-bytecode.scm (compile-bytecode):
* module/language/tree-il/compile-bytecode.scm (compile-bytecode):
* module/language/tree-il/compile-cps.scm (compile-cps): Rely on
  compiler to lower incoming term already.
* module/language/tree-il/optimize.scm (make-lowerer): New procedure.
* module/system/base/compile.scm (compute-lowerer): New procedure,
  replaceing add-default-optimizations.
  (compute-compiler): Lower before running compiler.
* module/system/base/language.scm (<language>): Change
  optimizations-for-level field to "lowerer".
* module/scripts/compile.scm (%options, compile): Parse -O0, -O1 and so
  on to #:optimization-level instead of expanding to all the
  optimization flags.
* module/language/cps/optimize.scm (lower-cps): Move here from
  compile-bytecode.scm.
  (make-cps-lowerer): New function.
* module/language/cps/spec.scm (cps): Declare lowerer.
2020-05-08 17:07:56 +02:00
Andy Wingo
e9c0f3071d Warning and optimization levels always small integers
* module/language/tree-il/analyze.scm (make-analyzer): Expect an int for
  optimization level.
* module/scripts/compile.scm (%options, show-warning-help): No more
  -Wnone / Wall; use -W0 or -W9 instead.
* module/system/base/compile.scm (level-validator): Validate small int.
  (compute-analyzer, add-default-optimizations): Likewise.
* test-suite/tests/optargs.test (without-compiler-warnings):
* test-suite/tests/tree-il.test (call-with-warnings): Parameterize level
  to 0, not #f.
* bootstrap/Makefile.am (GUILE_WARNINGS): Use -W0, not -Wnone.
2020-05-08 16:35:04 +02:00
Andy Wingo
116f94d661 Add language-specific analysis pass to compiler infrastructure
* module/system/base/compile.scm (compute-analyzer): Compute analyzer to
  run on expressions before the compiler runs.
  (add-default-optimizations): Flesh out; still a stub.a
  (read-and-compile, compile, compile-and-load, compile-file): Default
  warning and optimization levels.
  (default-warning-level): New parameter, defaulting to 1.
  (default-optimization-level): New parameter, defaulting to 2.
  Currently unused.
* module/system/base/language.scm (<language>): Add
  optimizations-for-level and analyzer fields.
* module/language/tree-il/compile-bytecode.scm (compile-bytecode):
* module/language/tree-il/compile-cps.scm (optimize-tree-il): No need to
  run warnings passes here; compilers infrastructure will run them.
* module/language/tree-il/spec.scm (tree-il): Define make-analyzer as
  analyzer.
* module/language/tree-il/analyze.scm (make-analyzer): New exported
  procedure.
  (%warning-passes): New private variable.
* .dir-locals.el: Add with-test-prefix/c&e indent mode.
* test-suite/tests/cross-compilation.test:
* test-suite/tests/optargs.test:
* test-suite/tests/tree-il.test: Adjust to disable default warnings.
2020-05-08 15:39:41 +02:00
Andy Wingo
c8c19f2ef3 Add #:optimization-level, #:warning-level compile keyword args
* module/system/base/compile.scm (compile-file, compile-and-load)
  (read-and-compile, compile): New #:optimization-level, #:warning-level
  keyword args.
  (compute-analyzer, add-default-optimizations, compute-compiler): Add
  infra for pass-specific optimizations for a level.  Not yet wired up.
2020-05-08 12:17:30 +02:00
Andy Wingo
52f308e272 Rework compile-fold
Instead of returning a list of passes, returns a closure that does it
all.

* module/system/base/compile.scm (compute-compiler): New function.
  (read-and-compile, compile): Use compile-compiler.
2020-05-08 11:49:01 +02:00
Andy Wingo
6bb996ec66 Use more `match' in (system base compile)
* module/system/base/compile.scm (validate-options): New helper.
  (compile-file, compile-and-load, compile): Call the new helper.
  (compile-passes, compile-fold, find-language-joint):
  (default-language-joiner, decompile-passes, decompile-fold): Use more
  "match".
2020-05-08 10:12:33 +02:00
Andy Wingo
cdb9030f45 Slight (system base compile) refactor
* module/system/base/compile.scm (call-once): Use when instead of if.
2020-05-07 21:22:26 +02:00
Andy Wingo
f38735ffc6 Remove compilation order cache
* module/system/base/language.scm (define-language): Remove
  invalidate-compilation-cache! call.
  (invalidate-compilation-cache!): Deprecate.
  (*decompilation-cache*, *compilation-cache*): Remove.
  (lookup-compilation-order, lookup-decompilation-order): Don't use a
  cache.
  (*current-language*): Only define this when deprecation is enabled.
2020-05-07 21:16:13 +02:00
Andy Wingo
457bc9f1d3 Update (system base compile) header
* module/system/base/compile.scm (system): Clean up imports.
2020-05-05 22:15:46 +02:00
Andy Wingo
f116bd1009 make-record-type does more validation on the fields
* module/ice-9/boot-9.scm (make-record-type): Validate that the fields
  are a unique list of symbols.  Deprecate passing a string as a type
  name.
* module/system/base/syntax.scm (define-record): Update to pass a symbol
  as a type name.
* test-suite/tests/records.test (rtd-foo, rtd-fŏŏ, "records"): Adapt to
  make record types with symbol names.
2019-10-23 14:42:29 +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
Ludovic Courtès
5f75df03c6 types: Recognize 'scm_t_port_type' and decode port type name.
* module/system/base/types.scm (read-c-string, inferior-port-type): New
procedures.
(inferior-port): Use 'inferior-port-type' to determine the port type.
(cell->object): Rename 'flags+type' to 'flags' in the '%tc7-port' case.
* test-suite/tests/types.test ("opaque objects"): Adjust port testse.
(test-inferior-ports): New macro.
("ports"): New test prefix.
2018-08-07 12:13:45 +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
Shea Levy
2662cafd6a Recognize RISC-V compilation targets.
* module/system/base/target.scm (cpu-endianness): Add case for "riscv" variants.

Signed-off-by: Shea Levy <shea@shealevy.com>
Signed-off-by: Mark H Weaver <mhw@netris.org>
2018-08-07 11:40:46 +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
41689edfc3 Slim heap-allocated flonums
* libguile/numbers.h (struct scm_t_double, struct scm_t_complex): Avoid
  adding an extra padding word on systems with 8-byte pointers.
* module/system/base/types.scm (cell->object): Update to compute correct
  offset of embedded double.
2018-04-10 20:01:52 +02: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
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
Andy Wingo
f75d0adc3f Fix mismatch between CPS and Scheme "complex?" predicate
* module/system/base/types/internal.scm (heap-tags): Rename complex and
  fraction predicates to "compnum?" and "fracnum?", as they aren't the
  same as the Scheme predicates "complex?" and "fraction?".
2017-12-27 15:46:31 +01:00
Andy Wingo
82b57d113c Merge until 81d2e35266 from stable-2.2 2017-11-29 21:10:25 +01:00
Andy Wingo
b331ea3193 Convert "ash" to "lsh"/"rsh" when lowering to CPS
* module/language/cps/effects-analysis.scm: Remove case for "ash".
* module/language/cps/types.scm (ash): Remove.
* module/language/tree-il/compile-cps.scm (convert, canonicalize):
  Convert "ash" to "lsh"/"rsh" early on.
* module/system/base/target.scm (target-fixnum?): New procedure.
2017-11-11 22:08:14 +01:00
Andy Wingo
a268c02fa0 Compiler uses target fixnum range
* module/system/base/target.scm (target-most-negative-fixnum):
  (target-most-positive-fixnum): New definitions.
* module/language/cps/types.scm (constant-type, define-exact-integer!)
  (&min/fixnum, &max/fixnum): Use new definitions.
  (&max/vector): Use target-max-vector-length.
2017-11-11 22:08:14 +01:00
Ludovic Courtès
81d2e35266 Allow GDB support to be used with GDB-linked-against-Guile-2.0.
* libguile/Makefile.am (INSTANTIATE): New variable.
(install-data-hook): Use it.
* libguile/libguile-2.2-gdb.scm: Autoload (system vm debug).
Augment %load-path and %load-compiled-path, and reload (system base
types).
* module/system/base/types.scm: Remove #:hide to be 2.0-compatible.
Use (system syntax internal) conditionally when on 2.2.
2017-11-05 18:21:35 +01:00
Andy Wingo
ecff426b89 (system base types) uses target's idea of max size_t
* module/system/base/target.scm (target-max-size-t):
  (target-max-size-t/scm, target-max-vector-length): New public
  functions.
* module/language/cps/types.scm (type-entry-saturating-union): Remove
  restriction of polymorphic types to be within max-size-t; this could
  incorrectly apply constraints on numeric values.
  (&max/size, &max/scm-size): Use target-max-size-t.
  (*max-size-t*): Remove; replace uses with (target-max-size-t).
2017-11-05 15:00:16 +01:00
Andy Wingo
b4db70854b Rename "number" tag to "heap-number"
* module/system/base/types/internal.scm (heap-tags): Rename number to
  heap-number.
* module/system/vm/assembler.scm: Adapt for emit-heap-number?.
* module/system/base/types.scm (%tc7-heap-number): Rename from
  %tc7-number.
2017-10-29 14:07:25 +01:00