unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Nala Ginrut <nalaginrut@gmail.com>
To: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: rtl playing with modules and lambda*'s
Date: Tue, 11 Dec 2012 22:29:29 +0800	[thread overview]
Message-ID: <CAPjoZofng6_XGEwbUqE=ypC-uxRQ_CUWxkXznNiKj1rhfGbj-g@mail.gmail.com> (raw)
In-Reply-To: <CAGua6m0ec6pp1d3nOwOw4QL3mtq5gT=w1EHoCfE6j0nkiyVuOQ@mail.gmail.com>

On Mon, Dec 10, 2012 at 5:20 AM, Stefan Israelsson Tampe
<stefan.itampe@gmail.com> wrote:
> Hi all,
>
> Until wingo starts coding we can only support him by learning the current
> code base and learn what is needed in order
> to finalize that work. Also shelving out bugs by exercising the code would
> be nice. So I have this grand plan of compiling
> the whole of guile to in rtl and use the tests already made, to find the
> bugs, fix them and so on.
>

hi Stefan!
It's very nice to see your passion, and I'm dealing with an naive
AOT-compiler for Christmas hack.
I think it has to be 'naive' before our RegisterVM come to a stage to
be hacked from.
I'll do it after the colored-REPL is done.

This mail is nothing but an encouragment between us, and other guys
who's interested in. ;-)
I'll come soon, you're not alone.


> So my latest endeavor have been into
>
> 1. Making modules work
> 2. Making lambda* work
>
> To make this work one need to implement a few wrapper instructions, as
> described in the previous mail.
> Those are,
>
> (define-macro-assembler (toplevel-set asm dst val sym sm ss)
>   (let ((s (emit-non-immediate asm sym))
>         (d (emit-non-immediate asm (current-module))))
>     (emit-static-ref asm sm d)
>     (emit-static-ref asm ss s)
>     (emit-resolve asm dst sm ss)
>     (emit-box-set! asm dst val)))
>
> (define-macro-assembler (toplevel-define asm rsp val ss sym)
>   (let ((s (emit-non-immediate asm sym)))
>     (emit-static-ref asm ss s)
>     (emit-define asm rsp ss val)))
>
> (define-macro-assembler (module asm dst mod sym pred)
>   (let ((s (emit-non-immediate asm sym))
>         (m (emit-non-immediate asm (cons pred mod)))
>         (v (intern-constant asm 0 #:slot #t)))
>     (emit-module-ref asm dst v m s)))
>
> (define-macro-assembler (module-set asm dst sm mod ss sym pred v)
>   (let ((s (emit-non-immediate asm sym))
>         (m (emit-non-immediate asm mod))
>         (p (if pred 1 0)))
>     (emit-static-ref asm sm m)
>     (emit-static-ref asm ss s)
>     (emit-resolve-module asm dst ss  p)
>     (emit-resolve        asm dst dst ss)
>     (emit-box-set! asm dst v)))
>
> (define-macro-assembler (keys-opt asm nreq nopts allow-other-keys? has-rest?
> kw)
>   (let* ((nreq       nreq)
>          (iao       (if allow-other-keys? 1 0))
>          (ihr       (if has-rest?         2 0))
>          (flags     (+ iao ihr))
>          (nreq+nopt (+ nopts nreq))
>          (ntotal    (+ nreq+nopt (length kw)))
>          (kw-ref    (emit-non-immediate asm kw)))
>     (emit-bind-kwargs asm nreq flags nreq+nopt ntotal kw-ref)))
>
> As you can see the reference module operations are straightforward but the
> set! is very verbose
> and somewhat complex to use. Also the keys-opt one used to make lambda*
> works is not but a simple wrapper that
> construct the static data in order for the function to work as advertized.
>
> with this I can now compile srfi-1.scm to rtl and also the basics of modules
> also seems to be in place! cool.
>
> So the next step would be to compile srfi-1 to actual rtl-value and start
> thinking of testing the code for correctness as well.
>
> Have fun
> /Stefan
>
>
>



      reply	other threads:[~2012-12-11 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-09 21:20 rtl playing with modules and lambda*'s Stefan Israelsson Tampe
2012-12-11 14:29 ` Nala Ginrut [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPjoZofng6_XGEwbUqE=ypC-uxRQ_CUWxkXznNiKj1rhfGbj-g@mail.gmail.com' \
    --to=nalaginrut@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=stefan.itampe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).