summaryrefslogtreecommitdiff
path: root/module/system/base
AgeCommit message (Collapse)AuthorFilesLines
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>
2017-03-01Recognize sh3 as compilation targetsJohn Paul Adrian Glaubitz1-2/+2
* module/system/base/target.scm (cpu-endianness, triplet-pointer-size): Add case for "sh3". Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-11-26Remove special support for fluids in GDB interfaceAndy Wingo1-20/+2
* module/system/base/types.scm (inferior-fluid?, inferior-fluid-number) (<inferior-fluid>): Remove. Fluids won't have numbers in the future. (cell->object): Adapt. * test-suite/tests/types.test ("opaque objects"): Update.
2016-09-06Tweak value of tc7-smob.Andy Wingo1-1/+1
* libguile/tags.h (scm_tc7_smob): * module/system/base/types.scm (%tc7-smob): Tweak this value, just to prove that it can be done. Remove scary comment.
2016-09-06Convert tc7 values to hex in tags.h and elsewhereAndy Wingo1-23/+23
* libguile/tags.h: * module/system/base/types.scm: * module/system/vm/assembler.scm: Convert tc7 values to hex. No change otherwise.
2016-08-08Recognize alpha as compilation targetJames Clarke1-2/+2
* module/system/base/target.scm (cpu-endianness): Add case for "alpha". (triplet-pointer-size): Likewise.
2016-08-07Recognize nios2 as compilation targetMarek Vasut1-2/+2
Add support for the nios2 architecture. Signed-off-by: Marek Vasut <marex@denx.de>
2016-07-25Allow mkstemp! to have optional "mode" argumentAndy Wingo1-1/+1
* m4/mkstemp.m4: Remove. * lib/mkstemp.c: Remove. * lib/mkostemp.c: New file. * m4/mkostemp.m4: New file. * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Remove mkstemp module, replace with mkostemp. * libguile/fports.h: * libguile/fports.c (scm_i_mode_to_open_flags): Factor out helper to parse mode string to open flags. (scm_open_file_with_encoding): Use the new helper. * libguile/filesys.c: (scm_i_mkstemp): Adapt to take optional second argument, being a mode string. Use mkostemp. (scm_mkstemp): Backwards compatible shim that calls scm_i_mkstemp. * doc/ref/posix.texi: * NEWS: Update. * module/system/base/compile.scm (call-with-output-file/atomic): Pass "wb" as mode, to cause O_BINARY to be added on MinGW.
2016-06-25Add -Wmacro-use-before-definitionAndy Wingo1-0/+6
* module/ice-9/boot-9.scm (%auto-compilation-options): * am/guilec (GUILE_WARNINGS): Add -Wmacro-use-before-definition. * module/language/tree-il/analyze.scm (unbound-variable-analysis): Use match-lambda. (<macro-use-info>, macro-use-before-definition-analysis): New analysis. * module/system/base/message.scm (%warning-types): Add macro-use-before-definition warning type. * module/language/tree-il/compile-cps.scm (%warning-passes): Add support for macro-use-before-definition.
2016-06-21Use source file permissions for compiled filesAndy Wingo1-1/+3
* module/system/base/compile.scm (call-with-output-file/atomic): Use the permissions of the source file, if available, as the permissions of the compiled file. Fixes #18477.
2016-05-22Handle zero-length bytevectors correctly in (system base types).Mark H Weaver1-1/+1
* module/system/base/types.scm (cell->object): Use 'get-bytevector-n' instead of 'get-bytevector-all', so that the zero-length case does not return EOF.
2016-05-22Work around requirement that size be non-zero in GDB 'open-memory'.Mark H Weaver1-2/+6
* module/system/base/types.scm (memory-port): Handle zero size case specially.
2016-04-04Use symbols instead of _IONBF values as args to setvbufAndy Wingo1-1/+1
* libguile/ports.c (scm_setvbuf): Use the symbols `none', `line', and `block' instead of the values `_IONBF', `_IOLBF', and `_IOFBF'. * NEWS: Update. * doc/ref/posix.texi (Ports and File Descriptors): Update setvbuf documentation. * module/ice-9/deprecated.scm (define-deprecated): New helper. (_IONBF, _IOLBF, _IOFBF): Define deprecated values. * benchmark-suite/benchmarks/read.bm ("read"): * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): * libguile/r6rs-ports.c (cbip_fill_input): * module/system/base/types.scm (%ffi-memory-backend): * module/web/client.scm (open-socket-for-uri): * module/web/server/http.scm (http-read): * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): ("setvbuf"): * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Update to use non-deprecated interfaces.
2016-02-01Update statprof documentation; deprecate `with-statprof'Andy Wingo1-29/+1
* module/statprof.scm: Remove most of the commentary, as it was duplicated in the manual and was getting out of date. (stats): Remove self-secs-per-call and cum-secs-per-call fields as they can be computed from the other fields. (statprof-call-data->stats): Adapt. (statprof-stats-self-secs-per-call): (statprof-stats-cum-secs-per-call): New functions. (statprof-display/flat): Don't print the seconds-per-call fields, as we are no longer stopping the clock around call counters. Anyway these times were quite misleading. (with-statprof): Deprecate. It took its keyword arguments at the beginning; very complicated! Better to use the `statprof' function. (`statprof' was introduced after `with-statprof' and then `with-statprof' was adapted to use it.) * doc/ref/statprof.texi (Statprof): Port this documentation away from the automatically generated text and update it for the new interfaces like #:display-style. * module/system/base/syntax.scm (record-case): Remove comment that referenced with-statprof. Add comment indicating that record-case should be replaced. * doc/ref/scheme-using.texi (Profile Commands): Update to mention keyword arguments and to link to the statprof documentation.
2015-02-17(system base types) knows about variablesAndy Wingo1-0/+3
* module/system/base/types.scm (%tc7-variable): New tc7. (cell->object): Handle tc7-variable. * test-suite/tests/types.test ("opaque objects"): Add a test.
2015-01-22Merge commit '8cf2a7ba7432d68b9a055d29f18117be70375af9'Andy Wingo2-43/+63
2015-01-22Keywords have a tc7Andy Wingo1-1/+4
* libguile/tags.h (scm_tc7_keyword): Allocate a tc7, so that the VM can have cheap keyword? tests. * libguile/keywords.c: * libguile/keywords.h: Adapt. * libguile/goops.c (scm_class_of, scm_sys_goops_early_init): Capture <keyword>. * libguile/print.c (iprin1): Inline keyword printer. * libguile/evalext.c (scm_self_evaluating_p): Add keywords here. * libguile/deprecated.h: * libguile/deprecated.c (scm_tc16_keyword): Deprecate. * module/language/cps/compile-bytecode.scm (compile-fun): Add keyword? case, and bitvector? case while we're at it. * module/language/cps/effects-analysis.scm (define-primitive-effects): Add bytevector?, keyword?, and bitvector? cases. * module/language/cps/primitives.scm (*branching-primcall-arities*): Add keyword?. * module/language/cps/types.scm (bitvector?, keyword?, bytevector?): Add branch inferrers. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): (*effect+exception-free-primitives*): Add bytevector?, keyword?, and bitvector?. * module/oop/goops.scm (<keyword>): New class. * module/system/base/types.scm (%tc7-keyword, cell->object): Add cases. * module/system/vm/assembler.scm (br-if-keyword): New definition. * module/system/vm/disassembler.scm (code-annotation): Add br-if-tc7 case for keywords. * test-suite/tests/types.test ("clonable objects"): Update now that keywords are cloneable.
2014-12-02Update (system base lalr) from upstream.Ludovic Courtès1-40/+59
Suggested by Jan Nieuwenhuizen <janneke@gnu.org>. * module/system/base/lalr.upstream.scm: Update from <https://github.com/schemeway/lalr-scm.git>, commit 4c4f149.
2014-11-19Recognize m68k, s390x, and sh4 as compilation targetsRob Browning1-3/+4
* module/system/base/target.scm (cpu-endianness, triplet-pointer-size): Add cases for "m68k", "sh4", and "s390x". Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-09-30Merge branch 'stable-2.0'Mark H Weaver1-2/+10
Conflicts: benchmark-suite/benchmarks/ports.bm libguile/async.h libguile/bytevectors.c libguile/foreign.c libguile/gsubr.c libguile/srfi-1.c libguile/vm-engine.h libguile/vm-i-scheme.c module/Makefile.am module/language/tree-il/analyze.scm module/language/tree-il/peval.scm module/scripts/compile.scm module/scripts/disassemble.scm test-suite/tests/asm-to-bytecode.test test-suite/tests/peval.test test-suite/tests/rdelim.test
2014-07-04Recognize more ARM targets.Ludovic Courtès1-2/+8
Suggested by Dale P. Smith. * module/system/base/target.scm (cpu-endianness): Add cases for "arm.*eb", "^aarch64.*be", and "aarch64". Change "arm" case to "arm.*". (triplet-pointer-size): Allow underscore as in 'aarch64_be'. * test-suite/tests/asm-to-bytecode.test ("cross-compilation")["armeb-unknown-linux-gnu", "aarch64-linux-gnu", "aarch64_be-linux-gnu"]: New tests.
2014-07-04Recognize arm-* target triplets.Ludovic Courtès1-1/+3
Reported by Sylvain Beucler <beuc@beuc.net>. * module/system/base/target.scm (cpu-endianness): Add case where CPU is "arm". * test-suite/tests/asm-to-bytecode.test ("cross-compilation")["arm-unknown-linux-androideabi"]: New test.
2014-04-25Merge branch 'stable-2.0'v2.1.0Mark H Weaver1-0/+529
Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c
2014-04-24Support weak vectors, arrays, and bitvectors in (system base types).Mark H Weaver1-0/+9
* module/system/base/types.scm (%tc7-wvect, %tc7-array, %tc7-bitvector): New variables. (cell->object): Add cases for weak vectors, arrays, and bitvectors.
2014-03-15Fix (system base types) on big-endian systems.Mark H Weaver1-1/+3
* module/system/base/types.scm (cell->object): When reading stringbufs, use UTF-32BE on big-endian systems.
2014-02-18Add (system base types).Ludovic Courtès1-0/+519
* module/system/base/types.scm, test-suite/tests/types.test: New files. * module/Makefile.am (SYSTEM_BASE_SOURCES): Add system/base/types.scm. * test-suite/Makefile.am (SCM_TESTS): Add tests/types.test.
2013-12-02Rename "RTL" to "bytecode"Andy Wingo1-2/+2
"RTL" didn't make any sense, and now that there's no other bytecode to disambiguate against, just call it bytecode. * module/Makefile.am: * module/ice-9/eval-string.scm: * module/language/bytecode.scm: * module/language/bytecode/spec.scm: * module/language/cps/arities.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/compile-rtl.scm: * module/language/cps/contification.scm: * module/language/cps/elide-values.scm: * module/language/cps/primitives.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/spec.scm: * module/language/cps/specialize-primcalls.scm: * module/language/rtl.scm: * module/language/rtl/spec.scm: * module/scripts/compile.scm: * module/system/base/compile.scm: * module/system/repl/common.scm: * module/system/vm/assembler.scm: * module/system/vm/debug.scm: * module/system/vm/disassembler.scm: * module/system/vm/dwarf.scm: * test-suite/tests/cross-compilation.test: * test-suite/tests/dwarf.test: * test-suite/tests/rtl-compilation.test: * test-suite/tests/rtl.test: * test-suite/vm/run-vm-tests.scm: Fixups.
2013-11-19Rename objcodes?.{scm,c,h} to loader.{scm,c,h}Andy Wingo1-2/+0
* libguile/loader.c: * libguile/loader.h: Rename from objcodes.[ch]. * module/system/vm/loader.scm: Rename from objcode.scm. * libguile/Makefile.am: * libguile/gsubr.c: * libguile/init.c: * libguile/procs.c: * libguile/vm.c: * module/Makefile.am: * module/ice-9/eval-string.scm: * module/language/rtl/spec.scm: * module/system/base/target.scm: * module/system/repl/command.scm: * module/system/repl/common.scm: * module/system/vm/debug.scm: * module/system/vm/disassembler.scm: * module/system/vm/objcode.scm: * test-suite/tests/compiler.test: * test-suite/tests/dwarf.test: * test-suite/tests/rtl-compilation.test: * test-suite/tests/rtl.test: Adapt.
2013-11-08Decompile goes from tree-il to scheme by default.Andy Wingo1-2/+2
* module/system/base/compile.scm (decompile): By default, go from tree-il to Scheme, now that the assembly language is going away.
2013-10-31Default to compiling to RTLAndy Wingo1-2/+2
* module/ice-9/eval-string.scm (eval-string) * module/language/tree-il/spec.scm (tree-il) * module/scripts/compile.scm (compile) * module/system/base/compile.scm (compile-file, read-and-compile) * module/system/repl/common.scm (repl-compile, repl-prepare-eval-thunk): Default to compiling to RTL. * module/language/rtl/spec.scm (rtl->value): Add value compiler.
2013-08-24compile-file adds #:to-disk? #t to optsAndy Wingo1-1/+2
* module/system/base/compile.scm (compile-file): Pass #:to-disk? as an option to indicate that the result will be being loaded from disk. Perhaps a linker might want to page-align in that case. * module/language/elisp/compile-tree-il.scm (process-options!): Accept and ignore the #:to-file compiler option.
2013-03-10use chmod portably in (system base compile)Jason Earl1-1/+3
* module/system/base/compile.scm (call-with-output-file/atomic): Call chmod with the file name instead of the port.
2013-02-28Fix handling of the *-gnux32 target.Ludovic Courtès1-1/+1
* module/system/base/target.scm (triplet-pointer-size): Fix typo in the x32 triplet name. * test-suite/tests/asm-to-bytecode.test (native-os): New procedure. (test-target): Use (native-word-size) only when both the CPU and OS match.
2013-02-27Recognize the `x86_64.*-gnux32' triplet.Ludovic Courtès1-0/+2
* module/system/base/target.scm (triplet-pointer-size): Add case for "^x64_64-.*-gnux32". * test-suite/tests/asm-to-bytecode.test ("cross-compilation"): ["x86_64-unknown-linux-gnux32"]: New test.
2013-02-27Check whether a triplet's OS part specifies an ABI.Ludovic Courtès1-16/+23
* module/system/base/target.scm (cpu-word-size): Rename to... (triplet-pointer-size): ... this. Update caller. Take a triplet as the argument. Check the `triplet-os' part when checking for equality with the host. Add support "mips64.*-gnuabi64". * test-suite/tests/asm-to-bytecode.test ("cross-compilation") [ "mips64el-unknown-linux-gnuabi64"]: New test.