summaryrefslogtreecommitdiff
path: root/libguile/programs.c
Commit message (Expand)AuthorAgeFilesLines
* Parse bytecode to determine minimum arity...* libguile/programs.c (try_parse_arity): New helper, to parse bytecode to determine the minimum arity of a function in a cheaper way than grovelling through the debug info. Should speed up all thunk? checks and similar. (scm_i_program_arity): Simplify. * libguile/gsubr.h: * libguile/gsubr.c (scm_i_primitive_arity): * libguile/foreign.h: * libguile/foreign.c (scm_i_foreign_arity): Andy Wingo2016-06-241-13/+58
* Remove scm_puts_unlocked....* libguile/ports.h (scm_puts_unlocked): Remove. * libguile/ports.c (scm_puts): Replace implementation with scm_puts_unlocked's implementation. * libguile/arbiters.c: * libguile/backtrace.c: * libguile/bitvectors.c: * libguile/continuations.c: * libguile/deprecation.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/guardians.c: * libguile/hashtab.c: * libguile/hooks.c: * libguile/load.c: * libguile/macros.c: * libguile/mallocs.c: * libguile/print.c: * libguile/programs.c: * libguile/promises.c: * libguile/smob.c: * libguile/srcprop.c: * libguile/srfi-14.c: * libguile/stackchk.c: * libguile/struct.c: * libguile/threads.c: * libguile/throw.c: * libguile/values.c: * libguile/variable.c: * libguile/vm.c: * libguile/weak-set.c: * libguile/weak-table.c: Use scm_puts instead of scm_puts_unlocked. Andy Wingo2016-04-261-3/+3
* Remove scm_putc_unlocked....* libguile/ports.h (scm_putc_unlocked): Remove. * libguile/ports.c (scm_putc): Replace implementation with scm_putc_unlocked's implementation. (scm_port_print): Use scm_putc. * libguile/arbiters.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/hashtab.c: * libguile/hooks.c: * libguile/macros.c: * libguile/mallocs.c: * libguile/print.c: * libguile/programs.c: * libguile/promises.c: * libguile/r6rs-ports.c: * libguile/smob.c: * libguile/srcprop.c: * libguile/struct.c: * libguile/variable.c: * libguile/weak-set.c: * libguile/weak-table.c: Use scm_putc instead of scm_putc_unlocked. Andy Wingo2016-04-261-4/+4
* Remove primitive?, add primitive-code?...We need to be able to identify frames that are primitive applications without assuming that slot 0 in a frame is an SCM value and without assuming that value is the procedure being applied. * libguile/gsubr.c (scm_i_primitive_code_p): New helper. (scm_i_primitive_arity): Use the new helper. * libguile/gsubr.h: Declare the new helper. * libguile/programs.h: * libguile/programs.c (scm_program_code_p): New function, replacing scm_primitive_p. (scm_primitive_call_ip): Fix FUNC_NAME definition. * module/statprof.scm (sample-stack-procs, count-call): Identify primitive frames from the IP, not the frame-procedure. Avoids the assumption that slot 0 in a frame is a SCM value. (statprof-proc-call-data): Adapt to primitive-code? change. * module/system/vm/frame.scm (frame-call-representation): Identify primitive frames from the IP, not the closure. Still more work to do here to avoid assuming slot 0 is a procedure. * module/system/vm/program.scm: Export primitive-code? instead of primitive?. (program-arguments-alist, program-arguments-alists): Identify primitives from the code instead of the flags on the program. Not sure this is a great change, but it does avoid having to define a primitive? predicate in Scheme. Andy Wingo2015-12-011-5/+7
* Fix inner and outer stack cuts to match on procedure code...* doc/ref/api-debug.texi (Stack Capture): Update make-stack docs. * libguile/programs.h: * libguile/programs.c (scm_program_address_range): New internal procedure. * libguile/stacks.c (narrow_stack): Interpret a pair of integers as an address range. If a cut is a procedure, attempt to resolve it to an address range. (scm_make_stack): Update docstring. * module/system/vm/program.scm (program-address-range): New exported procedure. * module/statprof.scm (statprof, gcprof): Use program-address-range to get the outer-cut, for efficiency. Andy Wingo2014-05-011-1/+13
* Rename internal rtl-program-properties -> program-properties...* module/system/vm/program.scm (program-properties): Rename from rtl-program-properties. * libguile/programs.c (scm_i_program_properties): Adapt. Andy Wingo2013-11-191-5/+5
* Excise "rtl-" from fallback program printer...* libguile/programs.c (scm_i_program_print): Fallback printer uses "program", not "rtl-program". Andy Wingo2013-11-191-1/+1
* Rename internals of (system vm program) program-minimum-arity...* 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. Andy Wingo2013-11-191-6/+5
* Rename (system vm program) internal functions to remove rtl-...* 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. Andy Wingo2013-11-191-11/+10
* Remove unused C scm_program_source....* libguile/programs.c (scm_program_source): Remove; not called. (The definition is in Scheme.) Andy Wingo2013-11-191-19/+0
* rtl-program-code -> program-code...* 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. Andy Wingo2013-11-191-2/+2
* rtl-program? -> program?...* 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. Andy Wingo2013-11-191-2/+2
* Remove make-rtl-program....* libguile/programs.h: * libguile/programs.c (scm_make_rtl_program): Remove. Unused. * module/system/vm/program.scm (system): Remove make-rtl-program export. Unused. Andy Wingo2013-11-191-30/+0
* scm_i_rtl_program_* -> scm_i_program_*...* 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. Andy Wingo2013-11-191-4/+4
* Remove RTL_ infix from macros...* 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. Andy Wingo2013-11-191-12/+12
* Rename scm_tc7_rtl_program to scm_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. * 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. Andy Wingo2013-11-191-1/+1
* Remove stack programs, objcode, and the old VM....* 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. Andy Wingo2013-11-081-308/+15
* Fix reading and writing arities into DWARF....* 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. Andy Wingo2013-11-081-1/+1
* frame-instruction-pointer is absolute; rewrite (system vm coverage)...* 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. Andy Wingo2013-11-071-0/+16
* scm_from_uintptr_t / scm_from_ptrdiff_t usage...* libguile/frames.c: * libguile/programs.c: Use scm_from_ptrdiff_t and scm_from_uintptr_t where appropriate. Andy Wingo2013-11-071-2/+1
* Partial continuations are RTL stubs...* 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. Andy Wingo2013-10-271-1/+2
* Continuations are RTL stubs...* libguile/continuations.h: * libguile/continuations.c: Reimplement continuations and the call_cc stub as RTL programs. * libguile/programs.c (scm_i_rtl_program_minimum_arity): Add a case for continuations. * libguile/vm-engine.c (rtl_vm_debug_engine): Always call the abort continuation hook with the number of non-procedure locals. Fix compose-continuation argument count. Enable call/cc. Andy Wingo2013-10-181-0/+7
* Foreign procedures are RTL programs...* libguile/foreign.c: Convert to using RTL stubs. Because RTL code has different GC characteristics than objcode -- it's mostly assumed that RTL code will never go away -- we go ahead and pre-generate code for 100 arguments. This is actually less memory than the stack VM code, and doesn't require any relocations at load-time: bonus! We'll cross the >=100 args bridge if we ever come to it. (get_foreign_stub_code) New function. (scm_i_foreign_arity): New helper, like scm_i_primitive_arity. (cif_to_procedure): Rework to make RTL programs. * libguile/foreign.h: Declare scm_pointer_to_scm and scm_scm_to_pointer. Declare new internal helpers. * libguile/gsubr.c (create_subr): Refactor to set the flags when the object is allocated. * libguile/instructions.h: Define SCM_PACK_RTL_12_12. * libguile/programs.c (scm_i_rtl_program_minimum_arity): Dispatch to scm_i_foreign_arity if the procedure has the FOREIGN flag. * libguile/programs.h (SCM_F_PROGRAM_IS_FOREIGN) (SCM_PROGRAM_IS_FOREIGN): New interfaces. * test-suite/tests/foreign.test ("procedure->pointer"): Add a test for foreign arities. Andy Wingo2013-10-181-0/+3
* Subrs are RTL programs...* libguile/gsubr.c: Define RTL stubs instead of stack VM stubs. (SUBR_STUB_CODE, get_subr_stub_code): Adapt to return a uint32_t* pointer instead of a SCM value. (create_subr): Create RTL procedures instead of stack VM procedures. For RTL procedures, the function pointer, name, and generic address pointer go inline to the procedure, as free variables. (scm_i_primitive_arity, scm_i_primitive_call_ip): New helpers. (scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic) (scm_c_define_gsubr_with_generic): Adapt to create_gsubr being renamed to create_subr. Remove gsubr test code. * libguile/gsubr.h (SCM_PRIMITIVE_P, SCM_PRIMITIVE_GENERIC_P): Only RTL programs can be primitives now. (SCM_SUBRF, SCM_SUBR_NAME, SCM_SUBR_GENERIC): These fields are now in the RTL free variables, not the object table. * libguile/programs.c (scm_i_rtl_program_name): (scm_i_rtl_program_documentation): (scm_i_rtl_program_properties): (scm_i_rtl_program_minimum_arity): Implement these appropriately for primitives, which lack debugging information. (scm_primitive_p, scm_primitive_call_ip): New helpers. * libguile/snarf.h: Remove static allocation for subrs. Since there is nothing to allocate besides the program itself, which needs runtime relocation, static allocation is not a win. * system/vm/program.scm: Fix up various arity-related things for primitives, which don't use ELF arity info. * test-suite/tests/eval.test ("stack involving a primitive"): Add an XFAIL until we get just one VM. Andy Wingo2013-10-181-0/+37
* program-source / program-sources works with RTL programs...* libguile/programs.c (scm_program_sources): Define as %program-sources, and let Scheme export the program-sources proper. (scm_program_source): Call out to Scheme. * module/system/vm/program.scm: Convert to use match instead of pmatch. Adapt existing callers. (program-sources, program-source): New Scheme implementations of these functions. (program-sources-pre-retire): Add RTL program case. Andy Wingo2013-10-031-22/+14
* Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/deprecated.h libguile/programs.c libguile/programs.h Andy Wingo2013-10-031-6/+0
|\
| * Deprecate scm_c_program_source, as it has no internal users....* libguile/programs.c: * libguile/programs.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_c_program_source): Deprecate. Andy Wingo2013-10-031-7/+1
* | free variable debugging access procedures for rtl...* libguile/programs.c (scm_program_num_free_variables) (scm_program_free_variable_ref, scm_program_free_variable_set_x): Add support for RTL programs. Andy Wingo2013-07-211-0/+21
* | fix rtl program arity functions...* libguile/programs.c (parse_arity): Lookup rtl-program-minimum-arity from (system vm debug). * module/system/vm/debug.scm (find-first-arity): Fix the linear search. Whoops! Andy Wingo2013-07-211-1/+1
* | procedure-properties for RTL functions...* 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... * test-suite/tests/rtl.test: Add some tests. Andy Wingo2013-06-091-0/+12
* | procedure-documentation works on RTL procedures...* 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. Andy Wingo2013-06-091-0/+13
* | Wire up ability to print RTL program arities...* 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. Andy Wingo2013-06-091-3/+27
* | RTL programs print with their name...* 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. Andy Wingo2013-06-091-10/+23
* | add new rtl vm...* 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. Andy Wingo2013-05-311-1/+62
* | locking for putc, puts...* libguile/ports.c (scm_putc, scm_puts): * libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into _unlocked and locked variants. Change all callers to use the _unlocked versions. Andy Wingo2011-11-081-6/+6
|/
* use scm_from_latin1_symboln for string literals and load-symbol...* libguile/bytevectors.c: * libguile/eval.c: * libguile/goops.c: * libguile/i18n.c: * libguile/load.c: * libguile/memoize.c: * libguile/modules.c: * libguile/ports.c: * libguile/print.c: * libguile/procs.c: * libguile/programs.c: * libguile/read.c: * libguile/script.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/strings.c: * libguile/throw.c: * libguile/vm.c: Use scm_from_latin1_symboln to make symbols from string literals, because they aren't in the user's locale -- they are in ASCII, and we can optimize this case. * libguile/vm-i-loader.c: Also use scm_from_latin1_symboln when loading narrow symbols. Andy Wingo2011-01-071-2/+2
* fix a number of assumptions that a pointer could fit into a long...* libguile/debug.c: * libguile/eval.c: * libguile/frames.c: * libguile/objcodes.c: * libguile/print.c: * libguile/programs.c: * libguile/read.c: * libguile/struct.c: * libguile/vm.c: Fix a number of instances in which we assumed we could fit a pointer into a long. Andy Wingo2010-11-191-1/+1
* add program-sources-pre-retire to core and define frame-next-source...* libguile/programs.h: * libguile/programs.c (scm_program_source): Add an optional arg, the sources table to traverse. Defaults to the result of scm_program_sources. * module/system/vm/program.scm (program-sources-pre-retire): Move definition here from (system vm traps), and export. * module/system/vm/traps.scm: Adapt. * module/system/vm/frame.scm (frame-next-source): New exported binding, returns the source line corresponding to the next instruction instead of the previous instruction. Andy Wingo2010-10-081-12/+21
* fix to program-module...* libguile/programs.c (scm_program_module): Fix an edge case in which this function returned non-modules. Thanks to José Antonio Ortega Ruiz, Caballero del Cálculo Lambda for the report. Andy Wingo2010-09-061-2/+9
* add procedure_minimum_arity...* libguile/procprop.h: * libguile/procprop.c (scm_procedure_minimum_arity): New public function, will replace (procedure-property foo 'arity). * libguile/programs.c (scm_i_program_arity): Rework to always provide the most permissive arity. Andy Wingo2010-04-171-17/+35
* remove program-name, program-documentation...* libguile/programs.h: * libguile/programs.c (scm_program_name): Remove. procedure-name is sufficient. * module/system/vm/program.scm (program-name): Remove from exports list. (program-documentation): Remove; procedure-documentation is sufficient. * libguile/debug.c (scm_procedure_name): Remove special case for programs. * module/language/tree-il/analyze.scm (validate-arity): Use procedure-name. * module/ice-9/documentation.scm (object-documentation): Just use procedure-documentation, without special cases for programs. Andy Wingo2010-04-171-10/+0
* scm_i_program_properties is internal; just use procedure-properties...* libguile/programs.h: * libguile/programs.c (scm_i_program_properties): Make internal. (scm_program_name): Use scm_i_program_properties. * libguile/procprop.c (scm_procedure_properties): Use scm_i_program_properties, for programs. * libguile/procs.c (scm_procedure_documentation): Use procedure-property to get to 'documentation, not program-property. * module/system/vm/program.scm (program-properties, program-property): Remove from the exports list. (program-documentation): Use procedure-property. * module/texinfo/reflection.scm (macro-arguments) (macro-additional-stexi) (object-stexi-documentation): Use procedure-property, not program-property. Andy Wingo2010-04-171-5/+4
* rename libguile to libguile-@EFFECTIVE_VERSION@, currently libguile-2.0...* libguile/Makefile.am (lib_LTLIBRARIES): Instead of just "libguile.la", make "libguile-@EFFECTIVE_VERSION@.la". This allows multiple versions of Guile to be installed at once. See http://www106.pair.com/rhp/parallel.html for a rationale. (libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS): (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Fixup automake vars to include the effective version. (guile_LDADD): Fix up the spelling of libguile. * libguile/bytevectors.c (scm_bootstrap_bytevectors): * libguile/foreign.c (scm_register_foreign): * libguile/i18n.c (scm_bootstrap_i18n): * libguile/instructions.c (scm_bootstrap_instructions): * libguile/objcodes.c (scm_bootstrap_objcodes): * libguile/programs.c (scm_bootstrap_programs): * libguile/vm.c (scm_bootstrap_vm): Register extensions using e.g. "libguile-2.0" as the libname -- i.e., including the effective version in the libname. * module/ice-9/i18n.scm: * module/rnrs/bytevector.scm: * module/rnrs/io/ports.scm: * module/system/foreign.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: When doing a load-extension for something in Guile, use the effective version also. * meta/guile-2.0-uninstalled.pc.in (Libs): * meta/guile-2.0.pc.in (Libs): Use -lguile-@EFFECTIVE_VERSION@. This change should mean that code built against Guile should not be affected by the libguile rename. * guile-readline/Makefile.am (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): * srfi/Makefile.am (libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LIBADD): (libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LIBADD): (libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LIBADD): (libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LIBADD): * test-suite/standalone/Makefile.am (test_num2integral_LDADD): (test_round_LDADD): (libtest_asmobs_la_LIBADD): (libtest_ffi_la_LIBADD): (test_list_LDADD): (test_unwind_LDADD): (test_conversion_LDADD): (test_loose_ends_LDADD): (test_scm_c_read_LDADD): (test_scm_take_locale_symbol_LDADD): (test_scm_take_u8vector_LDADD): (libtest_extensions_la_LIBADD): (test_with_guile_module_LDADD): (test_scm_with_guile_LDADD): Fix up the spelling of libguile.la. Andy Wingo2010-03-161-1/+2
* fix continuation printing bug...* libguile/programs.c (scm_i_program_print): Fix bug printing continuations. Andy Wingo2010-03-091-1/+1
* partial continuations print as #<partial-continuation ...>...* libguile/control.c (reify_partial_continuation): * libguile/programs.c (scm_i_program_print): * libguile/programs.h (SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION) (SCM_PROGRAM_IS_PARTIAL_CONTINUATION): Distinguish partial continuations from full continuations. Andy Wingo2010-03-041-0/+7
* tweaks to default program printer...* libguile/programs.c (scm_i_program_print): Instead of printing the address of the objcode, print the address of the program itself. Also for continuations. Andy Wingo2010-02-221-2/+2
* continuations are vm procedures...* libguile/vm-i-system.c (continuation-call): New op, like subr-call or foreign-call, but for continuations. * libguile/continuations.h: Add scm_i_continuation_call internal declaration. (SCM_CONTINUATIONP): Reimplement in terms of SCM_PROGRAM_IS_CONTINUATION. (scm_tc16_continuation, SCM_CONTREGS, SCM_CONTINUATION_LENGTH) (SCM_SET_CONTINUATION_LENGTH, SCM_JMPBUF, SCM_DYNENV, SCM_THROW_VALUE) (SCM_CONTINUATION_ROOT, SCM_DFRAME): Remove these from the exposed API. (scm_i_continuation_to_frame): New internal declaration. * libguile/continuations.c * libguile/continuations.c: Add trickery like in foreign.c, smob.c, and gsubr.c, so that we can make procedural trampolines for continuations. (scm_i_continuation_to_frame): New internal function, from stacks.c. * libguile/programs.h (SCM_F_PROGRAM_IS_CONTINUATION) (SCM_PROGRAM_IS_CONTINUATION): Add a flag for programs that are continuations. Probably should add flags for the other trampoline types too. * libguile/programs.c (scm_i_program_print): Print continuations as before. * libguile/stacks.c (scm_stack_id, scm_make_stack): Use scm_i_continuation_to_frame in the continuation case. Andy Wingo2010-02-081-1/+8
* allocate free variables inline to closures...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/programs.h (SCM_PROGRAM_FREE_VARIABLES) (SCM_PROGRAM_FREE_VARIABLE_REF, SCM_PROGRAM_FREE_VARIABLE_SET) (SCM_PROGRAM_NUM_FREE_VARIABLES): * libguile/programs.c (scm_make_program, scm_program_num_free_variables) (scm_program_free_variable_ref, scm_program_free_variable_set_x): Allocate free variables inline with programs, instead of being in a vect. Should improve locality, and require fewer local variables in the VM. * libguile/vm-engine.c (vm_engine): Remove free_vars and free_vars_count variables. * libguile/vm-engine.h (CACHE_PROGRAM): No need to muck with free_vars and free_vars_count. (CHECK_FREE_VARIABLE): Update for inline free vars. * libguile/vm-i-system.c (FREE_VARIABLE_REF): Update for inline free vars. (make-closure, fix-closure): Take the closure vals as separate stack args, and copy or fix them inline into the appropriate closure. * module/language/objcode/spec.scm (program-free-variables): Define a local version of this removed function. * module/language/tree-il/compile-glil.scm (flatten): Adjust to not make a vector when making closures. * module/system/vm/program.scm: Export program-num-free-variables, program-free-variable-ref, program-free-variable-set!, and remove program-free-variables. * test-suite/tests/tree-il.test ("lambda"): Update to not make vectors when making closures. Andy Wingo2010-01-091-9/+55
* properly integrate vm bootstrapping into init.c...* libguile/Makefile.am (modinclude_HEADERS): * libguile/vm-bootstrap.h: Remove vm-bootstrap.h. * libguile/frames.c: No more vm-bootstrap.h. * libguile/instructions.c (scm_init_instructions): * libguile/objcodes.c (scm_init_objcodes): * libguile/programs.c (scm_init_programs): No need to call scm_bootstrap_vm, init.c does that for us. * libguile/vm.c (scm_bootstrap_vm): No need call e.g. scm_bootstrap_frames, init.c does that. Remove a twice-calling guard, should be unnecessary. Don't define the load-compiled subr here. * libguile/load.c (scm_init_load): Define the load-compiled subr here. * libguile/vm.h: Declare scm_bootstrap_vm here. * libguile/init.c (scm_i_init_guile): Properly integrate VM bootstrapping into this file. Andy Wingo2010-01-071-3/+0
* program-meta procedures get their program's objtable...* libguile/programs.c (scm_program_meta): Give the program meta procedure the same object table as the main procedure. Will allow for easier hand-crafting of meta programs. Of course when compiling a metadata procedure from Scheme, one still wants to avoid preallocating the heap objects needed by the metadata... Andy Wingo2010-01-071-2/+3