summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* procedure-properties for RTL functionswip-rtl-metadataAndy Wingo2013-05-277-9/+180
| | | | | | | | | | | | | | | | | | * module/system/vm/assembler.scm (link-procprops, link-objects): Arrange to write procedure property links out to a separate section. * libguile/procprop.c (scm_procedure_properties): * libguile/programs.h: * libguile/programs.c (scm_i_rtl_program_properties): * module/system/vm/debug.scm (find-program-properties): Wire up procedure-properties for RTL procedures. Yeah! Fistpumps! :) * module/system/vm/debug.scm (find-program-debug-info): Return #f if the string is "", as it is if we don't have a name. Perhaps elf-symbol-name should return #f in that case... (find-program-docstring): Bugfix: increment by docstr-len. * test-suite/tests/rtl.test: Add some tests.
* procedure-documentation works on RTL proceduresAndy Wingo2013-05-279-20/+100
| | | | | | | | | | | | | | | * libguile/procprop.h: * libguile/procprop.c (scm_procedure_documentation): Move here from procs.c, and to make the logic more similar to that of procedure-name, which allows RTL programs to dispatch to rtl-program-documentation. * libguile/programs.c (scm_i_rtl_program_documentation): * libguile/programs.h: * module/system/vm/program.scm (rtl-program-documentation): New plumbing. * module/system/vm/debug.scm (find-program-docstring): New interface to grovel ELF for a docstring.
* Write docstrings into RTL ELF imagesAndy Wingo2013-05-271-1/+57
| | | | | * module/system/vm/assembler.scm (link-docstrs): Write docstrings. (link-objects): Link docstrings into the ELF.
* Wire up ability to print RTL program aritiesAndy Wingo2013-05-275-33/+99
| | | | | | | | | | | | | | | | | | | | | | | * libguile/procprop.c (scm_i_procedure_arity): Allow RTL programs to dispatch to scm_i_program_arity. * libguile/programs.c (scm_i_program_print): Refactor reference to write-program. (scm_i_rtl_program_minimum_arity): New procedure, dispatches to Scheme. (scm_i_program_arity): Dispatch to scm_i_rtl_program_minimum_arity if appropriate. * module/system/vm/debug.scm (program-minimum-arity): New export. * module/system/vm/program.scm (rtl-program-minimum-arity): New internal function. (program-arguments-alists): New helper, implemented also for RTL procedures. (write-program): Refactor a bit, and call program-arguments-alists. * test-suite/tests/rtl.test ("simply procedure arity"): Add tests that arities make it all the way to cold ELF and back to warm Guile.
* (system vm debug) can read arity informationAndy Wingo2013-05-272-2/+177
| | | | | | | | | | | | | * module/system/vm/assembler.scm (write-arity-headers): Fill in the prefix. * module/system/vm/debug.scm (<arity>): New object, for reading arities. Unlike <arity> in the assembler, this one only holds on to a couple of pointers, and doesn't even load in argument names. Unlike the arity lists in (system vm program), it can load in names. Very early days but it does seem to work. (find-program-arities, arity-arguments-alist): New higher-level interfaces.
* RTL assembler writes arities information into separate section.Andy Wingo2013-05-271-1/+200
| | | | | * module/system/vm/assembler.scm: Write arities into a .guile.arities section and associated .guile.arities.strtab.
* Beginnings of tracking of procedure arities in assemblerAndy Wingo2013-05-272-24/+95
| | | | | | | | | | * module/system/vm/assembler.scm (<meta>, <arity>): Assembler now tracks arities of a function. (begin-standard-arity, begin-opt-arity, begin-kw-arity, end-arity): New macro-assemblers. * test-suite/tests/rtl.test: Adapt all tests to use begin-standard-arity and end-arity.
* add procedure prelude macro-instructionsAndy Wingo2013-05-272-20/+68
| | | | | | | * module/system/vm/assembler.scm (pack-flags): New helper. (standard-prelude, opt-prelude, kw-prelude): New macro-instructions. * test-suite/tests/rtl.test: Update tests to use standard-prelude.
* begin-program takes properties alistAndy Wingo2013-05-272-27/+62
| | | | | | | | | | | | | * module/system/vm/assembler.scm (check): New helper macro to check argument types. (<meta>): Add properties field. Rename name field to "label" to indicate that it should be unique. (make-meta, meta-name): New helpers. (begin-program): Take additional properties argument. (emit-init-constants): Adapt to begin-program change. (link-symtab): Allow for anonymous procedures. * test-suite/tests/rtl.test: Adapt tests.
* Add RTL disassemblerwip-rtl-assemblerAndy Wingo2013-05-273-4/+356
| | | | | | | * module/Makefile.am: * module/system/vm/disassembler.scm: New module. * module/system/repl/command.scm (disassemble): Work with RTL programs.
* RTL programs print with their nameAndy Wingo2013-05-276-17/+60
| | | | | | | | | | | | | | | | | | | | * libguile/print.c (iprin1): Use scm_i_program_print for RTL programs too. * libguile/procprop.c (scm_procedure_name): For RTL programs, call scm_i_rtl_program_name if there is no override. * libguile/programs.h: * libguile/programs.c (scm_i_rtl_program_name): New helper, dispatches to (system vm program). (scm_i_program_print): For RTL programs, the fallback prints the code pointer too. * module/system/vm/program.scm (rtl-program-name): Use the debug info to get an RTL program name. (write-program): Work with RTL programs too. * test-suite/tests/rtl.test ("procedure name"): Add test.
* move procedure-name and procedure-source to procprop.cAndy Wingo2013-05-274-45/+49
| | | | | | * libguile/procprop.h: * libguile/procprop.c (scm_procedure_name, scm_procedure_source): Move these functions here, from debug.[ch].
* Add runtime support for reading debug information from ELFAndy Wingo2013-05-274-3/+180
| | | | | | | | | | * module/Makefile.am: * module/system/vm/debug.scm: New module. * module/system/vm/elf.scm (elf-section-by-name): New helper. (elf-symbol-table-len): New helper. * test-suite/tests/rtl.test: Add test for finding debug info.
* Add RTL assemblerAndy Wingo2013-05-275-1/+1165
| | | | | | | | | | | | | | | * module/Makefile.am: * module/system/vm/assembler.scm: New module, implementing an assembler for RTL. * test-suite/Makefile.am: * test-suite/tests/rtl.test: New test suite. * module/system/vm/elf.scm (make-elf-symbol*): Add constructor; export as make-elf-symbol. (elf-symbol-len): New export. (write-elf32-symbol, write-elf64-symbol): New helpers. (write-elf-symbol): New export.
* add new rtl vmAndy Wingo2013-05-2719-27/+3624
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/vm-engine.c (rtl_vm_engine): Add new VM. (vm_engine): Add support for calling RTL programs. * libguile/tags.h (scm_tc7_rtl_program): New type for procedures that run on the new VM. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): * libguile/print.c (iprin1): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p): Add hooks for the new tc7. * libguile/programs.h: * libguile/programs.c (scm_make_rtl_program, scm_i_rtl_program_print) (scm_rtl_program_p, scm_rtl_program_code): * module/system/vm/program.scm: Add constructors and accessors for the new "RTL programs". * libguile/vm.c (rtl_boot_continuation): Define a boot program. (rtl_apply, rtl_values): New static RTL programs. * libguile/frames.c (scm_frame_num_locals): Adapt for frames of RTL programs. * libguile/frames.h: Add description of RTL frames. * libguile/Makefile.am: Add rules to generate vm-operations.h. * .gitignore: Ignore vm-operations.h. * module/system/vm/instruction.scm: * libguile/instructions.c: * libguile/instructions.h: Use vm-operations.h to define enumerated values for the new RTL opcodes. Define some helper macros to pack and unpack 32-bit instruction words. (rtl-instruction-list): New function, exported by (system vm instruction). * libguile/objcodes.c: Wire up the bits needed to detect the new RTL bytecode and load it, as appropriate.
* refactor to resolve_variableAndy Wingo2013-05-271-16/+13
| | | | * libguile/vm.c (resolve_variable): Slight refactor.
* cpp hygiene in the vmAndy Wingo2013-05-273-6/+47
| | | | | | | * libguile/vm-engine.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: CPP hygiene: the code that #defines, #undefs. Makes things cleaner given the multiple inclusion dance we do.
* pop-continuation abort-continuation hooks pass return vals directlyAndy Wingo2013-05-278-112/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | * doc/ref/api-debug.texi (VM Hooks): Update documentation. * libguile/vm.c (vm_dispatch_hook): * libguile/vm-engine.c: Rework the hook machinery so that they can receive an arbitrary number of arguments. The return and abort hooks will pass the values that they return to their continuations. (vm_engine): Adapt to ABORT_CONTINUATION_HOOK change. * libguile/vm-i-system.c (return, return/values): Adapt to POP_CONTINUATION_HOOK change. * module/system/vm/frame.scm (frame-return-values): Remove. The pop-continuation-hook will pass the values directly. * module/system/vm/trace.scm (print-return): (trace-calls-to-procedure): (trace-calls-in-procedure): Update to receive return values directly. * module/system/vm/traps.scm (trap-in-procedure) (trap-in-dynamic-extent): Ignore return values. (trap-frame-finish, trap-calls-in-dynamic-extent) (trap-calls-to-procedure): Pass return values to the handlers.
* Allow vm_engine caller to pass arguments on the stack.Andy Wingo2013-05-271-4/+13
| | | | | * libguile/vm-engine.c (vm_engine): Allow the caller to pass arguments on the stack.
* vm-engine: remove register assignmentsAndy Wingo2013-05-271-61/+12
| | | | | | | | | | * libguile/vm-engine.c: Remove the register assignments inherited from the 1990s. GCC does seem to allocate reasonably on systems with enough registers (e.g. x86-64), and on system with too few (ia32) we disabled manual allocation. Anyway this code was never tested, so it's better to leave the compiler to do its own thing, until proven otherwise. Also in the RTL VM we don't need to allocate a register to the SP, because it isn't accessed as much.
* remove some configurability in vm-engineAndy Wingo2013-05-232-67/+3
| | | | | | | | | * libguile/vm-engine.c: Remove the ability for the VM to check object access, free variable access, and the ip. They were off by default. Since they will be different in the RTL VM, their presence is just making things confusing. * libguile/vm.c: Remove corresponding error helpers.
* minor vm-engine cleanupsAndy Wingo2013-05-231-25/+18
| | | | | * libguile/vm-engine.c: Some very minor cleanups: indenting, use of VM_ASSERT, commenting.
* remove CONS macro in VM; use scm_cons insteadAndy Wingo2013-05-233-42/+8
| | | | | | | | | | * libguile/vm-engine.c (CONS): Remove. Callers should use scm_cons instead, syncing registers beforehand. (POP_LIST): Adapt, only synchronizing once. (POP_LIST_MARK, POP_CONS_MARK): Remove unused macros. * libguile/vm-i-scheme.c (cons): * libguile/vm-i-system.c (push-rest, bind-rest): Adapt.
* inline vm-engine.h into vm-engine.cAndy Wingo2013-05-233-405/+377
| | | | | | | * libguile/vm-engine.h: * libguile/vm-engine.c: Fold vm-engine.h into vm-engine.c. * libguile/Makefile.am: Adapt.
* add (find-mapped-elf-image) procedure to (system vm objcode) moduleAndy Wingo2013-05-232-2/+111
| | | | | | | | * libguile/objcodes.c (register_elf, scm_find_mapped_elf_image): New interfaces that keep a list of all ELF mappings. Exported from the (system vm objcode) module. * module/system/vm/objcode.scm: Export find-mapped-elf-image.
* refactor and simplify ELF loader in objcodes.cAndy Wingo2013-05-231-240/+196
| | | | | | | | | | | | | | * libguile/objcodes.c (sniff_elf_alignment, alloc_aligned) (copy_and_align_elf_data): New helpers for portably re-aligning ELF data from read(2) or from a bytevector. (load_thunk_from_memory): Simplify! Now there is only one procedure that loads ELF, and it does less: it simply receives the whole image in one array, hopefully from mmap. (scm_load_thunk_from_file): Use new map_file_contents helper, and go through load_thunk_from_memory. (scm_load_thunk_from_memory): Pass load_thunk_from_memory a piece of memory that it owns, and that is appropriately aligned.
* add scm_{to,from}_{u,}intptr_tAndy Wingo2013-05-232-13/+31
| | | | | | | | * libguile/numbers.h (scm_to_intptr_t, scm_from_intptr_t) (scm_to_uintptr_t, scm_from_uintptr_t): New defines. * libguile/foreign.c: Remove definitions here; adapt callers to use new names with _t suffixes.
* refactor linker to lay out ELF files and memory in the same wayAndy Wingo2013-05-232-170/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/system/vm/linker.scm (make-linker-object): (linker-object-section-symbol): (linker-object-symbols*): Create a symbol to the start of a linker object. Hide it from the external linker-object-symbols* accessor. (segment-kind, count-segments): Sections without SHF_ALLOC don't get segments. (collate-objects-into-segments): Allow for #f segment types. If two sections have the same type and flags, leave them in the same order. (align): Allow for 0 alignment. (add-elf-objects): New helper: puts the ELF data structures (header, segment table, and section table) in sections of their own. This lends a nice clarity and conceptual unity to the linker. (relocate-section-header, allocate-segment): Lay out segments with congruent, contiguous addresses, so that we can just mmap the file and if debugging sections that are not in segments are present, they can be lazily paged in if needed by the kernel's VM system. (link-elf): Refactor to use the new interfaces. * test-suite/tests/linker.test: Update to expect the additional sections for the header and section table.
* elf: add accessors for header members that might need relocationAndy Wingo2013-05-231-2/+22
| | | | | | * module/system/vm/elf.scm (elf-header-shoff-offset) (elf-section-header-addr-offset, elf-section-header-offset-offset): New accessors.
* ELF refactor and consequent linker simplificationsAndy Wingo2013-05-234-245/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | * module/system/vm/elf.scm: Add commentary. (make-elf): Add a constructor similar to make-elf-segment and make-elf-section. (write-elf32-header, write-elf64-header, write-elf-header): Take an <elf> instead of all the fields separately. (<elf-segment>, <elf-section>): Add "index" property. Adapt constructors accordingly. * module/language/objcode/elf.scm (bytecode->elf): Arrange to set the section indexes when creating ELF sections. * module/system/vm/linker.scm (fold-values): New helper. (alloc-segment, relocate-section-header): Arrange to set segment and section indexes. (find-shstrndx): New helper, replaces compute-sections-by-name. Now that sections know their indexes, this is easier. (allocate-elf, write-elf): New helpers, factored out of link-elf. Easier now that sections have indexes. (link-elf): Simplify. Check that the incoming objects have sensible numbers. * test-suite/tests/linker.test: Update to set #:index on the linker objects.
* split linker out of elf moduleAndy Wingo2013-05-235-383/+562
| | | | | | | | | | | | | | | * module/Makefile.am: * module/system/vm/linker.scm: New file, split out of (system vm elf). (make-string-table, string-table-intern): Export under their bare names, instead of make-elf-string-table and elf-string-table-intern. * module/system/vm/elf.scm: Remove linking capabilities. (string-table-ref): Export. * module/language/objcode/elf.scm (bytecode->elf): Adapt to use (system vm linker). * test-suite/tests/linker.test: New test.
* Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-04-1467-1105/+3076
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: GUILE-VERSION libguile/array-map.c libguile/fports.h libguile/gc.h libguile/inline.h libguile/ports.c libguile/ports.h libguile/print.c libguile/r6rs-ports.c libguile/read.c test-suite/tests/00-socket.test
| * Using 'pass-if-equal' in coding.test.Mark H Weaver2013-04-141-56/+56
| | | | | | | | | | * test-suite/tests/coding.test ("block comments", "line comments"): Use 'pass-if-equal'.
| * Adjust BOM tests to reflect the fact that big endian is used by default.Mark H Weaver2013-04-141-12/+2
| | | | | | | | | | | | | | | | * test-suite/tests/ports.test ("BOM not discarded unless at start of UTF-16 stream", "BOM not discarded unless at start of UTF-32 stream"): Adjust tests to reflect the fact that, in the absence of a BOM, big endian will be used by default for the "UTF-16" and "UTF-32" encodings.
| * Add 2012 and 2013 to copyright notice on numbers.test.Mark H Weaver2013-04-101-1/+2
| | | | | | | | | | * test-suite/tests/numbers.test: Add 2012 and 2013 to copyright notice. It was modified both of those years.
| * Do not add $(EXEEXT) to guild or guile-tools.Mark H Weaver2013-04-101-2/+2
| | | | | | | | | | * meta/Makefile.am (install-exec-hook): Do not add $(EXEEXT) to guild or guile-tools.
| * Mention `open-file' in NEWS.v2.0.9Ludovic Courtès2013-04-101-3/+3
| |
| * doc: Require libunistring 0.9.3 in `README'.Ludovic Courtès2013-04-101-1/+1
| | | | | | | | | | * README: Require libunistring 0.9.3. The <unitypes.h> header in 0.9.1 lacks the _UC_ATTRIBUTE_CONST definition, leading to build failures.
| * build: Tell `gen-scmconfig' whether the system has `struct timespec'.Ludovic Courtès2013-04-102-1/+24
| | | | | | | | | | | | | | | | * configure.ac: Reinstate `struct timespec' check removed in commit 7e7c6f6a937005b08fffd5aeccdf992459b07137, but define `HAVE_SYSTEM_STRUCT_TIMESPEC' instead of `HAVE_STRUCT_TIMESPEC'. * libguile/gen-scmconfig.c (main): Change `HAVE_STRUCT_TIMESPEC' to `HAVE_SYSTEM_STRUCT_TIMESPEC'.
| * Bump version number for 2.0.9.Ludovic Courtès2013-04-102-2/+5
| | | | | | | | * GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
| * doc: Update `release.org'.Ludovic Courtès2013-04-101-8/+7
| | | | | | | | | | * doc/release.org: Recommend "distcheck". Add `makeinfo' to the bootstrap tool list.
| * stime: Remove #ifdef HAVE_*_H for headers provided by Gnulib.Ludovic Courtès2013-04-101-10/+2
| | | | | | | | | | | | | | * libguile/stime.c: Remove #ifdef HAVE_SYS_TIMES_H, HAVE_SYS_TYPES_H, and HAVE_STRING_H since those headers are always provided by Gnulib when the corresponding macro is undefined. Fixes a regression on MinGW introduced by commit 40e2a31.
| * Make `build-aux/gendocs.sh' executable.Ludovic Courtès2013-04-101-0/+0
| |
| * Bump version number for 2.0.8.Ludovic Courtès2013-04-091-3/+3
| | | | | | | | | | | | | | * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C functions `scm_c_bind_keyword_arguments' et al. (LIBGUILE_INTERFACE_AGE): Increment.
| * tests: Skip FFI tests involving `scm_is_pair' when `dynamic-func' fails.Ludovic Courtès2013-04-091-4/+6
| | | | | | | | | | | | | | * test-suite/tests/foreign.test ("make-pointer")["equal? modulo finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Wrap `dynamic-func' in `false-if-exception' (static builds on NetBSD 5.1 raise "Symbol not found" here.)
| * doc: Cosmetic change for `release.org'.Ludovic Courtès2013-04-091-1/+1
| | | | | | | | * doc/release.org: Add #+STARTUP.
| * Update `THANKS'.Ludovic Courtès2013-04-091-0/+2
| |
| * update NEWSAndy Wingo2013-04-091-22/+14
| | | | | | | | * NEWS: Updates.
| * fix stime patch for HAVE_TIMES removalAndy Wingo2013-04-091-3/+14
| | | | | | | | | | | | * libguile/stime.c (scm_init_stime): Fix previous patch. At this point in the source, we definitely have a run-time function, but don't necessarily have a real-time function.
| * simplify configure checks for functionality provided by gnulibAndy Wingo2013-04-092-27/+4
| | | | | | | | | | | | | | * configure.ac: Remove checks for pipe, stftime, times, and select, as our Gnulib modules already ensure they are provided. * libguile/stime.c: Rely on gnulib providing `times'.