summaryrefslogtreecommitdiff
path: root/module/system/base
AgeCommit message (Collapse)AuthorFilesLines
2021-05-11Add support for recording inlinable module exportsAndy Wingo1-2/+4
* 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-11Add pass to resolve free toplevel references in declarative modulesAndy Wingo1-0/+1
* 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-10bug#45131: [PATCH] Compile directly to target language if no joint is found.Leo Prikler1-11/+15
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-10Minor tweak to truncate-bitsAndy Wingo1-8/+5
* module/system/base/types/internal.scm (truncate-bits): Use bits-case in all cases.
2021-05-06Optimize truncate-bitsAndy Wingo1-4/+17
* module/system/base/types/internal.scm (truncate-bits): Inline cases for 16, 32, and 64, to avoid allocating bignums for the boundary conditions.
2021-04-21New pass: elide-arity-checksAndy Wingo1-0/+1
* 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-03-10Add mkstemp; undocument mkstemp!Andy Wingo1-6/+6
* 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-01-07New warnings: -Wuse-before-definition, -Wnon-idempotent-definitionAndy Wingo1-1/+13
* 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.
2020-08-12Add new pass to optimize branch chains to table dispatchAndy Wingo1-0/+1
* 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-03CPS compiler reduces eq? on constant to eq-constant?Andy Wingo1-16/+19
* 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-03Rework the way immediate encodings are calculated.Andy Wingo1-2/+51
* 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-06-01Change -O1 compiler to use baseline and also resolve primitivesAndy Wingo1-10/+2
* 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-05-12Delay loading CPS unless CPS compiler usedAndy Wingo1-13/+12
* 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-11Avoid having "guild compile" load optimizersAndy Wingo1-5/+39
* 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-08Add compiler chooser implementation; fix bugs with previous commitAndy Wingo2-25/+33
* 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-08Sketch of how to choose different compiler based on -O0Andy Wingo1-6/+16
* module/system/base/compile.scm (next-pass, compute-compiler): Allow optimization level to determine pass order.
2020-05-08Define new "lowering" phase in compilerAndy Wingo2-8/+8
* 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-08Warning and optimization levels always small integersAndy Wingo1-6/+7
* 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-08Add language-specific analysis pass to compiler infrastructureAndy Wingo3-26/+51
* 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-08Add #:optimization-level, #:warning-level compile keyword argsAndy Wingo1-10/+34
* 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-08Rework compile-foldAndy Wingo1-38/+49
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-08Use more `match' in (system base compile)Andy Wingo1-36/+59
* 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-07Slight (system base compile) refactorAndy Wingo1-2/+2
* module/system/base/compile.scm (call-once): Use when instead of if.
2020-05-07Remove compilation order cacheAndy Wingo1-28/+13
* 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-05Update (system base compile) headerAndy Wingo1-16/+11
* module/system/base/compile.scm (system): Clean up imports.
2019-10-23make-record-type does more validation on the fieldsAndy Wingo1-3/+3
* 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.
2018-08-07Add -Wshadowed-toplevel.Ludovic Courtès1-1/+8
* 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-07types: Recognize 'scm_t_port_type' and decode port type name.Ludovic Courtès1-5/+29
* 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-07elisp: Fix cross-compilation support.Mark H Weaver1-2/+8
* 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-07Recognize RISC-V compilation targets.Shea Levy1-0/+2
* 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-04-13Explode atomic box ops to new atomic instructionsAndy Wingo1-0/+1
* 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-10Slim heap-allocated flonumsAndy Wingo1-2/+2
* 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-01-07Add CPS compilation support for mutable-vector?Andy Wingo1-1/+5
* 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-05Add (system base optimize) moduleAndy Wingo1-0/+43
* 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.
2017-12-27Fix mismatch between CPS and Scheme "complex?" predicateAndy Wingo1-2/+2
* 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-11-29Merge until 81d2e352663bc5f80734312fec90f250b1fbe2e4 from stable-2.2Andy Wingo1-10/+20
2017-11-11Convert "ash" to "lsh"/"rsh" when lowering to CPSAndy Wingo1-1/+8
* 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-11Compiler uses target fixnum rangeAndy Wingo1-1/+14
* 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-05Allow GDB support to be used with GDB-linked-against-Guile-2.0.Ludovic Courtès1-10/+20
* 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(system base types) uses target's idea of max size_tAndy Wingo1-2/+26
* 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-10-29Rename "number" tag to "heap-number"Andy Wingo2-4/+4
* 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-29Refactor (system base types internal) to use more macrosAndy Wingo2-71/+144
* module/system/base/types/internal.scm (visit-immediate-tags) (visit-heap-tags): New helpers. * module/system/base/types/internal.scm (define-tags, define-tag): New helpers. (immediate-tags, heap-tags): Use define-tags to define all of the tag values. For consistency some names are changed: (%tc2-fixnum): Renamed from %tc2-inum. (%tc8-flag): Removed. (%tc16-null): Renamed from %tc16-eol. (%tc7-weak-vector): Renamed from %tc7-wvect. (%tc7-hash-table): Renamed from %tc7-hashtable. (%tc7-flonum): Renamed from %tc7-real. (visit-heap-tags, visit-immediate-tags): New exports. * module/system/base/types.scm (cell->object): Adapt to renamings. (match-bit-pattern): Add a case to match immediate SCM bits literally. (scm->object): Adapt to use the special immediate values directly. * module/system/vm/disassembler.scm (immediate-tag-annotations): (heap-tag-annotations): Adapt to new names.
2017-10-25Add (system base types internal).Andy Wingo2-50/+144
* module/system/base/types/internal.scm: New file, extracted from (system base types). * module/system/base/types.scm: Use (system base types internal) and adapt to %tc1-pair, %tc2-inum, and %tc3-heap-object name changes. * module/Makefile.am (SOURCES): * am/bootstrap.am (SOURCES): Add new file.
2017-09-22Merge stable-2.2 into masterAndy Wingo1-1/+1
This commit resolves conflicts by removing the deprecated make-struct.
2017-09-20Use make-struct/no-tail instead of make-structAndy Wingo1-1/+1
* module/ice-9/boot-9.scm: * module/language/cps/effects-analysis.scm: * module/language/elisp/falias.scm: * module/language/tree-il.scm: * module/language/tree-il/primitives.scm: * module/rnrs/records/procedural.scm: * module/srfi/srfi-35.scm: * module/system/base/syntax.scm: Change uses of make-struct to make-struct/no-tail.
2017-09-14remove self field of vtablesAndy Wingo1-2/+2
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT, scm_vtable_index_self): Remove "self" field. Renumber the other fields. * module/oop/goops.scm (<self-slot>): Remove. (fold-class-slots): Adapt for "self" slot removal. Adapt all users. (class-redefinition): Now that there is no "self" slot to update, use %modify-instance instead of %modify-class. * libguile/goops.c (class_self): Remove. (scm_sys_modify_class): Remove. * libguile/goops.h (scm_sys_modify_class): Remove. * module/rnrs/records/procedural.scm: Import vtable-offset-user. Renumber rtd indexes using vtable-offset-user. * module/srfi/srfi-35.scm (%condition-type-vtable): Remove mention of vtable fields. * module/system/base/types.scm (address->inferior-struct): Adapt for different vtable field layout.
2017-09-14Remove indirection in structsAndy Wingo1-5/+6
* libguile/gc.c (scm_storage_prehistory): Register struct displacement here. * libguile/goops.c (scm_sys_modify_instance): Fix the format of a comment. * libguile/modules.c (scm_post_boot_init_modules): Update for new format of struct vtable references. * libguile/struct.c (scm_i_alloc_struct): Update to include slots directly, instead of being indirected by an embedded pointer. (scm_c_make_structv, scm_allocate_struct, scm_i_make_vtable_vtable): Adapt to pass vtable bits as argument to scm_i_alloc_struct, not vtable data bits. (scm_init_struct): Remove two-word displacement from libgc. * libguile/struct.h: Update comment. (SCM_STRUCT_SLOTS, SCM_STRUCT_DATA): Update definitions. (SCM_STRUCT_VTABLE_DATA, SCM_STRUCT_VTABLE_SLOTS): Remove. (SCM_STRUCT_VTABLE, SCM_STRUCT_LAYOUT, SCM_STRUCT_PRINTER) (SCM_STRUCT_FINALIZER, SCM_STRUCT_VTABLE_FLAGS) (SCM_STRUCT_VTABLE_FLAG_IS_SET): Simplify definitions. * module/system/base/types.scm (cell->object, address->inferior-struct): Adapt to struct representation change.
2017-04-14types: Hide one of the 'bytevector->string' procedures.Ludovic Courtès1-2/+2
* module/system/base/types.scm: Hide 'bytevector->string' from (rnrs io ports).
2017-03-28Add disjoint syntax object typeAndy Wingo1-0/+6
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, noinst_HEADERS): Add syntax.c and syntax.h. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (class_syntax, scm_class_of, scm_goops_early_init): * libguile/init.c (scm_init_guile): * libguile/print.c (iprin1): * libguile/tags.h (scm_tc7_syntax): * module/oop/goops.scm (<syntax>): * module/system/base/types.scm (%tc7-syntax, cell->object): * module/system/vm/disassembler.scm (code-annotation): Wire up the new data type. * libguile/syntax.c: * libguile/syntax.h: New files. * module/ice-9/boot-9.scm: Move new definitions to (system syntax internal). * module/system/syntax.scm (print-syntax): New helper. * module/system/vm/assembler.scm (statically-allocatable?) (intern-constant, link-data): Arrange to be able to write syntax objects into images. * module/language/cps/types.scm (&syntax): New type. Remove &hash-table; it was never detected, an internal binding, and we need the bit to avoid going into bignum territory.
2017-03-07psyntax: Generate identifiers in a deterministic fashion.Mark H Weaver1-4/+4
Fixes <http://bugs.gnu.org/20272>. * module/ice-9/boot-9.scm (module-generate-unique-id!) (module-gensym): New procedures. (module): Add 'next-unique-id' field. (the-root-module): Inherit 'next-unique-id' value from early stub. (make-module, make-autoload-interface): Adjust calls to module-constructor. * module/ice-9/psyntax.scm (gen-label, new-mark): Generate unique identifiers from the module name and the per-module unique-id. (build-lexical-var, generate-temporaries): Use 'module-gensym' instead of 'gensym'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/language/tree-il/fix-letrec.scm (fix-letrec!): Use 'module-gensym' instead of 'gensym'. * module/system/base/syntax.scm (define-record): Likewise. (transform-record): Likewise. Co-authored-by: Ludovic Courtès <ludo@gnu.org>