* with-fluids bug?
@ 2010-09-26 20:44 Stefan Israelsson Tampe
2010-10-13 19:20 ` Andy Wingo
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Israelsson Tampe @ 2010-09-26 20:44 UTC (permalink / raw)
To: bug-guile
[-- 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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: with-fluids bug?
2010-09-26 20:44 with-fluids bug? Stefan Israelsson Tampe
@ 2010-10-13 19:20 ` Andy Wingo
0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2010-10-13 19:20 UTC (permalink / raw)
To: Stefan Israelsson Tampe; +Cc: bug-guile
Hi,
On Sun 26 Sep 2010 22:44, Stefan Israelsson Tampe <stefan.tampe@spray.se> writes:
> 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
Thank you for this bug report and patch :)
I have made an equivalent fix to yours, but more like the `vector'
instruction's approach to calling NULLSTACK and more uniform underflow
checking.
Thanks again!
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-13 19:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-26 20:44 with-fluids bug? Stefan Israelsson Tampe
2010-10-13 19:20 ` Andy Wingo
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).