Re: CPS thoughts

2013-05-23 Thread Andy Wingo
On Thu 23 May 2013 06:05, Noah Lavine writes: > An update: I just rebased wip-rtl-cps on top of wip-rtl-may-2013 and > pushed. The most interesting thing was how trivial it was: all I had to > do was make a one-line change in how I called `begin-program'. Great, thank you! I'll take a look soon

Re: wip-linker: Refactor ELF linker and loader

2013-05-23 Thread Andy Wingo
On Wed 22 May 2013 23:13, l...@gnu.org (Ludovic Courtès) writes: > Andy Wingo skribis: > >> This is the first time I've tried git-send-email, so perhaps something >> goes wrong. In any case, the intention is to allow folks to comment >> easily on the code; we'll see how that goes. > > Thanks for

Re: [PATCH 1/6] split linker out of elf module

2013-05-23 Thread Andy Wingo
On Wed 22 May 2013 22:39, l...@gnu.org (Ludovic Courtès) writes: > Looks good. Would be nice to mention variable names too. Will do. > It seems elf.scm would benefit from byte structures similar to those > announced by Taylan on guile-user. That’s more for aesthetics though, > and definitely n

Re: [PATCH 2/6] ELF refactor and consequent linker simplifications

2013-05-23 Thread Andy Wingo
On Wed 22 May 2013 22:44, l...@gnu.org (Ludovic Courtès) writes: >> -(define (fold2 proc ls s0 s1) >> - (let lp ((ls ls) (s0 s0) (s1 s1)) >> -(if (null? ls) >> -(values s0 s1) >> -(receive (s0 s1) (proc (car ls) s0 s1) >> - (lp (cdr ls) s0 s1) >> - >> (define (fo

Re: [PATCH 2/6] ELF refactor and consequent linker simplifications

2013-05-23 Thread Ludovic Courtès
Andy Wingo skribis: > On Wed 22 May 2013 22:44, l...@gnu.org (Ludovic Courtès) writes: > >>> -(define (fold2 proc ls s0 s1) >>> - (let lp ((ls ls) (s0 s0) (s1 s1)) >>> -(if (null? ls) >>> -(values s0 s1) >>> -(receive (s0 s1) (proc (car ls) s0 s1) >>> - (lp (cdr ls)

Re: [PATCH 4/6] refactor linker to lay out ELF files and memory in the same way

2013-05-23 Thread Andy Wingo
On Wed 22 May 2013 22:56, l...@gnu.org (Ludovic Courtès) writes: > Please move the descriptions as docstrings. Done. I've added docstrings for this file in the patch that I'll push, and taken the opportunity to simplify some other things. Attaching a copy of the linker; it's easier to read as a

Re: [PATCH 5/6] refactor and simplify ELF loader in objcodes.c

2013-05-23 Thread Andy Wingo
On Wed 22 May 2013 23:06, l...@gnu.org (Ludovic Courtès) writes: >> +/* This function leaks the memory that it allocates. */ >> +static char* >> +alloc_aligned (size_t len, unsigned alignment) > > What about using posix_memalign or similar? Not present on many systems, and gnulib can't make a us

Re: [PATCH 4/6] refactor linker to lay out ELF files and memory in the same way

2013-05-23 Thread Ludovic Courtès
Andy Wingo skribis: > On Wed 22 May 2013 22:56, l...@gnu.org (Ludovic Courtès) writes: > >> Please move the descriptions as docstrings. > > Done. I've added docstrings for this file in the patch that I'll push, > and taken the opportunity to simplify some other things. Attaching a > copy of the

Add RTL VM

2013-05-23 Thread Andy Wingo
Hi, The following patchset does some refactorings to our VM, then in the last patch adds the new RTL VM alongside the old one. It's mostly finished, though you can see that some instructions can't be switched over until the corresponding stubs (subr, continuation, etc) get switched over. Please

[PATCH 01/10] inline vm-engine.h into vm-engine.c

2013-05-23 Thread Andy Wingo
* libguile/vm-engine.h: * libguile/vm-engine.c: Fold vm-engine.h into vm-engine.c. * libguile/Makefile.am: Adapt. --- libguile/Makefile.am |1 - libguile/vm-engine.c | 378 +- libguile/vm-engine.h | 403

[PATCH 03/10] minor vm-engine cleanups

2013-05-23 Thread Andy Wingo
* libguile/vm-engine.c: Some very minor cleanups: indenting, use of VM_ASSERT, commenting. --- libguile/vm-engine.c | 43 ++- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index cb92fc7..32787

[PATCH 02/10] remove CONS macro in VM; use scm_cons instead

2013-05-23 Thread Andy Wingo
* libguile/vm-engine.c (CONS): Remove. Callers should use scm_cons instead, syncing registers beforehand. (POP_LIST): Adapt, only synchronizing once. (POP_LIST_MARK, POP_CONS_MARK): Remove unused macros. * libguile/vm-i-scheme.c (cons): * libguile/vm-i-system.c (push-rest, bind-rest): Adapt

[PATCH 04/10] remove some configurability in vm-engine

2013-05-23 Thread Andy Wingo
* libguile/vm-engine.c: Remove the ability for the VM to check object access, free variable access, and the ip. They were off by default. Since they will be different in the RTL VM, their presence is just making things confusing. * libguile/vm.c: Remove corresponding error helpers. --- lib

[PATCH 05/10] vm-engine: remove register assignments

2013-05-23 Thread Andy Wingo
* libguile/vm-engine.c: Remove the register assignments inherited from the 1990s. GCC does seem to allocate reasonably on systems with enough registers (e.g. x86-64), and on system with too few (x86-32) we disabled manual allocation. Anyway this code was never tested, so it's better to le

[PATCH 06/10] Allow vm_engine caller to pass arguments on the stack.

2013-05-23 Thread Andy Wingo
* libguile/vm-engine.c (vm_engine): Allow the caller to pass arguments on the stack. --- libguile/vm-engine.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index b7e355d..77c2e46 100644 --- a/libguile/vm-engin

[PATCH 08/10] cpp hygiene in the vm

2013-05-23 Thread Andy Wingo
* libguile/vm-engine.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: CPP hygiene: the code that #defines, #undefs. Makes things cleaner given the multiple inclusion dance we do. --- libguile/vm-engine.c | 26 ++ libguile/vm-i-scheme.c | 24 ++-

[PATCH 07/10] pop-continuation abort-continuation hooks pass return vals directly

2013-05-23 Thread Andy Wingo
* doc/ref/api-debug.texi (VM Hooks): Update documentation. * libguile/vm.c (vm_dispatch_hook): * libguile/vm-engine.c: Rework the hook machinery so that they can receive an arbitrary number of arguments. The return and abort hooks will pass the values that they return to their continuations.

[PATCH 09/10] refactor to resolve_variable

2013-05-23 Thread Andy Wingo
* libguile/vm.c (resolve_variable): Slight refactor. --- libguile/vm.c | 29 + 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/libguile/vm.c b/libguile/vm.c index f80d607..cbef0d9 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -600,30 +600,27 @@ sta

Re: [PATCH 5/6] refactor and simplify ELF loader in objcodes.c

2013-05-23 Thread Ludovic Courtès
Andy Wingo skribis: > On Wed 22 May 2013 23:06, l...@gnu.org (Ludovic Courtès) writes: > >>> +/* This function leaks the memory that it allocates. */ >>> +static char* >>> +alloc_aligned (size_t len, unsigned alignment) >> >> What about using posix_memalign or similar? > > Not present on many sy

Re: [PATCH 01/10] inline vm-engine.h into vm-engine.c

2013-05-23 Thread Ludovic Courtès
Andy Wingo skribis: > * libguile/vm-engine.h: > * libguile/vm-engine.c: Fold vm-engine.h into vm-engine.c. > > * libguile/Makefile.am: Adapt. OK. > * libguile/vm-engine.c (CONS): Remove. Callers should use scm_cons > instead, syncing registers beforehand. > (POP_LIST): Adapt, only synchron

Re: [PATCH 06/10] Allow vm_engine caller to pass arguments on the stack.

2013-05-23 Thread Ludovic Courtès
Andy Wingo skribis: > * libguile/vm-engine.c (vm_engine): Allow the caller to pass arguments > on the stack. OK. > * libguile/vm-engine.c: > * libguile/vm-i-scheme.c: > * libguile/vm-i-system.c: CPP hygiene: the code that #defines, #undefs. > Makes things cleaner given the multiple inclusi

Re: [PATCH 07/10] pop-continuation abort-continuation hooks pass return vals directly

2013-05-23 Thread Ludovic Courtès
Andy Wingo skribis: > * doc/ref/api-debug.texi (VM Hooks): Update documentation. > > * libguile/vm.c (vm_dispatch_hook): > * libguile/vm-engine.c: Rework the hook machinery so that they can > receive an arbitrary number of arguments. The return and abort > hooks will pass the values that th

Re: [PATCH 09/10] refactor to resolve_variable

2013-05-23 Thread Ludovic Courtès
Andy Wingo skribis: > * libguile/vm.c (resolve_variable): Slight refactor. OK. Ludo’.