From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: CPS mystery
Date: Mon, 28 May 2018 06:49:02 -0700 [thread overview]
Message-ID: <1957de6b-cd40-f20b-28a2-4fa54b25c6b6@gmail.com> (raw)
Hi All,
I'm trying to generate CPS to feed to the compiler tower.
The following program is supposed to evaluate, expressed in Scheme, `(+ 1 2)'.
That is, essentially,
scheme@(guile-user)> (apply + '(1 2))
$1 = 3
I get the error message following. Any clues what is going on?
(0 . #<cps (kfun () 0 1 9)>)
(1 . #<cps (ktail)>)
(2 . #<cps (kargs (rval) (1) (continue 1 (values 1)))>)
(3 . #<cps (kargs (arg) (4) (continue 2 (call 2 3 4)))>)
(4 . #<cps (kargs (arg) (3) (continue 3 (const 2)))>)
(5 . #<cps (kargs (arg) (2) (continue 4 (const 1)))>)
(6 . #<cps (kargs (t) (6) (continue 5 (primcall resolve 5 6)))>)
(7 . #<cps (kargs (name) (5) (continue 6 (const #t)))>)
(8 . #<cps (kargs () () (continue 7 (const +)))>)
(9 . #<cps (kclause (() () #f () #f) 8)>)
While compiling expression:
Throw to key `match-error' with args `("match" "no matching pattern"
#<cps (kargs (rval) (6) (continue 10 (primcall handle-interrupts)))>)'.
And if I fire up Guile and turn off optimization, I get this, where I don't
even see the + resolved.
scheme@(guile-user)> (define v (compile '(+ 1 2) #:from 'scheme #:to 'cps))
scheme@(guile-user)> (disp-cps v)
(0 . #<cps (kfun () 0 1 4)>)
(1 . #<cps (ktail)>)
(2 . #<cps (kargs (val) (1) (continue 1 (values 1)))>)
(3 . #<cps (kargs () () (continue 2 (const 3)))>)
(4 . #<cps (kclause (() () #f () #f) 3)>)
Matt
next reply other threads:[~2018-05-28 13:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-28 13:49 Matt Wette [this message]
2018-05-29 17:54 ` CPS mystery Mark H Weaver
2018-05-30 2:58 ` Matt Wette
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=1957de6b-cd40-f20b-28a2-4fa54b25c6b6@gmail.com \
--to=matt.wette@gmail.com \
--cc=guile-user@gnu.org \
/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).