From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: rtl playing with modules and lambda*'s Date: Sun, 9 Dec 2012 22:20:52 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3074b1fe09cee804d07206c2 X-Trace: ger.gmane.org 1355088058 32082 80.91.229.3 (9 Dec 2012 21:20:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Dec 2012 21:20:58 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Dec 09 22:21:12 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ThoJE-0004sZ-3x for guile-devel@m.gmane.org; Sun, 09 Dec 2012 22:21:12 +0100 Original-Received: from localhost ([::1]:40284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThoJ1-0008SV-GI for guile-devel@m.gmane.org; Sun, 09 Dec 2012 16:20:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThoIw-0008SF-TN for guile-devel@gnu.org; Sun, 09 Dec 2012 16:20:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ThoIv-0001xv-Li for guile-devel@gnu.org; Sun, 09 Dec 2012 16:20:54 -0500 Original-Received: from mail-qa0-f48.google.com ([209.85.216.48]:41183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThoIv-0001xp-Gv for guile-devel@gnu.org; Sun, 09 Dec 2012 16:20:53 -0500 Original-Received: by mail-qa0-f48.google.com with SMTP id l8so1133162qaq.0 for ; Sun, 09 Dec 2012 13:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=sOKd3zIwRPfK61a96V9mSVNv2jlPzzQd1auiJEvsnuA=; b=XXc67xE9WS5arlga9GvdG9KbvBYsBRIJa1HzCQThe35riWEB5vUsRKhEm3N/VGcmLq O8Hp8RfqAgVst55YW3WPiVkQfwYETTWrD+5YAmiR30JUbkO9LWA99/U3V9jLWZFdG+7J oUBXaqwUWjyarRxZfZ02j6akG2EMWuyjTxoldT3tltBDrYR78kdZTNaMNdRxHbUMLoTp JwvC5GCcLutjoTEN9Hx/rXjqG/ZssCbd9BVWVsa3HgiOwJcJ3CkuYqL+ArGGb49WOogm UCuasgse88TrrSPEMaJvrWK6jqOcQi+XRtFiESBbH8pEpnAbMiWoywbhcSzyz9b00the Gmvg== Original-Received: by 10.224.107.3 with SMTP id z3mr23216913qao.9.1355088052997; Sun, 09 Dec 2012 13:20:52 -0800 (PST) Original-Received: by 10.49.28.135 with HTTP; Sun, 9 Dec 2012 13:20:52 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.48 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15323 Archived-At: --20cf3074b1fe09cee804d07206c2 Content-Type: text/plain; charset=ISO-8859-1 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 --20cf3074b1fe09cee804d07206c2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi all,

Until wingo starts coding we can only support him by learnin= g the current code base and learn what is needed in order
to finalize th= at 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 bu= gs, fix them and so on.

So my latest endeavor have been into

= 1. Making modules work
2. Making lambda* work

To make this work o= ne need to implement a few wrapper instructions, as described in the previo= us mail.
Those are,

(define-macro-assembler (toplevel-set asm dst val sym sm = ss)
=A0 (let ((s (emit-non-immediate asm sym))
=A0=A0=A0=A0=A0=A0=A0 = (d (emit-non-immediate asm (current-module))))
=A0=A0=A0 (emit-static-re= f asm sm d)
=A0=A0=A0 (emit-static-ref asm ss s)
=A0=A0=A0 (emit-resolve asm dst sm ss)
=A0=A0=A0 (emit-box-set! asm dst = val)))

(define-macro-assembler (toplevel-define asm rsp val ss sym)<= br>=A0 (let ((s (emit-non-immediate asm sym)))
=A0=A0=A0 (emit-static-re= f asm ss s)
=A0=A0=A0 (emit-define asm rsp ss val)))

(define-macro-assembler (module asm dst mod sym pred)
=A0 (let ((s (= emit-non-immediate asm sym))
=A0=A0=A0=A0=A0=A0=A0 (m (emit-non-immediat= e asm (cons pred mod)))
=A0=A0=A0=A0=A0=A0=A0 (v (intern-constant asm 0 = #:slot #t)))
=A0=A0=A0 (emit-module-ref asm dst v m s)))

(define-macro-assembler (module-set asm dst sm mod ss sym pred v)
= =A0 (let ((s (emit-non-immediate asm sym))
=A0=A0=A0=A0=A0=A0=A0 (m (emi= t-non-immediate asm mod))
=A0=A0=A0=A0=A0=A0=A0 (p (if pred 1 0)))
= =A0=A0=A0 (emit-static-ref asm sm m)
=A0=A0=A0 (emit-static-ref asm ss s)
=A0=A0=A0 (emit-resolve-module asm = dst ss=A0 p)
=A0=A0=A0 (emit-resolve=A0=A0=A0=A0=A0=A0=A0 asm dst dst ss= )
=A0=A0=A0 (emit-box-set! asm dst v)))

(define-macro-assembler (= keys-opt asm nreq nopts allow-other-keys? has-rest? kw)
=A0 (let* ((nreq=A0=A0=A0=A0=A0=A0 nreq)
=A0=A0=A0=A0=A0=A0=A0=A0 (iao= =A0=A0=A0=A0=A0=A0 (if allow-other-keys? 1 0))
=A0=A0=A0=A0=A0=A0=A0=A0 = (ihr=A0=A0=A0=A0=A0=A0 (if has-rest?=A0=A0=A0=A0=A0=A0=A0=A0 2 0))
=A0= =A0=A0=A0=A0=A0=A0=A0 (flags=A0=A0=A0=A0 (+ iao ihr))
=A0=A0=A0=A0=A0=A0= =A0=A0 (nreq+nopt (+ nopts nreq))
=A0=A0=A0=A0=A0=A0=A0=A0 (ntotal=A0=A0= =A0 (+ nreq+nopt (length kw)))
=A0=A0=A0=A0=A0=A0=A0=A0 (kw-ref=A0=A0=A0 (emit-non-immediate asm kw)))
= =A0=A0=A0 (emit-bind-kwargs asm nreq flags nreq+nopt ntotal kw-ref)))
As you can see the reference module operations are straightforward but th= e set! is very verbose
and somewhat complex to use. Also the keys-opt one used to make lambda* wor= ks is not but a simple wrapper that
construct the static data in order f= or the function to work as advertized.

with this I can now compile s= rfi-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 sta= rt thinking of testing the code for correctness as well.

Have fun/Stefan



--20cf3074b1fe09cee804d07206c2--