* rtl playing with modules and lambda*'s
@ 2012-12-09 21:20 Stefan Israelsson Tampe
2012-12-11 14:29 ` Nala Ginrut
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Israelsson Tampe @ 2012-12-09 21:20 UTC (permalink / raw
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 2567 bytes --]
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.
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
[-- Attachment #2: Type: text/html, Size: 2791 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: rtl playing with modules and lambda*'s
2012-12-09 21:20 rtl playing with modules and lambda*'s Stefan Israelsson Tampe
@ 2012-12-11 14:29 ` Nala Ginrut
0 siblings, 0 replies; 2+ messages in thread
From: Nala Ginrut @ 2012-12-11 14:29 UTC (permalink / raw
To: Stefan Israelsson Tampe; +Cc: guile-devel
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
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-11 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-09 21:20 rtl playing with modules and lambda*'s Stefan Israelsson Tampe
2012-12-11 14:29 ` Nala Ginrut
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).