unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.tampe@spray.se>
To: bug-guile@gnu.org
Subject: with-fluids bug?
Date: Sun, 26 Sep 2010 22:44:31 +0200	[thread overview]
Message-ID: <201009262244.32030.stefan.tampe@spray.se> (raw)

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

Hi,

Here follows an issue with resent head and a potential first start
of a solution.

Problem:
(define a (make-fluid))
(with-fluids ((a 1)) 2)  ; returns 2
(pk (with-fluids ((a 1)) 2)) ; barfs at trying to execute function 1

The issue:
the wind-fluids instruction reads previouslyu pushed fluids and vals
and set their value acordingly. But does just do a read and no pop!
by simply adding sp -= 2*n, the code above works fine. 

Now, I'm not an expert at coding vm-instruction, there might be more to
say here but a patch follows this mail.

Regards
Stefan


[-- Attachment #2: with-dynwind-vm.patch --]
[-- Type: text/x-patch, Size: 426 bytes --]

diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index 05c632c..1c5cafb 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -1582,6 +1582,7 @@ VM_DEFINE_INSTRUCTION (90, wind_fluids, "wind-fluids", 1, -1, 0)
   wf = scm_i_make_with_fluids (n, sp + 1 - 2*n, sp + 1 - n);
   scm_i_swap_with_fluids (wf, dynstate);
   scm_i_set_dynwinds (scm_cons (wf, scm_i_dynwinds ()));
+  sp -= 2*n;
   NEXT;
 }
 

             reply	other threads:[~2010-09-26 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-26 20:44 Stefan Israelsson Tampe [this message]
2010-10-13 19:20 ` with-fluids bug? Andy Wingo

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=201009262244.32030.stefan.tampe@spray.se \
    --to=stefan.tampe@spray.se \
    --cc=bug-guile@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).