summaryrefslogtreecommitdiff
path: root/libguile
AgeCommit message (Collapse)AuthorFilesLines
2013-11-19(system vm instruction) rtl-instruction-list -> (language rtl) instruction-listAndy Wingo2-25/+18
* libguile/instructions.c (struct scm_instruction, fetch_instruction_table) (scm_instruction_list): Remove rtl_ infix. * libguile/instructions.h: Adapt. * module/system/vm/instruction.scm: Remove. * module/language/rtl.scm: Export instruction-list from here. * module/Makefile.am: * module/language/cps/primitives.scm: * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm: * module/system/vm/frame.scm: * module/system/vm/program.scm: * module/system/vm/trace.scm: * module/system/vm/traps.scm: Adapt.
2013-11-19Internal RTL excision in vm.cAndy Wingo2-7/+7
* libguile/vm.c (vm_boot_continuation, vm_boot_continuation_code): Rename from rtl_boot_continuation[_code]. (scm_bootstrap_vm): * libguile/vm-engine.c (rtl_vm_engine): Adapt.
2013-11-19Small comment fix.Andy Wingo1-1/+1
* libguile/vm-builtins.h: Rename RTL to VM in a comment.
2013-11-19Rename DT_GUILE_VM_VERSION.Andy Wingo1-4/+4
* libguile/objcodes.c (DT_GUILE_VM_VERSION, process_dynamic_segment): * module/system/vm/elf.scm (DT_GUILE_VM_VERSION): Rename from DT_GUILE_RTL_VERSION. * module/system/vm/assembler.scm (link-dynamic-section): Adapt.
2013-11-19Rename internal rtl-program-properties -> program-propertiesAndy Wingo1-5/+5
* module/system/vm/program.scm (program-properties): Rename from rtl-program-properties. * libguile/programs.c (scm_i_program_properties): Adapt.
2013-11-19Excise "rtl-" from fallback program printerAndy Wingo1-1/+1
* libguile/programs.c (scm_i_program_print): Fallback printer uses "program", not "rtl-program".
2013-11-19Rename internals of (system vm program) program-minimum-arityAndy Wingo1-6/+5
* module/system/vm/debug.scm (find-program-minimum-arity): Rename from program-minimum-arity. * module/system/vm/program.scm (program-minimum-arity): Rename from rtl-program-minimum-arity. * libguile/programs.c (scm_i_program_arity): Adapt.
2013-11-19Rename (system vm program) internal functions to remove rtl-Andy Wingo1-11/+10
* module/system/vm/program.scm (program-name) (program-documentation): Rename (removing rtl-). * libguile/programs.c (scm_i_program_name): (scm_i_program_documentation): Adapt callers.
2013-11-19Remove unused C scm_program_source.Andy Wingo2-20/+0
* libguile/programs.c (scm_program_source): Remove; not called. (The definition is in Scheme.)
2013-11-19Reorganize programs.h.Andy Wingo1-19/+15
* libguile/programs.h: Reorganize.
2013-11-19rtl-program-code -> program-codeAndy Wingo2-3/+3
* libguile/programs.h: * libguile/programs.c (scm_program_code): Rename from scm_rtl_program_code. Also renames rtl-program-code to program-code. * module/statprof.scm: * module/system/repl/command.scm: * module/system/repl/debug.scm: * module/system/vm/coverage.scm: * module/system/vm/disassembler.scm: * module/system/vm/program.scm: * module/system/vm/traps.scm: * test-suite/tests/dwarf.test: * test-suite/tests/rtl.test: Adapt callers.
2013-11-19rtl-program? -> program?Andy Wingo2-3/+3
* libguile/programs.c (scm_program_p): Rename from scm_rtl_program_p. Changes name also from rtl-program? to program?. * libguile/programs.h: * module/ice-9/session.scm: * module/language/tree-il/analyze.scm: * module/statprof.scm: * module/system/repl/command.scm: * module/system/repl/debug.scm: * module/system/vm/coverage.scm: * module/system/vm/disassembler.scm: * module/system/vm/frame.scm: * module/system/vm/program.scm: * module/system/vm/traps.scm: * module/system/xref.scm: Adapt.
2013-11-19Remove make-rtl-program.Andy Wingo2-31/+0
* libguile/programs.h: * libguile/programs.c (scm_make_rtl_program): Remove. Unused. * module/system/vm/program.scm (system): Remove make-rtl-program export. Unused.
2013-11-19scm_i_rtl_program_* -> scm_i_program_*Andy Wingo5-14/+14
* libguile/programs.h (scm_i_make_program): * libguile/programs.c (scm_i_program_name): (scm_i_program_documentation): (scm_i_program_properties): Remove "rtl_" infix. * libguile/objcodes.c: * libguile/procprop.c: * libguile/vm.c: Adapt callers.
2013-11-19scm_i_make_rtl_program in BUILDING_LIBGUILEAndy Wingo1-0/+2
* libguile/programs.h (scm_i_make_rtl_program): Enclose in a BUILDING_LIBGUILE guard.
2013-11-19Remove RTL_ infix from macrosAndy Wingo13-63/+63
* libguile/programs.h (SCM_PROGRAM_P): (SCM_PROGRAM_CODE): (SCM_PROGRAM_FREE_VARIABLES): (SCM_PROGRAM_FREE_VARIABLE_REF): (SCM_PROGRAM_FREE_VARIABLE_SET): (SCM_PROGRAM_NUM_FREE_VARIABLES): (SCM_VALIDATE_PROGRAM): Remove RTL_ infix. * libguile/continuations.c: * libguile/continuations.h: * libguile/control.c: * libguile/foreign.c: * libguile/frames.c: * libguile/gsubr.c: * libguile/gsubr.h: * libguile/procprop.c: * libguile/procs.c: * libguile/programs.c: * libguile/stacks.c: * libguile/vm-engine.c: Adapt.
2013-11-19Rename scm_tc7_rtl_program to scm_tc7_programAndy Wingo11-12/+12
* libguile/tags.h (scm_tc7_program): Rename from scm_tc7_rtl_program. * libguile/continuations.c: * libguile/control.c: * libguile/evalext.c: * libguile/foreign.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/print.c: * libguile/programs.c: * libguile/programs.h: * libguile/vm-engine.c: Adapt users. * module/system/vm/assembler.scm: Rename a tc7-rtl-program local to tc7-program. * libguile/tags.h (scm_tc7_program): Rename from scm_tc7_rtl_program. * libguile/continuations.c: * libguile/control.c: * libguile/evalext.c: * libguile/foreign.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/print.c: * libguile/programs.c: * libguile/programs.h: * libguile/vm-engine.c: Adapt users. * module/system/vm/assembler.scm: Rename a tc7-rtl-program local to tc7-program.
2013-11-19All instruction pointers are now scm_t_uint32*Andy Wingo8-28/+22
* libguile/frames.h (SCM_FRAME_RTL_RETURN_ADDRESS) (SCM_FRAME_SET_RTL_RETURN_ADDRESS): Remove. The variants without _RTL now work fine. (struct scm_vm_frame): Change the return address to be a scm_t_uint32*. (struct scm_frame): Change IP to be scm_t_uint32*. * libguile/frames.c (scm_c_make_frame) * libguile/control.c (reify_partial_continuation, scm_c_abort) * libguile/dynstack.c (PROMPT_IP) (scm_dynstack_push_prompt, scm_dynstack_find_prompt) * libguile/dynstack.h: * libguile/vm-engine.c (SYNC_IP, RETURN_ONE_VALUE) (call, return-values, prompt): Adapt.
2013-11-17Frame pointer points to local 0 instead of local 1Andy Wingo5-123/+162
* libguile/frames.h: Change so that fp points at local 0 instead of local 1, and clean up a bit. (struct scm_vm_frame): Remove program, and rename stack to locals. (SCM_FRAME_DATA_ADDRESS): Remove; it was redundant with SCM_FRAME_LOWER_ADDRESS. (SCM_FRAME_STACK_ADDRESS): Remove; replace with the new SCM_FRAME_LOCALS_ADDRESS. (SCM_FRAME_UPPER_ADDRESS): Remove; unused. (SCM_FRAME_NUM_LOCALS, SCM_FRAME_PREVIOUS_SP): New defines. (SCM_FRAME_BYTE_CAST, SCM_FRAME_STACK_CAST): Remove; unused; (SCM_FRAME_LOCAL): New define, replaces SCM_FRAME_VARIABLE. (SCM_FRAME_PROGRAM): Add cautionary commentary. * libguile/frames.c: Adapt static asserts. (scm_frame_num_locals, scm_frame_local_ref, scm_frame_local_set_x): Adapt. This means that frame-local-ref 0 now returns the procedure. * libguile/vm-engine.c (ALLOC_FRAME, RESET_FRAME) (FRAME_LOCALS_COUNT, LOCAL_REF, LOCAL_SET, RETURN_VALUE_LIST): Adapt to change in fp. (LOCAL_ADDRESS): New helper. (POP_CONTINUATION_HOOK): Reimplement, taking the previous FP as an argument. (ABORT_CONTINUATION_HOOK): Reimplement, taking no arguments. (RETURN_ONE_VALUE): Reimplement. (RETURN_VALUE_LIST): Adapt to FP change. (halt, return-values, subr-call, foreign-call, prompt) (continuation-call, compose-continuation, call/cc, abort): Adapt to FP change, mostly via using LOCAL_ADDRESS, etc abstractions instead of using the raw frame pointer. * libguile/control.c (reify_partial_continuation): Update for fp change. * libguile/vm.c (vm_reinstate_partial_continuation): Adapt to removal of SCM_FRAME_UPPER_ADDRESS. * module/system/vm/frame.scm (frame-call-representation): Adapt to frame-local-ref change. * module/system/vm/trace.scm (print-return): Remove unused frame-num-locals call.
2013-11-15Remove use of SCM_CRITICAL_SECTION in smob.cAndy Wingo1-2/+2
* libguile/smob.c (scm_make_smob_type): Use a mutex instead of a critical section, which does an async tick. Not important, just a thing I saw.
2013-11-15Remove MVRA from VM framesAndy Wingo5-96/+43
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump for frame layout change. * libguile/frames.c: Update some static checks. (scm_frame_num_locals, scm_frame_local_ref, scm_frame_local_set_x): Update to not skip over uninitialized frames, as that's not a thing any more. * libguile/frames.h: Update to remove MVRA. Woo! * libguile/vm-engine.c (ALLOC_FRAME, RETURN_ONE_VALUE): (rtl_vm_engine): Update for 3 words per frame instead of 4. * libguile/vm.c (vm_return_to_continuation): Likewise. * module/language/cps/slot-allocation.scm (allocate-slots): 3 words per frame, not 4. * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. Also remove a couple of tc7's that aren't around any more.
2013-11-15Remove MVRA accessors in libguileAndy Wingo6-42/+11
* libguile/vm.c (scm_i_vm_capture_stack): Remove MVRA argument, in preparation for removing MVRA from frames. (scm_i_capture_current_stack): Adapt to scm_i_vm_capture_stack change. (vm_reinstate_partial_continuation): Remove references to MVRA. * libguile/vm.h (struct scm_vm_cont): Remove mvra member. * libguile/vm-engine.c (call): Set MVRA to 0. Will remove later. (return-values): Return to RA. (call/cc): Remove MVRA from capture call. * libguile/frames.c: * libguile/frames.h (SCM_FRAME_MV_RETURN_ADDRESS) (SCM_FRAME_RTL_MV_RETURN_ADDRESS, scm_frame_mv_return_address): Remove accessors. * libguile/control.c (reify_partial_continuation): Adapt to scm_i_vm_capture_stack change.
2013-11-13i18n: Fix null pointer dereference when locale info is missing.Ludovic Courtès1-1/+3
* libguile/i18n.c (scm_nl_langinfo): Check whether C_RESULT is NULL before calling 'strdup'.
2013-11-10Add specialize-primcalls pass; bump objcode version.Andy Wingo3-100/+70
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/objcodes.c (process_dynamic_segment): Expect the minor version to be present and, while we are still banging on the VM, exactly equal to SCM_OBJCODE_MINOR_VERSION. * libguile/vm-engine.c: Renumber ops. Remove the general make-vector. Rename constant-FOO to FOO/immediate. Remove struct-ref and struct-set!, replace with struct-ref/immediate and struct-set!/immediate. * module/Makefile.am: * module/language/cps/specialize-primcalls.scm: New pass, inlines FOO to FOO/immediate -- e.g. vector-ref to vector-ref/immediate. * module/language/cps/arities.scm: Remove struct-set! case, now that there is no struct-set! opcode. * module/language/cps/compile-rtl.scm (compile-fun): Remove dispatch to constant-FOO versus FOO here -- that decision is made by specialize-primcalls. (optimize): Add specialize-primcalls pass. * module/language/cps/dfg.scm (constant-needs-allocation?): Adapt to name changes. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*primitive-constructors*): Add allocate-struct. * module/system/vm/assembler.scm (*bytecode-major-version*): (*bytecode-minor-version*, link-dynamic-section): Write minor version into resulting image.
2013-11-08Remove stack programs, objcode, and the old VM.Andy Wingo24-4246/+32
* libguile/Makefile.am: * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Remove the old VM files, and the rules to build the .i files. * libguile/vm-engine.c: * libguile/vm.c: Remove the old VM. Woot! * libguile/_scm.h (SCM_OBJCODE_COOKIE, SCM_OBJCODE_ENDIANNESS_OFFSET) (SCM_OBJCODE_WORD_SIZE_OFFSET): Remove. * libguile/evalext.c (scm_self_evaluating_p): Remove objcode and program cases. * libguile/frames.c (scm_frame_num_locals, scm_frame_previous): Remove program cases. * libguile/gc.c (scm_i_tag_name): Remove objcode case. * libguile/goops.c (scm_class_of, create_standard_classes): Remove objcode and program cases. * libguile/instructions.h: * libguile/instructions.c (scm_instruction_list, scm_instruction_p) (scm_instruction_length, scm_instruction_pops, scm_instruction_pushes) (scm_instruction_to_opcode, scm_opcode_to_instruction): Remove old VM code. * libguile/objcodes.h: * libguile/objcodes.c: Remove the objcode data type, and handling for objcode files. * libguile/print.c: Remove objcode and program printers. * libguile/procprop.c: Remove program cases. * libguile/procs.c: * libguile/programs.h: * libguile/programs.c: Remove old program code. * libguile/smob.c: Remove objcodes include. * libguile/snarf.h: Remove static program defines. * libguile/stacks.c: Remove program case. * libguile/tags.h: Remove program and objcode tc7s. * module/ice-9/session.scm (procedure-arguments) * module/language/tree-il/analyze.scm (validate-arity) * module/statprof.scm (get-call-data, procedure=?) * module/system/vm/frame.scm (frame-bindings) (frame-call-representation): Remove old program cases. * module/system/repl/debug.scm (frame->module): Add a FIXME. * module/system/vm/instruction.scm: Remove old exports. * module/system/vm/program.scm: Remove old program code.
2013-11-08Builtins have procedure propertiesAndy Wingo4-24/+40
* libguile/vm-builtins.h (FOR_EACH_VM_BUILTIN): Add arity information. (enum scm_vm_builtins): * libguile/vm.c (scm_vm_builtin_ref): (scm_vm_builtin_name_to_index): (scm_vm_builtin_index_to_name): Adapt to macro interface change. (scm_init_vm_builtin_properties): New helper, sets procedure properties on builtins. (scm_bootstrap_vm): Just define the builtins here. Later in the bootstrap we set their properties. (scm_sym_apply): Move definition here from expand.c. * libguile/procprop.c (scm_init_procprop): Call scm_init_vm_builtin_properties.
2013-11-08Add br-if-npos-gtAndy Wingo1-102/+137
* libguile/vm-engine.c (br-if-npos-gt): New instruction (sigh!). For case-lambda* dispatching on the number of positional args, as the manual describes. Renumber other opcodes.
2013-11-08Fix BR_NARGS data type widthAndy Wingo1-1/+1
* libguile/vm-engine.c (BR_NARGS): Fix width of "expected". Fixes bug with > 65536 arguments in case-lambda clauses.
2013-11-08Fix reading and writing arities into DWARF.Andy Wingo3-4/+4
* libguile/gsubr.h: * libguile/gsubr.c (scm_i_primitive_call_ip): * libguile/programs.c (scm_primitive_call_ip): Adapt to return an absolute address. * module/system/vm/assembler.scm (write-arity-headers): Adapt to write byte addresses (relative to the text base). * module/system/vm/debug.scm (arity-low-pc, arity-high-pc): Return absolute addresses, instead of word offsets relative to the text base. (find-first-arity): Adapt for absolute addresses. * module/system/vm/program.scm (program-arguments-alist): Adapt for arity-low-pc / arity-high-pc absolute addresses.
2013-11-07frame-instruction-pointer is absolute; rewrite (system vm coverage)Andy Wingo3-24/+20
* libguile/frames.c (scm_frame_source): Instead of assuming that scm_frame_procedure is correct, use the IP to get the source. (scm_frame_instruction_pointer): Return an absolute value instead of assuming that slot 0 is correct. (It isn't, when preparing for a tail call.) * libguile/programs.h: * libguile/programs.c (scm_find_source_for_addr): New internal helper. * module/system/repl/debug.scm (print-registers): Readably print absolute instruction pointers. * module/system/vm/coverage.scm: Complete rewrite to use absolute IP's. We can't assume that frame-procedure is cheap if it is correct, or correct if it is cheap. Anyway using the address is better anyway. (coverage-data->lcov): Disable per-function info temporarily. (loaded-modules, module-procedures, closest-source-line) (closed-over-procedures): Remove these. Instead of going from procedures to source info, now we go from ELF image to source info. * module/system/vm/debug.scm (debug-context-length): New interface. * module/system/vm/program.scm (source-for-addr): New internal helper.
2013-11-07scm_from_uintptr_t / scm_from_ptrdiff_t usageAndy Wingo2-13/+11
* libguile/frames.c: * libguile/programs.c: Use scm_from_ptrdiff_t and scm_from_uintptr_t where appropriate.
2013-11-07add fold-all-debug-contexts, fold-source-locationsAndy Wingo1-0/+23
* module/system/vm/objcode.scm: * libguile/objcodes.c (scm_all_mapped_elf_images): New proc. * module/system/vm/debug.scm (fold-all-debug-contexts): (fold-source-locations): New public interfaces.
2013-11-05fix make-long-immediate, make-long-long-immediate for dst >= 256Andy Wingo1-2/+2
* libguile/vm-engine.c (make-long-immediate, make-long-long-immediate): Fix declaration of "dst" variable.
2013-11-04Don't use the identifier 'noreturn'.Mark H Weaver3-3/+3
Fixes <http://bugs.gnu.org/15798>. Reported by Matt Sicker <boards@gmail.com>. * libguile/__scm.h (SCM_NORETURN): Use ((__noreturn__)) instead of ((noreturn)). * libguile/throw.h (scm_ithrow): Rename formal parameter from 'noreturn' to 'no_return'. * libguile/throw.c (scm_ithrow): Rename formal parameter from 'noreturn' to 'no_return'.
2013-11-03RTL compiler supports static bitvectorsAndy Wingo3-9/+11
* libguile/arrays.c (scm_from_contiguous_typed_array): * libguile/bytevectors.c (scm_uniform_array_to_bytevector): For bitvectors, round up the length to 32-bit units, as they are stored internally. Otherwise I think this probably does the wrong thing for the last word on big-endian systems. * libguile/bitvectors.c (BITVECTOR_LENGTH, BITVECTOR_BITS): (scm_c_make_bitvector): Reorder the length and pointer words to match the layout of bytevectors. * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/system/vm/assembler.scm (br-if-bitvector): * module/system/vm/disassembler.scm (code-annotation): Add bitvector test support. * module/system/vm/assembler.scm (<uniform-vector-backing-store>): Add an element-size field. (intern-constant): Adapt make-uniform-vector-backing-store call. Use uniform-array->bytevector, as the old compiler did. (link-data): Add bitvector cases.
2013-11-01Fix call/cc with the RTL VMAndy Wingo1-19/+19
* libguile/vm.c (vm_return_to_continuation): The RTL VM saves the registers for the caller of call/cc, but the caller will expect values in the normal MV return location: above the frame. Make it so, number four!
2013-10-31Be smarter about capturing the environment for memoized codeAndy Wingo3-36/+61
* libguile/memoize.h (SCM_M_CAPTURE_MODULE) * libguile/memoize.c (MAKMEMO_CAPTURE_MODULE, capture_env): (maybe_makmemo_capture_module, memoize): Determine when to capture the module on the environment chain at compile-time, instead of at runtime. Introduces a new memoized expression type, capture-module. (scm_memoized_expression): Start memoizing with #f as the environment. (unmemoize): Add unmemoizer. (scm_memoize_variable_access_x): Cope with #f as module, and treat as the root module (captured before modules were booted). * libguile/eval.c (eval): * module/ice-9/eval.scm (primitive-eval): Adapt.
2013-10-31Avoid calling procedure-name when doing a make-procedure-with-setterAndy Wingo2-13/+4
* libguile/procs.c (scm_make_procedure_with_setter): Don't set the name of the procedure. Instead rely on procedure-name to look it up from the wrapped procedure as needed. * libguile/procprop.c (scm_procedure_name): If there was no override and the procedure is a procedure-with-setter, recurse on the procedure.
2013-10-31Better aliased primcall compilationAndy Wingo1-2/+2
* libguile/vm-engine.c (define!): Rename from define. * module/language/cps/arities.scm (fix-clause-arities): If a prim aliases an RTL instruction with a different name and we reify a primcall, reify the instruction name. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Update emit-define! for new name. * module/language/cps/primitives.scm (*rtl-instruction-aliases*): Add bytevector native accessors.
2013-10-31Fix bytevector error messages.Andy Wingo1-3/+3
* libguile/vm-engine.c (BV_FIXABLE_INT_SET, BV_INT_SET): (BV_FLOAT_SET): Fix instruction names in error messages.
2013-10-31Support serialization of uniform vector literalsAndy Wingo2-1/+21
* libguile/uniform.h: * libguile/uniform.c (scm_uniform_vector_element_type_code): New interface, returns a type code as an integer. * module/system/vm/assembler.scm (<uniform-vector-backing-store>) (simple-vector?, uniform-array?, statically-allocatable?) (intern-constant, link-data, link-constants): Support uniform arrays, and punt on vectors aren't contiguous from 0. Support for general arrays will come later. * test-suite/tests/rtl.test ("load-constant"): Add tests.
2013-10-31static-patch! replaces link-procedure!Andy Wingo1-13/+16
* libguile/vm-engine.c (static-patch!): Replace link-procedure! with this more versatile primitive. * module/system/vm/assembler.scm (intern-constant): Emit static-patch! for static procedures and for strings. * module/system/vm/disassembler.scm (code-annotation): Remove annotation for link-procedure!. There can be no annotation for static-patch!, as neither operand is guaranteed to be a SCM value.
2013-10-27Walk the stack to determine extent of partial continuationAndy Wingo1-6/+13
* libguile/control.c (reify_partial_continuation): Walk the stack to determine the bottom of the captured stack.
2013-10-27Resumable partial continuations in the RTL VMAndy Wingo2-2/+9
* libguile/vm-engine.c (receive-values): Bugfix for the case where we want an exact number of values. (abort): Advance the IP before capturing. The captured SP is fp - 1, not fp. * libguile/vm.c (vm_reinstate_partial_continuation): Don't push on a number-of-values marker.
2013-10-27VM has "builtins": primitives addressable by emitted RTL codeAndy Wingo7-185/+362
* libguile/Makefile.am: * libguile/vm-builtins.h: New header, declaring stubs needed by the compiler like values, apply, and abort-to-prompt. * libguile/vm.c: Adapt the apply and values stubs to conform to a standard interface. Add an abort-to-prompt stub. Add call/cc and call-with-values stubs. (scm_vm_builtin_ref): New helper, for the builtin-ref opcode. (scm_vm_builtin_name_to_index) (scm_vm_builtin_index_to_name): New helpers, for the compiler and disassembler, respectively. (scm_init_vm_builtins, scm_bootstrap_vm): Allow the compiler helpers to be loaded later into a module. * module/language/rtl.scm: Export builtin-index->name and builtin-name->index. * libguile/vm-engine.c (RETURN_VALUE_LIST): Update to use new names of "apply" and "values". (tail-call/shuffle): New opcode. (abort): Update to be a tail VM op, and reorder and renumber other ops. (builtin-ref): New opcode. * libguile/continuations.h: * libguile/continuations.c (scm_i_call_with_current_continuation): Move this to vm.[ch], implemented as a builtin. * module/language/tree-il/compile-cps.scm (convert): Convert to 'abort-to-prompt calls, possibly with 'apply, effectively undoing the tree-il transformation. * module/language/cps/reify-primitives.scm (builtin-ref): New helper. (reify-primitives): Convert builtin primitives to builtin-ref. * module/language/cps/dfg.scm (constant-needs-allocation?): * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add support for compiling builtin-ref. * module/system/vm/disassembler.scm (code-annotation): Add annotation for builtin-ref.
2013-10-27Partial continuations are RTL stubsAndy Wingo4-70/+24
* libguile/control.c: Implement partial continuations as RTL programs. * libguile/programs.c (scm_i_rtl_program_minimum_arity): Add partial continuation case. * libguile/vm-engine.c (compose-continuation): Fix to look for vm_cont from the free variables. * libguile/vm-i-system.c (abort): Poison continuations captured in the stack VM, as the can't be rewound by the RTL stubs.
2013-10-27Fix toplevel-ref with named modules before boot in stack VMAndy Wingo1-1/+11
* libguile/vm.c (resolve_variable): Fix, as in e23f9e4423bbbe8521d13e1c9a223612a5e86762.
2013-10-27Memoized expressions are pairs, not SMOBsAndy Wingo4-67/+9
* libguile/memoize.c (MAKMEMO): Memoized objects are pairs now, not SMOBs. This lets eval.scm destructure them more efficiently. (scm_print_memoized, scm_memoized_p, scm_memoized_expression_typecode) (scm_memoized_expression_data): Remove these interfaces. (unmemoize, scm_memoize_variable_access_x): Remove SMOB type checks. (scm_init_memoize): Remove SMOB type definition. * libguile/memoize.h (scm_tc16_memoized, SCM_MEMOIZED_P) (scm_memoized_expression_typecode, scm_memoized_expression_data) (scm_memoized_p): Remove declarations. * libguile/validate.h (SCM_VALIDATE_MEMOIZED): Remove declaration. * libguile/eval.c (eval): Remove memoized type check, and inline the inum unpacking. * module/ice-9/eval.scm (memoized-expression-case): Use car and cdr to destructure memoized expressions. A big win!
2013-10-26Add make-vector, constant-make-vector instructionsAndy Wingo1-34/+72
* libguile/vm-engine.c (rtl_vm_engine): Add make-vector and constant-make-vector instructions and renumber. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Emit constant-make-vector and make-vector as appropriate. * module/language/cps/dfg.scm (constant-needs-allocation?): In some cases, make-vector doesn't need to allocate its index. * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *primitive-constructors*): Add make-vector.
2013-10-26Emit constant-vector-ref, constant-vector-set! for known small indicesAndy Wingo1-29/+54
* libguile/vm-engine.c (rtl_vm_engine): Add constant-vector-set! instruction and renumber. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Emit constant-vector-ref and constant-vector-set! as appropriate. * module/language/cps/dfg.scm (constant-needs-allocation?): In some cases, vector-ref and vector-set! don't need to allocate their index.