summaryrefslogtreecommitdiff
path: root/module/system
AgeCommit message (Collapse)AuthorFilesLines
2016-07-11Fix compilation of rank 0 typed array literalsDaniel Llorens1-1/+3
* module/system/vm/assembler.scm (simple-uniform-vector?): array-length fails for rank 0 arrays; fix the shape condition. * test-suite/tests/arrays.test: test reading of #0f64(x) in compilation context.
2016-06-25Add -Wmacro-use-before-definitionAndy Wingo1-0/+6
* module/ice-9/boot-9.scm (%auto-compilation-options): * am/guilec (GUILE_WARNINGS): Add -Wmacro-use-before-definition. * module/language/tree-il/analyze.scm (unbound-variable-analysis): Use match-lambda. (<macro-use-info>, macro-use-before-definition-analysis): New analysis. * module/system/base/message.scm (%warning-types): Add macro-use-before-definition warning type. * module/language/tree-il/compile-cps.scm (%warning-passes): Add support for macro-use-before-definition.
2016-06-23Don't serialize uninterned symbolsAndy Wingo1-0/+2
* module/system/vm/assembler.scm (intern-constant): Don't serialize uninterned symbols. * test-suite/tests/rtl.test ("bad constants"): Add a test.
2016-06-21`define!' instruction returns the variableAndy Wingo1-1/+1
* 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.
2016-06-21Use source file permissions for compiled filesAndy Wingo1-1/+3
* module/system/base/compile.scm (call-with-output-file/atomic): Use the permissions of the source file, if available, as the permissions of the compiled file. Fixes #18477.
2016-06-21Importing modules with #:select no longer grovels private bindingsAndy Wingo1-5/+9
* module/ice-9/boot-9.scm (resolve-interface): Don't look in private interface for #:select bindings. Fixes #17418. * module/system/repl/coop-server.scm: Don't rely on bad #:select behavior. * NEWS: Add entry.
2016-06-17Fix 64->32 bit cross-compilation of large-ish fixnumsAndy Wingo1-23/+23
* module/system/vm/assembler.scm (immediate-bits): Fix a bug whereby compiling to a 32-bit target from a 64-bit host would treat all integers whose representation fit into 32 bits as immediates. This would result in integer constants between #x20000000 and 0x3fffffff being residualized in such a way that they would be loaded as negative numbers.
2016-05-22Bump user-visible copyright years to 2016.Mark H Weaver1-3/+2
* doc/ref/guile.texi: Add 2016 to user-visible copyright notice. * module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2016. * module/system/repl/common.scm (*version*): Add 2016 to the range of copyright years.
2016-05-22Bump user-visible copyright years to 2015.Mark H Weaver1-1/+1
* module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2015. * module/system/repl/common.scm (*version*): Add 2015 to the range of copyright years.
2016-05-22Handle zero-length bytevectors correctly in (system base types).Mark H Weaver1-1/+1
* module/system/base/types.scm (cell->object): Use 'get-bytevector-n' instead of 'get-bytevector-all', so that the zero-length case does not return EOF.
2016-05-22Work around requirement that size be non-zero in GDB 'open-memory'.Mark H Weaver1-2/+6
* module/system/base/types.scm (memory-port): Handle zero size case specially.
2016-05-16Bump objcode versionAndy Wingo1-1/+1
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump for Guile 2.1.3.
2016-05-04Add integer->char and char->integer opcodesAndy Wingo1-0/+2
* libguile/vm-engine.c (integer_to_char, char_to_integer): New opcodes. * libguile/vm.c (vm_error_not_a_char): New error case. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/types.scm: * module/language/tree-il/compile-cps.scm (convert): * doc/ref/vm.texi (Inlined Scheme Instructions): * module/system/vm/assembler.scm: Add support for new opcodes.
2016-04-04Use symbols instead of _IONBF values as args to setvbufAndy Wingo1-1/+1
* libguile/ports.c (scm_setvbuf): Use the symbols `none', `line', and `block' instead of the values `_IONBF', `_IOLBF', and `_IOFBF'. * NEWS: Update. * doc/ref/posix.texi (Ports and File Descriptors): Update setvbuf documentation. * module/ice-9/deprecated.scm (define-deprecated): New helper. (_IONBF, _IOLBF, _IOFBF): Define deprecated values. * benchmark-suite/benchmarks/read.bm ("read"): * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): * libguile/r6rs-ports.c (cbip_fill_input): * module/system/base/types.scm (%ffi-memory-backend): * module/web/client.scm (open-socket-for-uri): * module/web/server/http.scm (http-read): * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): ("setvbuf"): * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Update to use non-deprecated interfaces.
2016-04-04Fix frame->stack-vector when no stack is activeAndy Wingo1-15/+17
* module/system/repl/debug.scm (frame->stack-vector): Handle the case where there is no active stack.
2016-02-02Fix frame-call-representation for change to <binding>.Andy Wingo1-2/+2
* module/system/vm/frame.scm (frame-call-representation): Fix for change to <binding>.
2016-02-01Update statprof documentation; deprecate `with-statprof'Andy Wingo1-29/+1
* module/statprof.scm: Remove most of the commentary, as it was duplicated in the manual and was getting out of date. (stats): Remove self-secs-per-call and cum-secs-per-call fields as they can be computed from the other fields. (statprof-call-data->stats): Adapt. (statprof-stats-self-secs-per-call): (statprof-stats-cum-secs-per-call): New functions. (statprof-display/flat): Don't print the seconds-per-call fields, as we are no longer stopping the clock around call counters. Anyway these times were quite misleading. (with-statprof): Deprecate. It took its keyword arguments at the beginning; very complicated! Better to use the `statprof' function. (`statprof' was introduced after `with-statprof' and then `with-statprof' was adapted to use it.) * doc/ref/statprof.texi (Statprof): Port this documentation away from the automatically generated text and update it for the new interfaces like #:display-style. * module/system/base/syntax.scm (record-case): Remove comment that referenced with-statprof. Add comment indicating that record-case should be replaced. * doc/ref/scheme-using.texi (Profile Commands): Update to mention keyword arguments and to link to the statprof documentation.
2016-01-31Frame <binding> objects capture frame, can ref value directlyAndy Wingo2-30/+29
* module/system/repl/debug.scm (print-locals): Adapt to frame-binding-ref change. * module/system/vm/frame.scm (<binding>): Add `frame' field. (available-bindings): Capture the frame. (binding-ref, binding-set!): New functions, accessing a local variable value directly from a frame. (frame-binding-ref, frame-binding-set!): Remove. As these are very low-level debugging interfaces introduced in 2.0, never documented, and quite tied to the VM, we feel comfortable making this change. (frame-call-representation): Adapt to available-bindings change. (frame-environment, frame-object-binding): Adapt to binding-ref interface change. * doc/ref/vm.texi (Stack Layout): Mention that slots can be re-used. Update disassembly in example. * doc/ref/api-debug.texi (Frames): Remove documentation for frame-local-ref, frame-local-set!, and frame-num-locals. Replace with documentation for frame-bindings, binding accessors, and binding-ref / binding-set!.
2016-01-31Remove frame-local-ref, frame-local-set!Andy Wingo2-6/+24
* libguile/frames.h (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x): Remove. As long as we are changing the interface in a backward-incompatible way, we might as well remove these. * libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x, scm_init_frames_builtins, scm_init_frames): Arrange to make frame-local-ref et al private to frames.scm. * module/system/vm/frame.scm: Load scm_init_frames_builtins extensions. (frame-instruction-pointer-or-primitive-procedure-name): New public function. (frame-binding-ref, frame-binding-set!): Allow binding objects as vars. * module/system/repl/debug.scm (print-locals): Pass binding directly to frame-binding-ref. * module/statprof.scm (sample-stack-procs, count-call): Use new frame-instruction-pointer-or-primitive-procedure-name function.
2016-01-29Fix uniform vector compilation to foreign byte orders.Andy Wingo1-19/+26
* module/system/vm/assembler.scm (define-byte-order-swapper): New helper. (byte-swap/2!, byte-swap/4!, byte-swap/8!): New functions. (link-data): Swap bytes in uniform vectors on foreign byte orders.
2016-01-29Fix cross-compilation of immediates to targets with different word sizesAndy Wingo1-32/+61
* module/system/vm/assembler.scm (immediate-bits): Rename from immediate?, and return the bits. Take asm argument so that we measure what's an immediate not on the host but for the target. Adapt all callers. (write-immediate): Take bits instead of SCM object. Adapt callers. (write-placeholder): New helper, to write bits for #f. Adapt callers that wrote #f to use write-placeholder.
2015-12-26Assembler O(n) in instruction encodings, not instruction countAndy Wingo1-276/+324
* module/system/vm/assembler.scm: Change define encoders for all of the kinds of instructions and have the emit-foo procedures call the common encoders. No change to public interface. This decreases the amount of generated code in the assembler.
2015-12-26Fix emit-receive* for many localsAndy Wingo1-1/+1
* module/system/vm/assembler.scm (emit-receive*): Fix to use FP-relative move instead of SP-relative move.
2015-12-26Assembler works on byte offsets, not u32 offsetsAndy Wingo2-56/+48
* module/system/vm/assembler.scm (u32-ref, u32-set!, s32-ref, s32-set!): Remove these helpers. * module/system/vm/assembler.scm (<asm>): Track offsets in bytes, not u32 units. (emit, assembler, process-relocs, process-labels, link-text-object) (link-frame-maps, link-symtab, write-arities, link-docstrs) (link-procprops, link-debug): Adapt. * module/system/vm/linker.scm (process-reloc): Add addend before dividing by 4 for rel32/4 symbols.
2015-12-03Add support for comparing u64 values with SCM valuesAndy Wingo2-1/+10
* libguile/vm-engine.c (BR_U64_SCM_COMPARISON): New helper. (br-if-u64-<=-scm, br-if-u64-<-scm, br-if-u64-=-scm) (br-if-u64->-scm, br-if-u64->=-scm): New instructions, to compare an untagged u64 with a tagged SCM. Avoids many u64->scm operations. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/type-fold.scm: * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm (code-annotation, compute-labels): * module/language/cps/primitives.scm (*branching-primcall-arities*): Add support for new opcodes. * module/language/cps/specialize-numbers.scm (specialize-u64-scm-comparison): New helper. * module/language/cps/specialize-numbers.scm (specialize-operations): Specialize u64 comparisons. * module/language/cps/types.scm (true-comparison-restrictions): New helper. (define-comparison-inferrer): Use the new helper. Add support for u64-<-scm et al.
2015-12-02Refactor range checking in assembler instruction packersAndy Wingo1-58/+36
* module/system/vm/assembler.scm (check-urange, check-srange): New helpers. (pack-u8-u24, pack-u8-s24, pack-u1-u7-u24, pack-u8-u12-u12): (pack-u8-u8-u16, pack-u8-u8-u8-u8): Use the new helpers. Not only makes the code nicer but also reduces register pressure.
2015-12-02Add ursh/immediate and ulsh/immediate opsAndy Wingo1-0/+2
* libguile/vm-engine.c (ursh/immediate, ulsh/immediate): New ops. * module/language/cps/effects-analysis.scm: * module/language/cps/slot-allocation.scm (compute-var-representations) (compute-needs-slot): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): * module/language/cps/compile-bytecode.scm (compile-function): * module/system/vm/assembler.scm: * module/language/cps/types.scm: Add support for new ops, and specialize ursh and ulsh.
2015-12-02Assembler has a single growable vectorAndy Wingo1-54/+30
* module/system/vm/assembler.scm (<asm>): Instead of writing words into a list of fixed-size buffers, use a growable vector. (expand, emit): Instead of assuming that there is enough space for only one word, check that there is space for the entire instruction at the beginning.
2015-12-02More efficient assembler instructionsAndy Wingo1-35/+60
* module/system/vm/assembler.scm (pack-u8-u24, pack-u8-s24): (pack-u1-u7-u24, pack-u8-u12-u12, pack-u8-u8-u16): Tweak to expose more possibilities for untagging u64 values.
2015-12-02Add untagged bitwise operationsAndy Wingo1-0/+6
* libguile/vm-engine.c (ulogand, ulogior, ulogsub, ulsh, ursh) (scm->u64/truncate): New ops. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): * module/language/cps/types.scm: * module/language/cps/utils.scm (compute-constant-values): * module/system/vm/assembler.scm: Wire up support for the new ops.
2015-12-01Add logsub op.Andy Wingo1-0/+1
* libguile/vm-engine.c (logsub): New op. * module/language/cps/effects-analysis.scm (logsub): * module/language/cps/types.scm (logsub): * module/system/vm/assembler.scm (system): Add support for the new op. * module/language/tree-il/compile-cps.scm (canonicalize): Rewrite (logand x (lognot y)) to (logsub x y).
2015-12-01Add current-thread VM opAndy Wingo1-0/+1
* libguile/vm-engine.c (current-thread): New op. * module/language/cps/effects-analysis.scm (&thread): New memory kind. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm (current-thread): * module/language/cps/types.scm (current-thread): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): * module/system/vm/assembler.scm (emit-current-thread): Wire up the new op.
2015-12-01Untag values and indexes for all bytevector instructionsAndy Wingo2-1/+6
* libguile/vm-engine.c (bv-s8-ref, bv-s16-ref, bv-s32-ref, bv-s64-ref): Unbox index and return unboxed S32 value. (bv-s8-set!, bv-s16-set!, bv-s32-set!, bv-s64-set!): Unbox index and take unboxed S32 value. (bv-u8-ref, bv-u16-ref, bv-u32-ref, bv-u64-ref) (bv-s8-set!, bv-s16-set!, bv-s32-set!, bv-s64-set!): Likewise, but with unsigned values. (bv-f32-ref, bv-f32-set!, bv-f64-ref, bv-f64-set!): Use memcpy to access the value so we don't have to think about alignment. GCC will inline this to a single instruction on architectures that support unaligned access. * libguile/vm.c (vm_error_out_of_range_uint64) (vm_error_out_of_range_int64): New helpers. * module/language/cps/slot-allocation.scm (compute-var-representations): All bytevector ref operations produce untagged values. * module/language/cps/types.scm (define-bytevector-accessors): Update for bytevector untagged indices and values. * module/language/cps/utils.scm (compute-constant-values): Fix s64 case. * module/language/tree-il/compile-cps.scm (convert): Box results of all bytevector accesses, and unbox incoming indices and values.
2015-12-01Add support for unboxed s64 valuesAndy Wingo2-0/+5
* libguile/frames.c (enum stack_item_representation): (scm_to_stack_item_representation): (scm_frame_local_ref, scm_frame_local_set_x): Support for S64 representations. * libguile/frames.h (union scm_vm_stack_element): Add signed 64-bit integer field. * libguile/vm-engine.c (scm->s64, s64->scm, load-s64): New instructions. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/cse.scm (compute-equivalent-subexpressions): * module/language/cps/effects-analysis.scm: * module/language/cps/slot-allocation.scm (compute-var-representations) (compute-needs-slot, allocate-slots): * module/language/cps/utils.scm (compute-constant-values): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Add support for new primcalls. * module/language/cps/types.scm (&s64): New type. (&s64-min, &s64-max, &u64-max): New convenience definitions. (&range-min, &range-max): Use &s64-min and &u64-max names. (scm->s64, load-s64, s64->scm): Add support for new primcalls. * module/system/vm/assembler.scm (emit-scm->s64, emit-s64->scm) (emit-load-s64): New exports. * module/system/vm/assembler.scm (write-arities): Support for s64 slots. * module/system/vm/debug.scm (arity-definitions): Support for s64 slots.
2015-12-01New instructions load-f64, load-u64Andy Wingo2-1/+14
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add word types for immediate f64 and u64 values. (TYPE_WIDTH): Bump up by a bit, now that we have 32 word types. (NOP, parse_instruction): Use 64-bit meta type. * libguile/vm-engine.c (load-f64, load-u64): New instructions. * module/language/bytecode.scm (compute-instruction-arity): Add parser for new instruction word types. * module/language/cps/compile-bytecode.scm (compile-function): Add special-cased assemblers for new instructions, and also for scm->u64 and u64->scm which I missed before. * module/language/cps/effects-analysis.scm (load-f64, load-u64): New instructions. * module/language/cps/slot-allocation.scm (compute-needs-slot): load-f64 and load-u64 don't need slots. (compute-var-representations): Update for new instructions. * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Specialize scm->f64 and scm->u64 to make-f64 and make-u64. * module/language/cps/types.scm (load-f64, load-u64): Wire up to type inference, though currently type inference only runs before specialization. * module/language/cps/utils.scm (compute-defining-expressions): For some reason I don't understand, it's possible to see two definitions that are equal but not equal? here. Allow for now. (compute-constant-values): Punch through type conversions to get constant u64/f64 values. * module/system/vm/assembler.scm (assembler): Support for new word types. Export the new assemblers.
2015-12-01Add tagged and untagged arithmetic ops with immediate operandsAndy Wingo1-0/+5
* libguile/vm-engine.c (add/immediate, sub/immediate) (uadd/immediate, usub/immediate, umul/immediate): New instructions. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/slot-allocation.scm (compute-needs-slot): * module/language/cps/types.scm: * module/system/vm/assembler.scm (system): * module/language/cps/effects-analysis.scm: Support for new instructions. * module/language/cps/optimize.scm (optimize-first-order-cps): Move primcall specialization to the last step -- the only benefit of doing it earlier was easier reasoning about side effects, and we're already doing that in a more general way with (language cps types). * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Specialize add and sub to add/immediate and sub/immediate, and specialize u64 addition as well. U64 specialization doesn't work now though because computing constant values doesn't work for U64s; oh well.
2015-12-01Remove add1 and sub1Andy Wingo1-2/+0
* libguile/vm-engine.c: Remove add1 and sub1 instructions. Will replace with add/immediate and sub/immediate. * module/language/tree-il/peval.scm (peval): If we reify a new <primcall>, expand it. Removes 1- and similar primcalls. * module/language/tree-il/primitives.scm: Don't specialize (+ x 1) to 1+. (expand-primcall): New export, does a single primcall expansion. (expand-primitives): Use the new helper. * module/language/cps/effects-analysis.scm: * module/language/cps/primitives.scm: * module/language/cps/types.scm: * module/system/vm/assembler.scm: Remove support for add1 and sub1 CPS primitives. * test-suite/tests/peval.test ("partial evaluation"): Adapt tests that expect 1+/1- to expect +/-.
2015-12-01Add unsigned 64-bit arithmetic operators: uadd, usub, umulAndy Wingo1-0/+3
* libguile/vm-engine.c (uadd, usub, umul): New ops. * module/language/cps/effects-analysis.scm (uadd, usub, umul): Add effects analysis. * module/language/cps/slot-allocation.scm (compute-var-representations): The new ops define 'u64 values. * module/language/cps/types.scm (uadd, usub, umul): Add type checkers and inferrers. * module/system/vm/assembler.scm (emit-uadd, emit-usub, emit-umul): New assemblers.
2015-12-01Add instructions to branch on u64 comparisonsAndy Wingo2-1/+6
* libguile/vm-engine.c (BR_U64_ARITHMETIC): New helper. (br-if-u64-=, br-if-u64-<, br-if-u64->=): New instructions. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/language/cps/type-fold.scm: * module/language/cps/types.scm (u64-=, infer-u64-comparison-ranges): (define-u64-comparison-inferrer, u64-<, u64-<=, u64->=, u64->): * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm (code-annotation): (compute-labels): Compiler and toolchain support for the new instructions.
2015-12-01Add bv-length instructionAndy Wingo1-0/+1
* libguile/vm-engine.c (bv-length): New instruction. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm (bv-length): * module/language/cps/primitives.scm (*instruction-aliases*): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/types.scm (bv-length): * module/language/tree-il/compile-cps.scm (convert): Add support for bv-length. * module/system/vm/assembler.scm: Export emit-bv-length.
2015-12-01Remove frame->moduleAndy Wingo1-28/+1
* module/system/repl/debug.scm (frame->module): Remove. Has been broken for a while, had no callers, and was calling frame-procedure. We can revive again in a better way, like ice-9 local-eval.
2015-12-01Add low-level support for unboxed 64-bit unsigned intsAndy Wingo2-0/+2
* libguile/frames.c (enum stack_item_representation) * libguile/frames.c (scm_to_stack_item_representation): (scm_frame_local_ref, scm_frame_local_set_x): Support 'u64 slots. * libguile/frames.h (union scm_vm_stack_element): Add as_u64 member. * libguile/vm-engine.c (SP_REF_U64, SP_SET_U64): New helpers. (scm->u64, u64->scm): New instructions. * module/language/cps/cse.scm (compute-equivalent-subexpressions): Scalar replacement for u64->scm and scm->u64. * module/language/cps/effects-analysis.scm (scm->u64, u64->scm): Add cases. * module/language/cps/slot-allocation.scm (compute-var-representations): (allocate-slots): Represent the result of scm->u64 as a "u64" slot. * module/language/cps/types.scm (&u64): New type. (scm->u64, u64->scm): Add support for these ops. * module/system/vm/assembler.scm (write-arities): * module/system/vm/debug.scm (arity-definitions): Support u64 representations.
2015-12-01VM traps don't match on value of slot 0Andy Wingo1-30/+27
* module/system/vm/traps.scm (frame-matcher): Always match on a procedure's code, instead of the value in slot 0. Prevents confusion with closure-optimized procedures, re-use of slot 0, and untagged values in slot 0. (trap-at-procedure-call, trap-in-procedure) (trap-instructions-in-procedure, trap-at-procedure-ip-in-range) (trap-at-source-location, trap-in-dynamic-extent) (trap-calls-in-dynamic-extent, trap-instructions-in-dynamic-extent): Update to adapt to frame-matcher change and remove #:closure? argument, effectively changing the default behavior to #:closure? #t. * doc/ref/api-debug.texi (Low-Level Traps): Update documentation.
2015-12-01Remove `procedure' repl commandAndy Wingo1-5/+0
* doc/ref/scheme-using.texi (Debug Commands): * module/system/repl/command.scm (procedure): Remove REPL command. Since there is a closure binding and we have improved the ,registers output, this is no longer necessary and by removing it we remove another bogus use of frame-procedure.
2015-12-01,registers doesn't use frame-procedureAndy Wingo1-6/+8
* module/system/repl/debug.scm (print-registers): Avoid frame-procedure, and be more useful and print an offset in units of 4 bytes.
2015-12-01Better frame-call-representation printing of GC clobbersAndy Wingo1-2/+11
* module/system/vm/frame.scm (frame-call-representation): Assume that unspecified values are GC clobbers rather than actual arguments, and print as _.
2015-12-01frame-call-representation avoids frame-procedure.Andy Wingo1-4/+3
* module/system/vm/frame.scm (frame-call-representation): Never use frame-procedure, as we don't know that slot 0 is a SCM value and even if it were, we don't know that it corresponds to the procedure being applied, except in the case of primcalls. Print _ as the procedure name if we don't know it, instead of #f.
2015-12-01Add frame-procedure-nameAndy Wingo1-3/+23
* libguile/frames.c (frame_procedure_name_var): New static definition. (init_frame_procedure_name_var): New helper. (scm_frame_procedure_name): New function that returns the name of the frame's procedure, as frame-procedure is to be deprecated. * libguile/frames.h (scm_frame_procedure_name): Export. * module/ice-9/boot-9.scm (exception-printers): Use frame-procedure-name instead of procedure-name on frame-procedure. * module/system/vm/frame.scm (frame-procedure-name): New private function, implementing scm_frame_procedure_name. (frame-call-representation): Use frame-procedure-name to get the procedure name to print.
2015-12-01Remove primitive?, add primitive-code?Andy Wingo2-32/+27
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.
2015-12-01All arities serialize a "closure" bindingAndy Wingo2-14/+14
* module/language/cps/compile-bytecode.scm (compile-function): Always define a 'closure binding in slot 0. * module/system/vm/frame.scm (available-bindings): No need to futz around not having a closure binding. * module/system/vm/debug.scm (arity-arguments-alist): Expect a closure binding. * test-suite/tests/rtl.test: Emit definitions for the closure.