Andy Wingo [Fri, 18 Oct 2013 08:03:26 +0000 (10:03 +0200)]
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 Wingo [Fri, 18 Oct 2013 09:38:36 +0000 (11:38 +0200)]
(system vm debug): implement arity-low-pc, arity-high-pc
* module/system/vm/debug.scm (arity-low-pc, arity-high-pc): Implement
these exports.
Andy Wingo [Fri, 18 Oct 2013 07:45:53 +0000 (09:45 +0200)]
class-of fix for RTL programs
* libguile/goops.c (scm_class_of): Use the same logic for RTL programs
and stack VM programs.
Andy Wingo [Thu, 17 Oct 2013 21:25:01 +0000 (23:25 +0200)]
Stack traces skip RTL boot frames
* libguile/frames.c (frame-previous)
* libguile/stacks.c (make-stack): Skip RTL boot frames.
Andy Wingo [Thu, 17 Oct 2013 21:24:16 +0000 (23:24 +0200)]
RTL engine can apply smobs and applicable structs w/o stack VM
* libguile/vm-engine.c (rtl_vm_engine): Allow the RTL VM to handle the
dispatch for SMOBs and applicable structs.
Andy Wingo [Thu, 17 Oct 2013 21:21:29 +0000 (23:21 +0200)]
Fix subr-call
* libguile/vm-engine.c (subr-call): Fix for locals count including the
procedure.
Andy Wingo [Thu, 17 Oct 2013 21:19:57 +0000 (23:19 +0200)]
Fix tail-apply bugs
* libguile/vm-engine.c (tail-apply): Fix for old change that made
the procedure indexed 0 instead of -1.
Andy Wingo [Thu, 17 Oct 2013 21:16:32 +0000 (23:16 +0200)]
Better vm.c support for RTL programs
* libguile/vm.c (scm_c_vm_run): Directly dispatch to the RTL VM for RTL
programs.
(scm_bootstrap_vm): Initialize the RTL program stubs early, and mark
the RTL boot program with the boot flag.
Andy Wingo [Thu, 17 Oct 2013 21:14:56 +0000 (23:14 +0200)]
Procedure traps work with RTL programs.
* module/system/vm/traps.scm (frame-matcher): Work with RTL programs.
Andy Wingo [Thu, 17 Oct 2013 21:14:26 +0000 (23:14 +0200)]
minimal RTL program support in (system xref)
* module/system/xref.scm (procedure-sources*): Work with RTL programs.
Andy Wingo [Thu, 17 Oct 2013 21:13:56 +0000 (23:13 +0200)]
(system vm coverage) works with RTL programs
* module/system/vm/coverage.scm (hashq-proc, assq-proc)
(program-sources*, closed-over-procedures, coverage-data->lcov): Work
with RTl procedures.
Andy Wingo [Thu, 17 Oct 2013 21:12:23 +0000 (23:12 +0200)]
Statprof works better with RTL programs
* module/statprof.scm (get-call-data, procedure=?): Work with RTL
programs.
Andy Wingo [Mon, 14 Oct 2013 19:45:48 +0000 (21:45 +0200)]
bind-rest works in the optional-and-rest-arg case.
* libguile/vm-engine.c (bind-rest): If the sp is below the dst reg,
alloc the frame to ensure there is enough space, and to fill in
intermediate values with SCM_UNDEFINED.
Andy Wingo [Mon, 14 Oct 2013 15:32:16 +0000 (17:32 +0200)]
Refactor vm_abort
* libguile/vm.c (vm_abort):
* libguile/vm-i-system.c (abort): Refactor abort interface so that it is
more amenable to the RTL VM.
Andy Wingo [Mon, 14 Oct 2013 14:43:42 +0000 (16:43 +0200)]
Reify call-thunk/no-inline.
* module/language/cps/reify-primitives.scm (reify-primitives): Remove
call-thunk/no-inline in this late phase.
Andy Wingo [Mon, 14 Oct 2013 14:13:57 +0000 (16:13 +0200)]
RTL: Compile prompts
* libguile/vm-engine.c (prompt): Adapt to explicitly set the saved SP so
we know how many incoming values the handler will receive, and to make
escape-only? a flag.
* module/language/cps/compile-rtl.scm (emit-rtl-sequence): $prompt
should only be found in a "seq" context, as it just pushes on a prompt
and doesn't bind any values. On the other hand it should emit
appropriate code for the handler to bind its values, so do that.
* module/language/cps/slot-allocation.scm ($cont-allocation): Add a note
that proc-slot is used by prompts as well.
(allocate-slots): Compute the allocation of a prompt handler's args.
* module/language/tree-il/compile-cps.scm (convert): Use "unwind"
instead of the nonexistent "pop-prompt".
* module/system/vm/disassembler.scm (code-annotation): Adapt to change
in prompt VM op.
Andy Wingo [Mon, 14 Oct 2013 14:09:43 +0000 (16:09 +0200)]
RTL VM: receive-values has allow-extra? flag
* libguile/vm-engine.c (receive-values): Add an ALLOW-EXTRA? flag in
unused bits of the third word. Without it, receive-values will check
for the exact number of incoming values.
* libguile/vm.c (vm_error_wrong_number_of_values): New error case.
* module/language/cps/compile-rtl.scm (emit-rtl-sequence): Adapt to add
the ALLOW-EXTRA? flag.
Andy Wingo [Mon, 14 Oct 2013 14:05:45 +0000 (16:05 +0200)]
Add SCM_F_DYNSTACK_PROMPT_PUSH_NARGS prompt flag
* libguile/dynstack.h (scm_t_dynstack_prompt_flags): New flag,
SCM_F_DYNSTACK_PROMPT_PUSH_NARGS, set if the continuation expects the
number of args to be pushed on the top of the stack.
* libguile/control.c (scm_c_abort): Only push nargs if requested.
* libguile/eval.c (eval):
* libguile/throw.c (pre_init_catch):
* libguile/vm-i-system.c (prompt): Set
SCM_F_DYNSTACK_PROMPT_PUSH_NARGS.
Andy Wingo [Mon, 14 Oct 2013 10:20:58 +0000 (12:20 +0200)]
call-with-prompt always compiles to CPS $prompt
* module/language/tree-il/compile-cps.scm (convert): For prompts without
inline handlers, eta-convert the handler.
Andy Wingo [Mon, 14 Oct 2013 09:33:41 +0000 (11:33 +0200)]
Put the readline extension in the extensionsdir
* GUILE-VERSION:
* acinclude.m4:
* guile-readline/LIBGUILEREADLINE-VERSION:
* guile-readline/Makefile.am: Rename libguile-readline-v-18.so to
guile-readline.so, and install it to the extensions dir instead of the
libdir.
* guile-readline/ice-9/readline.scm: Load guile-readline instead of
libguile-readline-v-18.
Andy Wingo [Sat, 12 Oct 2013 14:36:28 +0000 (16:36 +0200)]
More precise dead-after-use? for loop variables
* module/language/cps/dfg.scm (dead-after-use?):
(dead-after-branch?): A symbol defined in the header block of a loop
is still within the same loop.
Andy Wingo [Sat, 12 Oct 2013 14:22:45 +0000 (16:22 +0200)]
RTL slot allocation: Don't kill variables that flow into loops
* module/language/cps/dfg.scm (dead-after-use?): Don't kill a variable
if it was defined outside the current loop.
(dead-after-branch?): Likewise, but I don't think this helper is
correct yet :/
Andy Wingo [Sat, 12 Oct 2013 14:11:36 +0000 (16:11 +0200)]
Compute post-dominators
* module/language/cps/dfg.scm ($block): Add pdom and pdom-level fields,
for post-dominators.
(reverse-post-order, convert-predecessors): Arrange to work either
way: for dominators or for post-dominators.
(analyze-control-flow!): Compute post-dominators.
(dominates?): Refactor.
(post-dominates?): New helper.
Andy Wingo [Sat, 12 Oct 2013 13:19:01 +0000 (15:19 +0200)]
Identify loops
* module/language/cps/dfg.scm (compute-dom-edges)
(compute-join-edges, compute-reducible-back-edges)
(compute-irreducible-dom-levels, compute-nodes-by-level)
(mark-loop-body, mark-irreducible-loops, identify-loops): Identify
loops. Irreducible loops are TODO.
* test-suite/tests/rtl-compilation.test ("contification"): Add an
irreducible loop test.
Andy Wingo [Sat, 12 Oct 2013 10:48:08 +0000 (12:48 +0200)]
DFG refactorings
* module/language/cps/dfg.scm ($block): Add "irreducible" field, format
TBD.
(reverse-post-order): Return a vector directly.
(convert-predecessors, compute-dom-levels, compute-idoms):
(analyze-control-flow!): Factor out control flow analsysis a bit
better.
(identify-loops): New helper. Currently a NOP.
(visit-fun): Adapt to compute-dominator-tree rename to
analyze-control-flow!.
Andy Wingo [Fri, 11 Oct 2013 12:10:19 +0000 (14:10 +0200)]
Replace conservatively-dominates? with a precise dominator lookup
* module/language/cps/dfg.scm (dominates?): Use the dominator tree
instead of the scope tree.
Andy Wingo [Fri, 11 Oct 2013 11:35:43 +0000 (13:35 +0200)]
Compute a dominator tree
* module/language/cps/dfg.scm (reverse-post-order, for-each/enumerate)
(convert-predecessors, finish-idoms, compute-dominator-tree): Compute
a dominator tree. We don't use it yet.
Andy Wingo [Thu, 10 Oct 2013 10:42:50 +0000 (12:42 +0200)]
DFG refactor to allow dominator tree construction
* module/language/cps/dfg.scm: Refactor so that we can think about
building a dominator tree. Split continuations out of use maps and
put them in a separate table, which will have more flow information.
(visit-fun): Mark clauses as using their bodies.
(lookup-predecessors, lookup-successors): New exports.
(find-defining-expression): Add an exception for clauses, now that
clauses are in the flow graph.
(continuation-bound-in?): Rename from variable-bound-in?, as it can
currently only be used for continuations.
* module/language/cps/contification.scm (contify): Adapt to use
lookup-predecessors and continuation-bound-in?.
Andy Wingo [Thu, 10 Oct 2013 10:21:55 +0000 (12:21 +0200)]
A couple of fixes when no source info is available
* module/system/vm/assembler.scm (link-debug): If there was no debugging
info, reset the file register to 0 from its default value of 1 before
adding the final row.
* module/system/vm/dwarf.scm (line-prog-scan-to-pc): If we rescanned
from the beginning and still found no source info for this pc, return
#f instead of the default value of the file register (1).
Andy Wingo [Thu, 10 Oct 2013 09:19:02 +0000 (11:19 +0200)]
Fix peval bug with inlining and optional argument initializers
* module/language/tree-il/peval.scm (peval): Fix a bug whereby inlined
function applications with default argument initializers were putting
the initializers in the wrong scope.
* test-suite/tests/peval.test ("partial evaluation"): Add a test.
Andy Wingo [Sat, 5 Oct 2013 13:57:54 +0000 (15:57 +0200)]
Fix slot allocation bug
* module/language/cps/slot-allocation.scm (allocate-slots): Fix
dead-after-use computation to use the expression's label and not its
continuation.
Andy Wingo [Fri, 4 Oct 2013 17:55:12 +0000 (19:55 +0200)]
better RTL debugging
* libguile/frames.c (scm_frame_source, scm_frame_instruction_pointer):
Fix to work with RTL programs.
* module/system/vm/debug.scm (find-debug-context): Allow for the
possibility of there being no ELF image.
(find-program-debug-info, find-program-arities)
(program-minimum-arity, find-program-docstring)
(find-program-properties, find-source-for-addr)
(find-program-die, find-program-sources): Don't bail if we couldn't
get the debug context.
* module/system/vm/frame.scm (frame-next-source)
(frame-call-representation): Allow RTL programs.
* module/system/vm/program.scm (program-arguments-alist): Placeholder
implementation for RTL programs.
(program-arguments-alists): Don't bail if we couldn't get the
arities.
Andy Wingo [Fri, 4 Oct 2013 16:03:29 +0000 (18:03 +0200)]
Fix nested contification bugs
* module/language/cps/contification.scm (contify): Exhaustively replace
contified tail continuations, to fix a bug in nested tail-recursive
contifications. Likewise, call lookup-return-cont when searching for
common return continuations.
Andy Wingo [Fri, 4 Oct 2013 15:30:59 +0000 (17:30 +0200)]
Fix variable-bound-in?
* module/language/cps/dfg.scm (variable-bound-in?): Fix to look up
correct variable.
Andy Wingo [Fri, 4 Oct 2013 14:36:17 +0000 (16:36 +0200)]
Fix verify-cps
* module/language/cps/verify.scm (verify-cps): Fix visiting functions.
Andy Wingo [Fri, 4 Oct 2013 13:28:40 +0000 (15:28 +0200)]
Disassembling RTL prints source information.
* module/system/vm/disassembler.scm (disassemble-buffer): Print source
information.
Andy Wingo [Fri, 4 Oct 2013 13:09:31 +0000 (15:09 +0200)]
add contification test
* test-suite/tests/rtl-compilation.test ("contification"): Add
contification test where non-recursive call is not in tail position
relative to the letrec.
Andy Wingo [Fri, 4 Oct 2013 12:08:52 +0000 (14:08 +0200)]
Contify functions in the scope of their continuation.
* module/language/cps/contification.scm (contify): Fix to contify
functions in the scope of their continuation.
Andy Wingo [Fri, 4 Oct 2013 08:47:55 +0000 (10:47 +0200)]
dfg: variable-free-in?, add variable-bound-in?
* module/language/cps/dfg.scm (variable-free-in?): Rename from
variable-used-in?, to match CWCC language.
(variable-bound-in?): New interface.
* module/language/cps/contification.scm (contify): Adapt caller. Add
more comments.
Andy Wingo [Thu, 3 Oct 2013 20:48:17 +0000 (22:48 +0200)]
anonymous RTl functions print with source info
* module/system/vm/debug.scm (find-program-sources): If there is no
source location before the low-pc of the procedure we're grovelling
for, we were skipping the source loc info. Fix that.
* module/system/vm/program.scm (write-program): Get source info for
anonymous RTL functions.
(program-sources, program-sources-pre-retire): Provide program
counters relative to the beginning of the procedure.
Andy Wingo [Thu, 3 Oct 2013 20:31:37 +0000 (22:31 +0200)]
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 Wingo [Thu, 3 Oct 2013 19:35:21 +0000 (21:35 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
libguile/deprecated.h
libguile/programs.c
libguile/programs.h
Andy Wingo [Thu, 3 Oct 2013 17:45:41 +0000 (19:45 +0200)]
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.
Mark H Weaver [Thu, 3 Oct 2013 18:25:51 +0000 (14:25 -0400)]
Fix edge case in 'ash'.
* libguile/numbers.c (scm_ash): Fix (ash -1 SCM_I_FIXNUM_BIT-1) to
return a fixnum instead of a bignum.
* test-suite/tests/numbers.test (ash): Add tests.
Andy Wingo [Thu, 3 Oct 2013 14:13:56 +0000 (16:13 +0200)]
Add source location test
* test-suite/tests/dwarf.test: New test, testing that source location
information survives the round-trip through the compiler, back out to
the (system vm debug) interfaces.
Andy Wingo [Thu, 3 Oct 2013 12:44:30 +0000 (14:44 +0200)]
Add (system vm debug) interface to source location information
* module/system/vm/debug.scm (<source>, source-pre-pc)
(source-post-pc, source-file, source-line, source-column)
(source-line-for-user): New data type for source location
information.
(find-source-for-addr, find-program-sources): New procedures to get
source location information for a particular address.
Andy Wingo [Thu, 3 Oct 2013 12:42:49 +0000 (14:42 +0200)]
Add interface to read .debug_line data
* module/system/vm/dwarf.scm (die-line-prog):
(line-prog-advance, line-prog-scan-to-pc): New public interfaces,
allowing clients to interpret the "statement programs" from
.debug_line DWARF sections.
(<meta>, elf->dwarf-context): Record the bounds of the .debug_line
section.
Andy Wingo [Wed, 2 Oct 2013 19:34:38 +0000 (21:34 +0200)]
Serialize source positions into .debug_line
* module/system/vm/assembler.scm (link-debug): Generate a correct DWARF2
line program. Tests come next.
Andy Wingo [Mon, 30 Sep 2013 19:49:12 +0000 (21:49 +0200)]
Emit a placeholder .debug_line section.
* module/system/vm/assembler.scm (link-debug): Emit a .debug_line
section also.
(link-objects): Expect .debug_line.
Andy Wingo [Mon, 30 Sep 2013 19:48:07 +0000 (21:48 +0200)]
Add new "source" macro instruction; compile-rtl emits it.
* module/system/vm/assembler.scm (<asm>): Add "sources" field.
(make-assembler): Adapt to make-asm change.
(source): New macro assembler.
* module/language/cps/compile-rtl.scm (emit-rtl-sequence):
(compile-fun): Emit source instructions as appropriate.
Mark H Weaver [Mon, 30 Sep 2013 16:46:01 +0000 (12:46 -0400)]
Fix minor mistakes in documentation.
Fixes <http://bugs.gnu.org/15487>.
Reported by Josep Portella Florit <jpf@primfilat.com>.
* doc/ref/api-i18n.texi (i18n Introduction, Text Collation,
Internationalization, Internationalization):
LC_MESSAGE --> LC_MESSAGES.
* doc/ref/api-procedures.texi (Compiled Procedures):
program-lambda-alist --> program-lambda-list.
* THANKS: Fix alignment of Josep Portella Florit.
Andy Wingo [Sat, 28 Sep 2013 16:15:44 +0000 (18:15 +0200)]
DWARF linker: encode strings using the correct form
* module/system/vm/assembler.scm (link-debug): Encode strings using the
strp form.
Andy Wingo [Sat, 28 Sep 2013 12:50:48 +0000 (14:50 +0200)]
Emit minimal DWARF information
* module/system/vm/assembler.scm (link-debug): New function, creates the
necessary DWARF debugging sections.
(link-objects): Emit debugging sections.
Andy Wingo [Sat, 9 Jun 2012 16:26:27 +0000 (18:26 +0200)]
add DWARF parser
* module/Makefile.am:
* module/system/vm/dwarf.scm: New module, a DWARF parser.
Mark H Weaver [Fri, 13 Sep 2013 04:24:04 +0000 (00:24 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
module/srfi/srfi-9.scm
module/web/server.scm
Mark H Weaver [Fri, 13 Sep 2013 03:58:32 +0000 (23:58 -0400)]
Fix truncated documentation for 'put-char'.
Fixes <http://bugs.gnu.org/15152>.
Reported by Josep Portella Florit <jpf@primfilat.com>.
* doc/ref/api-io.texi (R6RS Textual Output): Fix truncated docs
for 'put-char'.
* THANKS: Add Josep Portella Florit to fixes section.
Mark H Weaver [Thu, 12 Sep 2013 22:45:13 +0000 (18:45 -0400)]
Web: Use functional setters in extend-request and extend-response.
* module/web/client.scm (extend-request):
* module/web/server.scm (extend-response): Reimplement using
functional setters.
Mark H Weaver [Thu, 12 Sep 2013 22:34:39 +0000 (18:34 -0400)]
Web client+server: Add Content-Length header for empty bodies.
* module/web/client.scm (sanitize-request): Add a Content-Length
header if a body if given, even if the body is empty.
* module/web/server.scm (sanitize-response): Add a Content-Length
header if a body if given, even if the body is empty.
Mark H Weaver [Thu, 12 Sep 2013 22:14:54 +0000 (18:14 -0400)]
Adapt srfi-9.test to error reporting improvements; update copyright dates.
* module/srfi/srfi-9.scm: Add 2013 copyright date.
* test-suite/tests/srfi-9.test: Adapt to recent error reporting
improvements to procedures defined by 'define-tagged-inlinable'.
Mark H Weaver [Thu, 12 Sep 2013 22:04:08 +0000 (18:04 -0400)]
Improve error reporting of procedures defined by define-inlinable.
* module/ice-9/boot-9.scm (define-inlinable): Improve error reporting
when procedures defined using 'define-inlinable' are applied to the
wrong number of arguments.
* module/srfi/srfi-9.scm (define-tagged-inlinable): Improve error
reporting when procedures defined using 'define-tagged-inlinable' are
applied to the wrong number of arguments.
Mark H Weaver [Tue, 10 Sep 2013 06:05:26 +0000 (02:05 -0400)]
THANKS Alexandru Cojocaru
* THANKS: Add Alexandru Cojocaru to fixes section.
Mark H Weaver [Tue, 10 Sep 2013 05:39:52 +0000 (01:39 -0400)]
web client: HTTP methods are symbols, not strings.
* module/web/client.scm (request, http-get, http-head, http-post,
http-put, http-delete, http-trace, http-options): HTTP methods are
symbols.
Alexandru Cojocaru [Tue, 27 Aug 2013 13:59:39 +0000 (15:59 +0200)]
Fix extend-request to preserve method and meta.
* module/web/client.scm (extend-request): Preserve method and meta.
Mark H Weaver [Tue, 10 Sep 2013 02:42:36 +0000 (22:42 -0400)]
psyntax: cite the paper that psyntax is based on.
* module/ice-9/psyntax.scm: cite the paper.
Mark H Weaver [Tue, 10 Sep 2013 02:20:09 +0000 (22:20 -0400)]
Minor stylistic improvement to 'and-let*' macro.
* module/ice-9/and-let-star.scm (%and-let*): Use 'and' instead of
'if'. Suggested by Chris K. Jester-Young <cky944@gmail.com>.
Mark H Weaver [Mon, 9 Sep 2013 23:37:49 +0000 (19:37 -0400)]
Rewrite SRFI-2 'and-let*' using syntax-case.
* module/ice-9/and-let-star.scm (%and-let*): Helper macro.
(and-let*): Reimplement using syntax-case.
Andy Wingo [Sat, 31 Aug 2013 09:15:01 +0000 (11:15 +0200)]
Micro-optimize char_decimal_value.
* libguile/numbers.c (char_decimal_value): A wee micro-optimization.
Andy Wingo [Sat, 31 Aug 2013 08:57:11 +0000 (10:57 +0200)]
Faster scm_from_port_stringn
* libguile/strings.c (scm_from_port_stringn): Always inline to
scm_from_utf8_string if the byte sequence is valid utf-8.
Andy Wingo [Sat, 31 Aug 2013 08:44:07 +0000 (10:44 +0200)]
unread-char: inline conversion from codepoint to bytes
* libguile/ports.c (scm_ungetc_unlocked): Inline the conversion from
codepoint to bytes for UTF-8 and latin-1 ports. Speeds up a
numbers-reading test case by 100% (!).
Andy Wingo [Sat, 24 Aug 2013 13:02:57 +0000 (15:02 +0200)]
Add contification pass
* module/Makefile.am:
* module/language/cps/contification.scm: New pass.
* module/language/cps/compile-rtl.scm (optimize): Wire it into the
compiler.
Andy Wingo [Sun, 11 Aug 2013 12:08:08 +0000 (14:08 +0200)]
Add CPS -> RTL compiler
* module/Makefile.am:
* module/language/cps/compile-rtl.scm:
* module/language/cps/dfg.scm:
* module/language/cps/slot-allocation.scm: New modules.
* module/language/cps/spec.scm: Register the compiler.
* test-suite/Makefile.am:
* test-suite/tests/rtl-compilation.test: Add tests.
Andy Wingo [Sat, 24 Aug 2013 13:02:52 +0000 (15:02 +0200)]
Add pass to reify primcalls without corresponding VM ops
* module/Makefile.am:
* module/language/cps/reify-primitives.scm: New pass.
Andy Wingo [Thu, 18 Jul 2013 18:02:13 +0000 (20:02 +0200)]
Add arity-adapting module
* module/Makefile.am:
* module/language/cps/arities.scm: New module. Adapts call and return
arities, especially for primcalls.
Andy Wingo [Sat, 24 Aug 2013 13:02:38 +0000 (15:02 +0200)]
Add CPS primitives info module
* module/Makefile.am:
* module/language/cps/primitives.scm: New file.
Andy Wingo [Sun, 11 Aug 2013 12:06:15 +0000 (14:06 +0200)]
RTL language
* module/Makefile.am
* module/language/rtl.scm:
* module/language/rtl/spec.scm: Add a stub RTL language.
Andy Wingo [Tue, 23 Jul 2013 14:05:48 +0000 (16:05 +0200)]
Add closure conversion
* module/Makefile.am
* module/language/cps/closure-conversion.scm: New module, implementing a
closure conversion pass.
Andy Wingo [Tue, 23 Jul 2013 14:04:51 +0000 (16:04 +0200)]
(compile foo #:to 'cps)
* module/language/tree-il/compile-cps.scm: New module implementing CPS
conversion of Tree-IL.
* module/Makefile.am:
* module/language/tree-il/spec.scm:
* module/language/cps/spec.scm: Integrate CPS in the build and language
system.
Andy Wingo [Tue, 23 Jul 2013 13:51:35 +0000 (15:51 +0200)]
Add CPS language
* module/Makefile.am:
* module/language/cps.scm:
* module/language/cps/verify.scm: Add CPS language.
* .dir-locals.el: Add indentation rules for some CPS forms.
Andy Wingo [Thu, 29 Aug 2013 18:50:19 +0000 (20:50 +0200)]
,xx for RTL images
* module/scripts/disassemble.scm (disassemble):
* module/system/vm/disassembler.scm (disassemble-file): Factor
disassemble-file out.
* module/system/repl/command.scm (disassemble-file): Map ,xx to
disassemble RTL images.
Andy Wingo [Thu, 29 Aug 2013 18:43:03 +0000 (20:43 +0200)]
add ability to disassemble ELF images
* module/scripts/disassemble.scm (disassemble): Update to work with
RTl (and only RTL, as that's the future).
* module/system/vm/debug.scm (for-each-elf-symbol): New public
interface.
(debug-context-from-image): New helper.
(find-debug-context): Use the helper.
* module/system/vm/disassembler.scm (disassemble-image): New public
interface.
Andy Wingo [Sat, 24 Aug 2013 10:38:02 +0000 (12:38 +0200)]
Export the assembler procedures
* module/system/vm/assembler.scm (define-assembler):
(define-macro-assembler): Export the assemblers.
Andy Wingo [Sat, 24 Aug 2013 09:34:56 +0000 (11:34 +0200)]
rtl vm: box-set! binds no values
* libguile/vm-engine.c (box-set!): Remove the OP_DST flag.
Andy Wingo [Mon, 12 Aug 2013 19:41:23 +0000 (21:41 +0200)]
RA == MVRA in disassembler
* module/system/vm/disassembler.scm: Modify call disassembler to assume
RA == MVRA.
Andy Wingo [Tue, 20 Aug 2013 20:08:25 +0000 (22:08 +0200)]
assembler: give proper permissions to .data section
* module/system/vm/assembler.scm (link-data): Give stringbufs the
"shared" flag already, so we don't attempt to set it at runtime. Give
.data sections the SHF_WRITE flag.
Andy Wingo [Tue, 20 Aug 2013 20:06:46 +0000 (22:06 +0200)]
compile-file adds #:to-disk? #t to opts
* module/system/base/compile.scm (compile-file): Pass #:to-disk? as an
option to indicate that the result will be being loaded from disk.
Perhaps a linker might want to page-align in that case.
* module/language/elisp/compile-tree-il.scm (process-options!): Accept
and ignore the #:to-file compiler option.
Mark H Weaver [Sat, 17 Aug 2013 10:38:53 +0000 (06:38 -0400)]
RTL: 'return-values' instruction assumes 'reset-frame' has been called.
* libguile/vm-engine.c (return-values): Remove NVALUES operand.
Don't reset the frame.
* test-suite/tests/rtl.test ("cached-toplevel-set!"): Adapt to the fact
that 'return-values' has no operand now, and that 'reset-frame' must
be done first.
Mark H Weaver [Sat, 17 Aug 2013 09:37:45 +0000 (05:37 -0400)]
RTL VM: Rename 'apply' instruction to 'tail-apply'.
* libguile/vm-engine.c (apply, tail-apply): apply -> tail-apply.
(RETURN_VALUE_LIST): goto op_apply -> goto op_tail_apply.
* libguile/vm.c (rtl_apply_code): scm_rtl_op_apply ->
scm_rtl_op_tail_apply.
Mark H Weaver [Fri, 16 Aug 2013 01:58:41 +0000 (21:58 -0400)]
RTL VM: fix multiple value returns.
* libguile/vm-engine.c (halt): Fix off-by-one error in retrieving
multiple values from the frame.
Mark H Weaver [Tue, 13 Aug 2013 13:03:23 +0000 (09:03 -0400)]
Convert branchable primitives into binary operations only.
* module/language/tree-il/primitives.scm (maybe-simplify-to-eq): Wrap
within another lambda, binding the primitive name. If there are less
than two arguments, expand to constant #t. If there are more than two
arguments, convert into a conjunction of binary applications.
(expand-chained-comparisons): New procedure.
(*primitive-expand-table*): Add entries for (< <= = >= > eq?).
Mark H Weaver [Sat, 24 Aug 2013 02:36:02 +0000 (22:36 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Fri, 23 Aug 2013 05:57:50 +0000 (01:57 -0400)]
Fix 'define-public' from (ice-9 curried-definitions).
* module/ice-9/curried-definitions.scm (cdefine, cdefine*): Simplify,
and improve error reporting by making the patterns more strict.
(define-public): Fix bug in generated 'export' form.
Mark H Weaver [Mon, 19 Aug 2013 23:30:42 +0000 (19:30 -0400)]
Improve error checking in 'define-public' and 'module-add!'.
* module/ice-9/boot-9.scm (module-add!): Check that the symbol argument
is actually a symbol.
(define-public): Expand into 'define' in such a way that curried
definitions will immediately fail.
Ian Price [Mon, 19 Aug 2013 21:25:41 +0000 (22:25 +0100)]
doc: `get-string-all' takes only one argument.
* doc/ref/api-io.texi (R6RS Textual Input): Remove `count' argument.
Ian Price [Mon, 19 Aug 2013 02:43:48 +0000 (03:43 +0100)]
`write-request-line' always prints a path component.
* module/web/http.scm (write-request-line): Always write "/" when path
is empty, regardless of query.
* test-suite/tests/web-http.test ("write-request-line"): Add test.
Mark H Weaver [Sat, 17 Aug 2013 03:10:14 +0000 (23:10 -0400)]
In bytevector->uint-list et al, check that SIZE divides the bv length.
Fixes <http://bugs.gnu.org/15100>.
Reported by Göran Weinholt <goran@weinholt.se>.
* libguile/bytevectors.c (INTEGERS_TO_LIST): Enforce the R6RS
requirement that SIZE divides the bytevector length.
* test-suite/tests/bytevectors.test: Add test. Remove tests that
assumes that this "divides" check is not enforced.
Mark H Weaver [Sat, 17 Aug 2013 03:05:34 +0000 (23:05 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Sat, 17 Aug 2013 02:54:39 +0000 (22:54 -0400)]
Improved error checking in bytevector->uint-list and bytevector->sint-list.
Partially fixes <http://bugs.gnu.org/15100>.
Reported by Göran Weinholt <goran@weinholt.se>.
* libguile/bytevectors.c (INTEGERS_TO_LIST): Make sure SIZE isn't 0.
Allow SIZE to be greater than the bytevector length, for consistency
with allowing extra bytes at the end when the bytevector length is
non-zero. Use scm_from_size_t instead of scm_from_uint.
* test-suite/tests/bytevectors.test: Add tests. Remove a test that
checks for an exception when SIZE is greater than the bytevector
length.
Mark H Weaver [Thu, 15 Aug 2013 08:09:04 +0000 (04:09 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Thu, 15 Aug 2013 07:59:15 +0000 (03:59 -0400)]
Improve run-time error reporting in (ice-9 match).
* module/Makefile.am: match.go depends on match.upstream.scm.
* module/ice-9/match.scm (error): Accept any number of arguments.
* module/ice-9/match.upstream.scm (match-next): Call 'error' in non-tail
context, and include the value that failed to match in the call.
Mark H Weaver [Wed, 14 Aug 2013 03:34:32 +0000 (23:34 -0400)]
Adapt peval.test to recent associativity fixes of numeric ops.
* test-suite/tests/peval.test ("partial evaluation"): Adapt tests to the
fact that arithmetic operators are now expanded into binary ops with
left-to-right associativity.