summaryrefslogtreecommitdiff
path: root/libguile/_scm.h
Commit message (Expand)AuthorAgeFilesLines
* Use atomics for async interrupts...* libguile/__scm.h (SCM_TICK): Always define as scm_async_tick(). * libguile/error.c (scm_syserror, scm_syserror_msg): * libguile/fports.c (fport_read, fport_write): * libguile/_scm.h (SCM_SYSCALL): Replace SCM_ASYNC_TICK with scm_async_tick (). (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE) (SCM_ASYNC_TICK_WITH_GUARD_CODE): Remove internal definitions. We inline into vm-engine.c, the only place where it matters. * libguile/async.h: * libguile/async.c (scm_async_tick, scm_i_setup_sleep): (scm_i_reset_sleep, scm_system_async_mark_for_thread): * libguile/threads.h (struct scm_thread_wake_data): * libguile/threads.h (scm_i_thread): * libguile/threads.c (block_self, guilify_self_1, scm_std_select): Rewrite to use sequentially-consistent atomic references. * libguile/atomics-internal.h (scm_atomic_set_pointer): (scm_atomic_ref_pointer): New definitions. * libguile/finalizers.c (queue_finalizer_async): We can allocate, so just use scm_system_async_mark_for_thread instead of the set-cdr! shenanigans. * libguile/scmsigs.c (take_signal): * libguile/gc.c (queue_after_gc_hook): Adapt to new asyncs mechanism. Can't allocate but we're just manipulating the current thread when no other threads are running so we should be good. * libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Inline the async_tick business. Andy Wingo2016-10-261-22/+2
* `define!' instruction returns the variable...* doc/ref/vm.texi (Top-Level Environment Instructions): Update documentation. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, sadly. * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. * libguile/vm-engine.c (define!): Change to store variable in dst slot. * module/language/tree-il/compile-cps.scm (convert): * module/language/cps/compile-bytecode.scm (compile-function): Adapt to define! change. * module/language/cps/effects-analysis.scm (current-module): Fix define! effects. Incidentally here was the bug: in Guile 2.2 you can't have effects on different object kinds in one instruction, without reverting to &unknown-memory-kinds. * test-suite/tests/compiler.test ("regression tests"): Add a test. Andy Wingo2016-06-211-1/+1
* Bump objcode version...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump for Guile 2.1.3. Andy Wingo2016-05-161-1/+1
* Bump bytecode version...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump bytecode version to prevent 2.1.1 users from thinking that they don't need to make clean after pulling. Andy Wingo2015-11-111-1/+1
* Add make-vector opcode...* libguile/vm-engine.c (make-vector): New opcode. * module/language/cps/compile-bytecode.scm (compile-fun): * module/system/vm/assembler.scm (system): Support the new opcode. (*bytecode-minor-version*): Bump. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * test-suite/tests/compiler.test ("limits"): Add vector test. Andy Wingo2014-04-211-1/+1
* Bump minor objcode version for recent changes...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. Andy Wingo2014-04-151-1/+1
* Add VM and compiler support for calls to known procedures...* module/language/cps.scm ($callk): New expression type, for calls to known labels. Part of "low CPS". * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/verify.scm: Adapt call sites. * libguile/vm-engine.c (call-label, tail-call-label): New instructions. Renumber the rest; this is an ABI change. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. * doc/ref/compiler.texi (CPS in Guile): Document $callk. Andy Wingo2014-02-021-2/+2
* VM copes with moving FP...* libguile/_scm.h (SCM_ASYNC_TICK_WITH_GUARD_CODE): New macro. * libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Restore FP after ticking. (CACHE_FP): New macro. (CHECK_OVERFLOW): Use CACHE_FP. (BR_ARITHMETIC, RETURN_EXP, RETURN_ONE_VALUE, BINARY_INTEGER_OP): (call, return-values, subr-call, foreign-call) (resolve, define!, toplevel-box, module-box): Restore the FP from the vp where needed. Andy Wingo2013-11-221-10/+8
* Remove MVRA from VM frames...* 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. Andy Wingo2013-11-151-1/+1
* Add specialize-primcalls pass; bump objcode version....* 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. Andy Wingo2013-11-101-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-7/+0
* Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-07-181-25/+25
|\
| * Fix 'SCM_SYSCALL' to really swallow EINTR....* libguile/_scm.h (SCM_SYSCALL): Keep looping upon EINTR. Reported at <http://lists.gnu.org/archive/html/guile-devel/2013-06/msg00050.html>. Ludovic Courtès2013-07-171-25/+25
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/vm-engine.c libguile/vm-i-system.c Andy Wingo2012-04-301-0/+8
|\|
| * add internal SCM_NOINLINE definition...* libguile/_scm.h (SCM_NOINLINE): New internal define, for things that we definitely don't want the compiler to inline. Andy Wingo2012-04-301-0/+5
* | Merge branch 'bt/elisp'...Conflicts: am/guilec libguile/_scm.h libguile/vm-i-scheme.c module/language/elisp/compile-tree-il.scm module/language/elisp/runtime.scm module/language/elisp/runtime/macros.scm module/language/tree-il/compile-glil.scm module/language/tree-il/primitives.scm BT Templeton2012-03-051-1/+1
|\ \
| * | add `nil?' primitive...* libguile/boolean.c (scm_nil_p): New function. * libguile/vm-i-scheme.c (nilp, not_nilp): * libguile/vm-i-system.c (br_if_nil, br_if_not_nil): New instructions. Renumber other ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Increment. * module/language/assembly/compile-bytecode.scm (compile-bytecode): Add support for writing `br-if-nil' and `br-if-not-nil' instructions. * module/language/assembly/disassemble.scm (code-annotation): Add `br-if-nil' and `br-if-not-nil' to the list of branch instructions. * module/language/tree-il/compile-glil.scm: Add `nil?' to `*primcall-ops*'. (flatten): Use the new branch instructions for `nil?' conditionals. * module/language/tree-il/primitives.scm: Add `nil?' to `*interesting-primitive-names*', `*effect-free-primitives', and `*effect+exception-free-primitives*'. BT Templeton2012-02-031-1/+1
| |/
* | add string-length, string-ref, vector-length instructions...* libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump the major version, indicating the first incompatibility between 2.0 and 2.2. * libguile/vm-i-scheme.c (string-length, string-ref, vector-length): New instructions. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add primcall ops for the new instructions. Andy Wingo2011-10-281-1/+1
* | Merge remote-tracking branch 'local-2.0/stable-2.0'...Conflicts: meta/Makefile.am Andy Wingo2011-06-021-0/+3
|\|
| * write-objcode uses target-endianness, target-word-size...* libguile/_scm.h (SCM_OBJCODE_ENDIANNESS_OFFSET): (SCM_OBJCODE_WORD_SIZE_OFFSET): New defines. * libguile/objcodes.c (scm_write_objcode): Use target-endianness and target-word-size when writing the objcode cookie. Andy Wingo2011-05-311-0/+3
* | rename scm_async_click() to scm_async_tick(); privatize SCM_ASYNC_TICK...* libguile/_scm.h (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE): Make these definitions private. Call the tick() function instead of click(). * libguile/__scm.h: * libguile/async.h (scm_async_tick): Move declaration here. Remove scm_async_click declaration. Tick is the new (and old!) click, you see. (SCM_CRITICAL_SECTION_END): Call tick() instead of click(). * libguile/async.c (scm_async_tick): Remove old definition, and rename scm_async_click to scm_async_tick. (decrease_block): Adapt to click() -> tick() name change. * libguile/deprecated.h (scm_async_click, SCM_ASYNC_TICK): Define some GONE macros. * libguile/threads.c (fat_mutex_unlock): Tick() instead of click(). Andy Wingo2011-05-151-0/+21
* | make SCM_I_SETJMP and SCM_I_LONGJMP private...* libguile/_scm.h (SCM_I_SETJMP, SCM_I_LONGJMP): Move to this private header. * libguile/__scm.h (scm_i_jmp_buf): Only define the scm_i_jmp_buf type in this public header. Andy Wingo2011-05-151-0/+35
|/
* bump objcode version to 2.0; introduce minor-version compatibility...* libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump to 2. (SCM_OBJCODE_MINOR_VERSION): Reset to 0. (SCM_OBJCODE_MACHINE_VERSION_STRING, SCM_OBJCODE_COOKIE): Reorder so the minor version is the last byte. * libguile/objcodes.c (make_objcode_by_mmap): Accept objcodes whose minor version is less than SCM_OBJCODE_MINOR_VERSION, not just equal to. Andy Wingo2011-02-131-5/+5
* ASYNC_TICK after catching EINTR in SCM_SYSCALL...* libguile/_scm.h (SCM_SYSCALL): As in scm_syserror, do a SCM_ASYNC_TICK before resuming the syscall after an EINTR. Andy Wingo2010-12-031-3/+26
* bump objcode version...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the process-define-module deprecation means that outside compiled code won't find process-define-module in the (guile) module, as they would before. Andy Wingo2010-11-191-1/+1
* _scm GUILE_USE_64_CALLS compilation warning fix...* libguile/_scm.h: Check that GUILE_USE_64_CALLS is defined. Fixes an error on i386-apple-darwin9.8.0. Andy Wingo2010-10-181-1/+1
* inline symbol? and vector? to opcodes, and a psyntax inlining tweak...* libguile/vm-i-scheme.c (symbol?, vector?): New instructions. Renumbered the rest. * libguile/vm-i-system.c: Renumber instructions. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * module/ice-9/psyntax.scm (binding-type, binding-value): Define using macros so that we inline to car and cdr opcodes. Oh, for an inliner :) * module/language/tree-il/compile-glil.scm (*primcall-ops*) * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*) (*effect+exception-free-primitives*): Add symbol? and vector? inlines. Andy Wingo2010-10-081-1/+1
* Remove `scm_t_aligned_cell'....* libguile/_scm.h (scm_aligned_cell, scm_t_aligned_cell): Remove. The whole approach was misguided as the compiler can't guarantee absolute alignment on the stack. Ludovic Courtès2010-09-271-30/+0
* simplify macro representation in the wake of module hygiene changes...* module/ice-9/psyntax.scm (chi-install-global, chi-macro) (eval-local-transformer): Now that we handle module hygiene through syntax objects, there is no more need to record the current module when installing syntax transformers. * module/ice-9/psyntax-pp.scm: Regenerated (trickily). * libguile/_scm.h: Bump objcode version for macro representation change. * libguile/macros.c (scm_macro_transformer): Adapt to change in macro representation. Andy Wingo2010-06-061-1/+1
* Fix parenthesizing of the `ROUND_UP' macro; factorize....* libguile/_scm.h (ROUND_UP): New macro. * libguile/continuations.c (ROUND_UP): Remove. * libguile/control.c (ROUND_UP): Remove. * libguile/foreign.c (ROUND_UP): Remove. Ludovic Courtès2010-05-301-0/+4
* don't fail when HAVE_STAT64 is undefined...* libguile/_scm.h: Check whether `HAVE_STAT64' is defined instead of checking its value. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Volker Grabsch2010-05-281-1/+1
* Add `scm_t_aligned_cell' internal type....* libguile/_scm.h (struct scm_aligned_cell)[__GNUC__]: New type. (union scm_aligned_cell)[!__GNUC__]: New type. (scm_t_aligned_cell): New type. * libguile/vm.c (vm_dispatch_hook): Use it. Ludovic Courtès2010-05-281-0/+30
* optimize and bugfix make-struct VM opcode...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump for make-struct change. * libguile/struct.c (scm_i_alloc_struct): Use scm_words instead of scm_gc_malloc to simplify the code and inline the call to GC_MALLOC. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile make-struct/no-tail to make-struct. * module/language/tree-il/primitives.scm (define-primitive-expander): Allow a conditional branch of #f to aboirt inlining. (make-struct): Expand into make-struct/no-tail in the case that tail-size is 0. * libguile/vm-i-scheme.c (make-struct): Adapt to always assume tail-size is 0. Inline allocation if possible. Don't decrement the SP past live objects on the stack, which could cause GC to miss references. Use the NULLSTACK macro. Andy Wingo2010-05-011-1/+1
* renumber VM opcodes...* libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Renumber ops. Add a foreign-call op stub. Rearrange some ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump Andy Wingo2010-01-261-1/+1
* 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-1/+1
* subrs are now VM trampoline procedures...* libguile/_scm.h: Add foreign.h and programs.h to the private include list, as snarfing subrs with static allocation now needs access to some of their enums and macros. * libguile/gsubr.c (create_gsubr): Instead of creating a tc7_gsubr object, create a VM program with the call-subr opcode, so that the representation of subrs is now gsubrs. CPP and elisp, together at last. (scm_subr_objcode_trampoline): New function, used by the SCM_DEFINE snarf macro. * libguile/gsubr.h (SCM_SUBR_META_INFO, SCM_SUBR_PROPS) (SCM_SET_SUBR_GENERIC_LOC, SCM_SUBR_ARITY_TO_TYPE): Remove these macros. They were never deprecated, but hopefully people aren't using them. (SCM_SUBRF, SCM_SUBR_NAME, SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC): Update to work on the new subr representation. * libguile/objcodes.h (SCM_F_OBJCODE_IS_STATIC): New flag, indicates that the "backing store" of the objcode is statically allocated. * libguile/procprop.c (scm_sym_name): Define here instead of in gsubr.c. * libguile/snarf.h (SCM_DEFINE): If we are doing static allocation, statically allocate the foreign object, the object table, and the program, and use some SCM_SNARF_INITtery to fix things up. Unfortunately I have not been able to make this immutable. It might be possible, though. (SCM_IMMUTABLE_CELL, SCM_STATIC_DOUBLE_CELL, SCM_IMMUTABLE_FOREIGN): (SCM_STATIC_SUBR_OBJVECT, SCM_STATIC_PROGRAM): New helper macros. Andy Wingo2010-01-071-0/+2
* clean up macros.[ch]...There are some incompatible changes here, but only to interfaces that were introduced earlier in 1.9, or interfaces which have been broken since early in 1.9. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the macro changes affect the interface that is called by psyntax-generated macro definitions. * libguile/inline.h (scm_words): New function, allocates a variable number of contiguous scm_t_bits locations, with a given value in the 0th word, and 0 in the rest of the words. * libguile/macros.h: Rework interface to correspond more closely, and minimally, to the needs of memoize.c and psyntax. (SCM_ASSYNT, SCM_MACRO_TYPE_BITS, SCM_MACRO_TYPE_MASK) (SCM_F_MACRO_EXTENDED, SCM_MACROP, SCM_MACRO_TYPE) (SCM_MACRO_IS_EXTENDED, SCM_BUILTIN_MACRO_P, SCM_SYNCASE_MACRO_P) (SCM_MACRO_CODE, scm_tc16_macro): Remove CPP macros related to the representation of Scheme macros. (scm_i_make_primitive_macro): Renamed from scm_i_makbimacro. (scm_i_macro_primitive): New accessor so that memoize.c can get to the primitive syntax transformer. (scm_make_syncase_macro, scm_make_extended_syncase_macro) (scm_syncase_macro_type, scm_syncase_macro_binding): Removed these functions, replaced by make-syntax-transformer and its accessors. (scm_macro_binding): New accessor, the same as what scm_syncase_macro_binding was. * libguile/macros.c: All representation details of syntax transformers are private to this file now. (macro_print): Print macros as #<syntax-transformer ...>, or #<primitive-syntax-transformer ...> if psyntax has not attached a transformer of its own. (scm_i_make_primitive_macro): Represent macros as 5-word smobs. (scm_make_syntax_transformer): New constructor for syntax transformers (macros), exported to scheme. Takes a name, and looks it up in the current module to determine the previous primitive transformer, if any. (scm_macro_type): Instead of returning 'builtin-macro!, etc, return the type as set by psyntax, or #f if it's a primitive. (scm_macro_name): Return the stored macro name. (scm_macro_transformer): Return the psyntax-set syntax transformer. Hacky, but should help introspection somewhat. * libguile/memoize.c (memoize_env_ref_transformer): Use the new scm_i_macro_primitive, and adapt to other macro API changes. * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook, chi-install-global): Call (and generate calls to) the new macro constructors and accessors. * module/ice-9/psyntax-pp.scm: Doubly regenerated. * module/ice-9/debugging/traps.scm (trap-here): Comment out this definition and export, while it's not working. Andy Wingo2010-01-051-2/+2
* merge from master to elisp...* module/language/elisp/compile-tree-il.scm: Update for changes to tree-il (lambda-case, mainly). * module/language/elisp/spec.scm: Update GPL version to 3. Update reader for new taking a port and environment argument. * libguile/_scm.h: Bump objcode version. * libguile/vm-i-system.c: Fix conflicts. * module/Makefile.am: Fix conflicts, and add elisp modules to the build. Andy Wingo2009-12-111-1/+5
|\
| * Don't rely on `HAVE_' macros in public header "tags.h"....* configure.ac: Check for `intptr_t' and `uintptr_t'. Substitute `SCM_I_GSC_T_INTPTR' and `SCM_I_GSC_T_UINPTR'. * libguile/__scm.h (SCM_T_UINTPTR_MAX, SCM_T_INTPTR_MIN, SCM_T_INTPTR_MAX): New macros. * libguile/_scm.h (SIZEOF_SCM_T_BITS): New macro. * libguile/gen-scmconfig.c (main): Produce typedefs for `scm_t_intptr' and `scm_t_uintptr'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_T_INTPTR, SCM_I_GSC_T_UINPTR): New macros. * libguile/tags.h: Don't check for `HAVE_INTTYPES_H' and `HAVE_STDINT_H'; don't include <inttypes.h> nor <stdint.h>. (scm_t_signed_bits, scm_t_bits): Define unconditionally as aliases for `scm_t_intptr' and `scm_t_uintptr', respectively. (SCM_T_SIGNED_BITS_MAX, SCM_T_SIGNED_BITS_MIN, SCM_T_BITS_MAX): Likewise. (SIZEOF_SCM_T_BITS): Remove. Ludovic Courtès2009-11-241-0/+3
| * Merge branch 'bdw-gc-static-alloc'...Conflicts: acinclude.m4 libguile/__scm.h libguile/bdw-gc.h libguile/eval.c Ludovic Courtès2009-11-011-0/+1
| |\
| | * Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc...Conflicts: acinclude.m4 libguile/strings.c Ludovic Courtès2009-09-021-20/+38
| | |\ | |_|/ |/| |
| | * Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc...Conflicts: .gitignore libguile/procs.h Ludovic Courtès2009-02-141-0/+19
| | |\
| | * | Add support for static allocation of cells, strings and stringbufs....* libguile/__scm.h (SCM_ALIGNED): New macro. * libguile/_scm.h: Include "libguile/strings.h", to make the string/stringbuf-related constants visible to snarffed code. * libguile/snarf.h (SCM_SUPPORT_STATIC_ALLOCATION): New macro. (SCM_SYMBOL, SCM_GLOBAL_SYMBOL)[SCM_SUPPORT_STATIC_ALLOCATION]: New alternative versions of these macros with support for (almost) static allocation via the use of `string->symbol'. (SCM_IMMUTABLE_DOUBLE_CELL, SCM_IMMUTABLE_STRINGBUF, SCM_IMMUTABLE_STRING): New macros. * libguile/tags.h (SCM)[SCM_DEBUG_TYPING_STRICTNESS==1]: Use a pointer type that is compatible with other pointer types, to avoid potential violation of strict aliasing rules. Ludovic Courtès2009-01-141-1/+2
| * | | arities can have noncontiguous starts and ends...* module/language/glil/compile-assembly.scm (open-arity, close-arity) (begin-arity, glil->assembly): Refactor so that arities can have noncontiguous starts and ends. So within a prelude there is no arity -- only before (the previous arity) or after (the new arity). * module/system/vm/program.scm (arity:end): Add this private accessor. Arities are expected to be in the new format. While not a change in objcode format, it is an incompatible change, so I'll bump the objcode cookie. (program-arity): Check that the ip is within both bounds of the arity. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/programs.c (scm_i_program_arity): Update for new arity format. * module/system/vm/frame.scm (vm-frame-arguments): Avoid throwing an error in this function, which is called from the backtrace code. Andy Wingo2009-10-251-1/+1
| * | | vm support for optional/kwarg init code, and bugfixes...* libguile/vm-i-system.c (local-bound?, long-local-bound?) (variable-bound?): New instructions, push #f unless the local is bound. You can get unbound locals from optional arguments. (bind-optionals/shuffle): A number of bugfixes. (bind-kwargs): Bugfixes. If we enocunter an improper kwarg list but the procedure has a rest argument, just stop kwarg processing, but without an error. Renumbered ops. * libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump. Andy Wingo2009-10-231-1/+1
| * | | more work towards compiling and interpreting keyword args...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bumparoo * libguile/vm-i-system.c (push-rest, bind-rest): Logically there are actually two rest binders -- one that pops, conses, and pushes, and one that pops, conses, and local-sets. The latter is used on keyword arguments, because the keyword arguments themselves have been shuffled up on the stack. Renumber ops again. * module/language/tree-il/compile-glil.scm (flatten): Attempt to handle compilation of lambda-case with keyword arguments. Might need some help. * module/ice-9/psyntax.scm (build-lambda-case): An attempt to handle the interpreted case correctly. This might need a couple iterations, but at least it looks like the compile-glil code. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/glil.scm (<glil>): Rename "rest?" to "rest" in <glil-opt-prelude> and <glil-kw-prelude>, as it is no longer a simple boolean, but if true is an integer: the index of the local variable to which the rest should be bound. * module/language/glil/compile-assembly.scm (glil->assembly): Adapt to "rest" vs "rest?". In the keyword case, use "bind-rest" instead of "push-rest". * test-suite/tests/tree-il.test: Update for opt-prelude change. Andy Wingo2009-10-231-1/+1
| * | | finish support for optional & keyword args; update ecmascript compiler...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (br-if-nargs-ne, br-if-args-lt) (br-if-nargs-gt): New instructions, for use by different lambda cases. (bind-optionals, bind-optionals/shuffle, bind-kwargs): New instructions, for binding optional and keyword arguments. Renumber other ops. * module/language/ecmascript/compile-tree-il.scm (comp, comp-body): Update for new tree-il. Use the new optional argument mechanism instead of emulating it with rest arguments. * module/language/glil/compile-assembly.scm (glil->assembly): Tweaks for optional and keyword argument compilation. * module/language/tree-il.scm (parse-tree-il, unparse-tree-il): Make the else case optional, in the s-expression serialization of tree-il. * module/language/tree-il/compile-glil.scm (flatten): Handle all of the lambda-case capabilities. Andy Wingo2009-10-231-1/+1
| * | | de-nargs struct scm_objcode; procedure-property refactor...* libguile/objcodes.h (struct scm_objcode): Remove nargs, nrest, and nlocs, as they are no longer needed. Also obviates the need for a padding word. * libguile/procs.c (scm_thunk_p): Use scm_i_program_arity for programs. * libguile/procprop.c (scm_i_procedure_arity): Use scm_i_program_arity for programs. (scm_procedure_properties, scm_set_procedure_properties_x) (scm_procedure_property, scm_set_procedure_property_x): Rework so that non-closure properties are stored directly in a weak hash, instead of needing a weak hash of "stand-in" closures to hold the properties. Fix docstrings also. * libguile/root.h (scm_stand_in_procs): Remove from the scm_sys_protects set. Actually with libGC, we should be able to store the elements of scm_sys_protects directly as global variables. * libguile/gc.c (scm_init_storage): Remove scm_stand_in_procs initialization. * libguile/programs.c (scm_i_program_arity): New private accessor, tries to determine the "minimum arity" of a program. * libguile/vm.c (really_make_boot_program): Adapt to changes in struct scm_objcode. * module/language/assembly.scm (*program-header-len*, byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): Adapt to changes in objcode. * module/system/xref.scm (program-callee-rev-vars): Adapt to changes in assembly. * module/language/glil.scm: Remove nargs, nrest, and nlocs from glil-program. * module/language/glil/compile-assembly.scm (make-meta, glil->assembly): * module/language/glil/decompile-assembly.scm (decompile-toplevel): (decompile-load-program): Adapt to changes in GLIL and assembly. * module/language/tree-il/compile-glil.scm (flatten-lambda): Adapt to changes in GLIL. * test-suite/tests/asm-to-bytecode.test: Adapt to assembly and bytecode changes. * test-suite/tests/tree-il.test: Adapt to GLIL changes. Andy Wingo2009-10-231-1/+1
| * | | runtime and debugging support for callee-parsed procedure args...* libguile/objcodes.h: Bump for metadata format change. * libguile/frames.h: Rework so we don't frob the program's nargs, nlocs, etc at runtime. Instead we don't really know what's a local var, an argument, or an intermediate value. It's a little unfortunate, but this will allow for case-lambda, and eventually for good polymorphic generic dispatch; and the nlocs etc can be heuristically reconstructed. Such a reconstruction would be better done at the Scheme level, though. (SCM_FRAME_STACK_ADDRESS): New macro, the pointer to the base of the stack elements (not counting the program). (SCM_FRAME_UPPER_ADDRESS): Repurpose to be the address of the last element in the bookkeeping part of the stack -- i.e. to point to the return address. * libguile/vm-engine.h: * libguile/vm-i-system.c: Adapt to removal of stack_base. Though we still detect stack-smashing underflow, we don't do so as precisely as we did before, because now we only detect overwriting of the frame metadata. * libguile/vm-engine.c (vm_engine): Remove the stack_base variable. It is unnecessary, and difficult to keep track of in the face of case-lambda. Also fix miscommented "ra" and "mvra" pushes. Push the vp->ip as the first ra... * libguile/vm-i-system.c (halt): ...because here we can restore the vp->ip instead of setting ip to 0. Allows us to introspect ips all down the stack, including in recursive VM invocations. * libguile/frames.h: * libguile/frames.c (scm_vm_frame_stack): Removed, because it's getting more difficult to tell what's an argument and what's a temporary stack element. (scm_vm_frame_num_locals): New accessor. (scm_vm_frame_instruction_pointer): New accessor. (scm_vm_frame_arguments): Defer to an implementation in Scheme. (scm_vm_frame_num_locals scm_vm_frame_local_ref) (scm_vm_frame_local_set_x): Since we can get not-yet-active frames on the stack now, with our current calling convention, we have to add a heuristic here to jump over those frames -- because frames have pointers in them, not Scheme values. * libguile/programs.h: * libguile/programs.c (scm_program_arity): Remove, in favor of.. (scm_program_arities): ...this, which a list of arities, in a new format, occupying a slot in the metadata. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Fix mv-call decompilation. * module/system/vm/frame.scm (vm-frame-bindings, vm-frame-binding-ref) (vm-frame-binding-set!): New functions, to access bindings by name in a frame. (vm-frame-arguments): Function now implemented in Scheme. Commented fairly extensively. * module/system/vm/program.scm (program-bindings-by-index) (program-bindings-for-ip): New accessors, parsing the program bindings metadata into something more useful. (program-arities, program-arguments): In a case-lambda world, we have to assume that programs can have multiple arities. But it's tough to detect this algorithmically; instead we're going to require that the program metadata include information about the arities, and the parts of the program that that metadata applies to. (program-lambda-list): New accessor. (write-program): Show multiple arities. * module/language/glil/compile-assembly.scm (glil->assembly): Add "arities" to the state of the compiler, and add arities entries as appropriate. Andy Wingo2009-10-231-1/+1
| * | | steps on the way to have the callee check the number of arguments...* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (assert-nargs-ee, assert-nargs-ge) (push-rest-list): New instructions, which for now don't actually do anything. Renumber the rest of the ops in this file. * module/language/glil.scm (<glil-arity>): New GLIL type, an entity that checks the number of args for a block, optionally consing a rest list, and either branching or erroring if the arity doesn't match. * module/language/glil/compile-assembly.scm (glil->assembly): Compile <glil-arity> to assembly. Some of these VM ops are not implemented -- notably the branching case. * module/language/tree-il/compile-glil.scm (flatten-lambda): Emit <glil-arity>. * test-suite/tests/tree-il.test: Update. Andy Wingo2009-10-231-1/+1