summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-04-24build: Honor program name transformation in 'guild'.Ludovic Courtès3-12/+15
* configure.ac: Remove erroneous 'guile_program_name' substitute; see <https://lists.gnu.org/archive/html/autoconf/2014-04/msg00010.html> for details. Remove 'meta/guild' config file. * meta/Makefile.am (guild): New target. (CLEANFILES): Add 'guild'. * meta/guild.in: Remove 'prefix' and 'exec_prefix' definitions; use @installed_guile@.
2014-04-23Set $GC_MARKERS to 1 when libgc 7.4.0 is used.Ludovic Courtès1-0/+8
* libguile/gc.c (scm_storage_prehistory) [GC_VERSION == 7.4.0]: Add 'setenv' call.
2014-04-21Add make-vector opcodeAndy Wingo5-37/+61
* 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.
2014-04-21Operations on 8-bit and 12-bit operands shuffle args into rangeAndy Wingo3-12/+342
* module/language/cps/slot-allocation.scm (allocate-slots): Avoid allocating locals in the range [253,255]. * module/system/vm/assembler.scm: List exports explicitly. For operations with limited-range operands, export wrapper assemblers that handle shuffling their operands into and out of their range. (define-assembler): Get rid of enclosing begin. (shuffling-assembler, define-shuffling-assembler): New helpers to define shuffling wrapper assemblers. (emit-mov*, emit-receive*): New functions. (shuffle-up-args): New helper. (standard-prelude, opt-prelude, kw-prelude): Call shuffle-up-args after finishing. * test-suite/tests/compiler.test ("limits"): Add test cases.
2014-04-21More expansion-time-only definitions in assembler.scmAndy Wingo1-156/+163
* module/system/vm/assembler.scm (define-inline): Change so that the defined macro is only defined at expansion-time. (u32-ref, u32-set!, s32-ref, s32-set!, pack-arity-flags): Use define-inline. (pack-flags, assert-match, *block-size*, id-append, assembler) (define-assembler, visit-opcodes, define-macro-assembler): Wrap in eval-when expand.
2014-04-21define-inline in assembler.scmAndy Wingo1-12/+23
* module/system/vm/assembler.scm (define-inline): New local helper. Update local users of define-inlinable to use it.
2014-04-20VM opcodes only have <24-bit slot operands in the first wordAndy Wingo3-29/+5
* libguile/vm-engine.c (make-array): Change to only have restricted-width operands in the first word. This instruction is currently unused, however. * module/system/vm/assembler.scm (assembler): * module/system/vm/disassembler.scm (disassembler): Disallow restricted-width operands in tail words.
2014-04-17Add interface to disable automatic finalizationAndy Wingo4-12/+130
* libguile/finalizers.h: * libguile/finalizers.c (run_finalizers_async_thunk) (finalization_thread_proc): Call the new scm_run_finalizers helper. (scm_i_finalizer_pre_fork): Only spawn the thread if automatic finalization is enabled. (scm_set_automatic_finalization_enabled, scm_run_finalizers): New functions. (scm_init_finalizers, scm_init_finalizer_thread): Only set a finalizer notifier if automatic finalization is enabled. * doc/ref/libguile-smobs.texi (Garbage Collecting Smobs): Add discussion of concurrency. * doc/ref/api-smobs.texi (Smobs): Document new functions.
2014-04-16Slot allocation can re-use closure and argument slotsAndy Wingo1-6/+6
* module/language/cps/slot-allocation.scm (allocate-slots): Allow slot allocation to re-use the closure and argument slots.
2014-04-16Remove SCM_FRAME_PROGRAMAndy Wingo1-21/+0
* libguile/frames.h: Remove SCM_FRAME_PROGRAM, now unused.
2014-04-16VM robustness for optimized closuresAndy Wingo2-33/+31
* libguile/vm.c (vm_error_unbound, vm_error_unbound_fluid): Remove proc argument. The value in slot 0 is not necessarily the procedure being applied, after the prelude is done. * libguile/vm-engine.c (vm_engine): Use LOCAL_REF (0) instead of SCM_FRAME_PROGRAM, and adapt to above changes.
2014-04-16Fix rewinding continuations when outermost frame has zero localsAndy Wingo1-1/+1
* libguile/vm.c (vm_reinstate_partial_continuation_inner): Fix boundary condition when the outermost frame has zero locals.
2014-04-16frame-previous, frame-procedure robustnessAndy Wingo1-21/+34
* libguile/frames.c (scm_c_frame_closure): Don't use SCM_FRAME_PROGRAM, as we don't know if the frame actually has any locals. (scm_c_frame_previous): More robustly detect end-of-stack. Allows scm_c_frame_previous to work on partial continuations.
2014-04-16make-stack works on delimited continuationsAndy Wingo3-0/+24
* libguile/stacks.c (scm_make_stack, scm_stack_id): * libguile/vm.c (scm_i_vm_cont_to_frame): Allow delimited continuations as the argument to make-stack.
2014-04-16More robust coverage testsAndy Wingo1-1/+10
* test-suite/tests/coverage.test ("line-execution-counts"): Allow zero or one count on the loop head.
2014-04-16Change some make-stack tests to use frame-call-representationAndy Wingo1-8/+6
* test-suite/tests/eval.test ("stacks"): Use frame-call-representation.
2014-04-16Fix statprof for optimizationsAndy Wingo1-21/+28
* module/statprof.scm (profile-signal-handler): Bind in a letrec. Otherwise the compiler may see the closure slot as dead, and the inner stack cut won't work.
2014-04-16Fix a frame-call-representation bugAndy Wingo1-3/+2
* module/system/vm/frame.scm (frame-call-representation): Fix logic for displaying names of non-procedures and procedures out of arities.
2014-04-16Better backtraces from C, especially for optimized closuresAndy Wingo3-9/+24
* libguile/frames.h: * libguile/frames.c (scm_frame_call_representation): New interface; dispatches to Scheme. * libguile/backtrace.c (display_application): Use scm_frame_call_representation. This should be monotonically better, given that scm_frame_arguments (which was previously called) also dispatched to Scheme and actually ended up calling frame-call-representation.
2014-04-16frame-call-representation checks available-bindings, as appropriateAndy Wingo1-17/+34
* module/system/vm/frame.scm (available-bindings): Map indexes in such a way that the first argument is index 1. (frame-call-representation): Update to search the bindings for live bindings.
2014-04-16Update frame-bindings interfaceAndy Wingo3-37/+29
* module/system/repl/debug.scm (print-locals): Update to work with new interface. (frame->module): Update. Still doesn't work due to lack of `program-module', though. * module/system/vm/program.scm (make-binding, binding:name) (binding:definition-offset, program-arity-bindings-for-ip): Remove these. * module/system/vm/frame.scm (<binding>): New type. (available-bindings): Return a list of <binding> instances. (frame-lookup-binding, frame-binding-set!, frame-binding-ref): (frame-environment, frame-object-name): Adapt.
2014-04-16Implement frame-bindingsAndy Wingo1-3/+193
* module/system/vm/frame.scm (parse-code, compute-predecessors): (compute-genv, compute-defs-by-slot, compute-killv, available-bindings): (frame-bindings): Add a bunch of hairy code to compute the set of bindings that are live in a frame.
2014-04-16Add arity-codeAndy Wingo1-0/+12
* module/system/vm/debug.scm (arity-code): New interface.
2014-04-16Add parsing interfaces to the disassemblerAndy Wingo1-1/+116
* module/system/vm/disassembler.scm (instruction-length): (instruction-has-fallthrough?, instruction-relative-jump-targets): (instruction-slot-clobbers): New interfaces; to be used when determining the bindings available at a given point of a procedure.
2014-04-16Fix up some opcode metadataAndy Wingo1-2/+2
* libguile/vm-engine.c (make-long-immediate, static-ref): Mark as "dst" instructions.
2014-04-15Add ability to query local definitions for a procedureAndy Wingo2-57/+69
* module/system/vm/debug.scm (arity-definitions): New interface. * module/system/vm/program.scm (make-binding, binding:boxed?) (binding:index, binding:start, binding:end): Remove. (binding:definition-offset, binding:slot): Add. (program-arity-bindings-for-ip): Rename from program-bindings-for-ip, as it gives all definitions in an arity. The user will have to do data-flow analysis to recover the set of variables that are actually available at any given point. (arity->arguments-alist): Remove crufty code.
2014-04-15Fix rtl testsAndy Wingo2-2/+17
* module/system/vm/assembler.scm (write-arities): Add a diagnostic. * test-suite/tests/rtl.test: Fix tests to emit "definition" instructions.
2014-04-15Fix frame-call-representation for primitive applicationsAndy Wingo2-25/+36
* module/system/vm/frame.scm (frame-call-representation): Fix to work for primitives. * test-suite/tests/eval.test ("stacks"): Update expected result for substring.
2014-04-15Assembler residualizes local variable definition locationsAndy Wingo1-2/+13
* module/system/vm/assembler.scm (write-arities): Serialize definition locations after names. (definition): Store definition as a byte offset.
2014-04-15Bump minor objcode version for recent changesAndy Wingo2-2/+2
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.
2014-04-15Write all local variable names into the arities sectionAndy Wingo2-163/+192
* module/system/vm/assembler.scm (put-uleb128, put-sleb128) (port-position): Lift out these helpers. (arity-header-len, write-arities, link-arities): Add "nlocals" to the arity headers. Write names of all locals into the arities section, not just the arguments. Write them as uleb128's instead of uint32's, to save space. * module/system/vm/debug.scm (arity-header-len, arity-nlocals*) (arity-nlocals, arity-locals, arity-arguments-alist): Adapt to new encoding for arities.
2014-04-15Tweak arities debugging representationAndy Wingo2-51/+45
* module/system/vm/assembler.scm (meta-arities-size, write-arity-links): * module/system/vm/debug.scm (arity-keyword-args) (arity-arguments-alist): Rewrite to put they keyword literals link first. Unfortunately requires a recompile :/
2014-04-15Beginnings of local variable informationAndy Wingo2-4/+16
* module/system/vm/assembler.scm (<arity>, begin-kw-arity, end-arity): (definition): Add definition macro-instruction. Arrange to record variable definitions. * module/language/cps/compile-bytecode.scm (compile-fun): Emit definition macro-instructions as appropriate.
2014-04-15Remove needless label remapping in slot-allocationAndy Wingo1-18/+9
* module/language/cps/slot-allocation.scm (dead-after-def?): (dead-after-use?, allocate-slots): Remove some needless remapping between label indexes in the CFA, the DFA, and their names.
2014-04-15DFA datums don't rename their labelsAndy Wingo1-42/+39
* module/language/cps/dfg.scm (analyze-reverse-control-flow): Don't compute and return an order vector; it's not needed. ($dfa): Remove label renaming. We can just rename labels before returning the DFA. (dfa-k-idx, dfa-k-sym, dfa-k-count): Adapt. (compute-live-variables): Adapt, and rename labels before returning.
2014-04-15Better backtraces for optimized closuresAndy Wingo2-36/+73
* module/system/vm/debug.scm (arity-keyword-args, find-program-arity): New exports. * module/system/vm/frame.scm (frame-call-representation): Prefer to use the frame IP to get the procedure.
2014-04-14statprof avoids mucking with VM trace levels when not counting callsAndy Wingo1-5/+5
* module/statprof.scm (statprof-start, statprof-stop): Don't futz the vm trace level when we aren't counting calls. With this change, statprof now imposes no overhead on the measured program.
2014-04-14Better state handling in statprofAndy Wingo1-16/+20
* module/statprof.scm (statprof-fold-call-data) (statprof-proc-call-data): Add optional state arg. (gcprof): Add optional port arg, and pass state arg explicitly. (statprof-display-anomalies, statprof-display) (statprof-call-data->stats): Pass state explicitly.
2014-04-14Optimize make-stackAndy Wingo5-80/+103
* libguile/continuations.h: * libguile/continuations.c (scm_i_continuation_to_frame): Operate on low-level C structures instead of heap objects. * libguile/frames.h: * libguile/frames.c (frame_offset, frame_stack_base): Const args. (scm_c_frame_closure): New helper. (scm_frame_procedure): Use the new helper. * libguile/stacks.c (stack_depth, narrow_stack, scm_make_stack): Rework to avoid allocating frames as we traverse the stack, and to avoid an n**2 case where there are outer cuts.
2014-04-14scm_c_make_frame takes struct scm_frame as argAndy Wingo4-23/+25
* libguile/frames.h: * libguile/frames.c (scm_c_make_frame): Adapt to take a const struct scm_frame as the argument. Adapt callers. * libguile/continuations.c: * libguile/stacks.c: Adapt callers.
2014-04-14Refactor to frames codeAndy Wingo2-46/+73
* libguile/frames.h: * libguile/frames.c (scm_c_frame_previous): New internal helper. (scm_frame_previous): Use the helper. (RELOC): Take kind and low-level frame args separately. Adapt callers. (frame_stack_base, frame_offset): New helpers. (scm_i_frame_offset, scm_i_frame_stack_base): Use low-level helpers.
2014-04-14Optimize make-global-cont-folderAndy Wingo1-8/+10
* module/language/cps.scm (make-global-cont-folder): Inline the fold-values, as peval doesn't do so. Allows closure conversion to avoid any closure creation.
2014-04-13Improve disassembly for optimized closuresAndy Wingo1-4/+19
* module/system/vm/disassembler.scm (code-annotation): Add call-label and tail-call-label cases. (disassemble-addr): With call-label we can see sets of mutually recursive functions, so keep a global "visited?" set.
2014-04-13Remove debugging code in closure-conversionAndy Wingo1-1/+0
* module/language/cps/closure-conversion.scm (prune-free-vars): Remove pk.
2014-04-13Eval has no more free variablesAndy Wingo1-3/+8
* module/ice-9/eval.scm (primitive-eval): Expand out the call to make-general-closure, so that make-general-closure becomes well-known. Now eval has no more free variables!
2014-04-13Closure conversion eliminates self-references introduced by fixpointAndy Wingo1-12/+23
* module/language/cps/closure-conversion.scm (analyze-closures): Build a bound-vars set as well, to resolve introduced self-references. (prune-free-vars, convert-one): Arrange to eliminate self-references.
2014-04-13Refactor to closure-conversionAndy Wingo1-186/+181
* module/language/cps/closure-conversion.scm (convert-one): Refactor to pull in helpers locally, as they will need more state.
2014-04-13Avoid consing an unbound-arg marker in the evaluatorAndy Wingo1-3/+7
* module/ice-9/eval.scm (primitive-eval): Turns out we don't need to cons to make the unbound-arg marker.
2014-04-13Optimize closures with one free variableAndy Wingo1-33/+111
* module/language/cps/closure-conversion.scm (convert-free-var) (allocate-closure, init-closure, prune-free-vars, convert-one) (convert-closures): Optimize closures with one free variable.
2014-04-12Well-known closures represented using pairs or vectorsAndy Wingo1-107/+195
* module/language/cps/closure-conversion.scm (convert-free-var): (convert-free-vars): Take self-known? param, to do the right thing for well-known closures. (allocate-closure): New helper. Well-known closures are represented using pairs or vectors. (init-closure): Adapt tpo DTRT for well-known closures. (prune-free-vars): Move up. (convert-one): Adapt to new well-known closure representation.