<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix"><tt>On 04/24/2013 01:33 PM, Mikael
wrote:</tt><tt><br>
</tt></div>
<blockquote
cite="mid:CACbx-M9RFkC-4OmtEUm5iJ6o8Ke9LH1JovngzO3f=p1q6h04+w@mail.gmail.com"
type="cite"><tt>Hi Brad!</tt><tt><br>
</tt><tt><br>
</tt>
<div class="gmail_quote"><tt>2013/4/24 Bradley Lucier </tt><tt><span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:lucier@math.purdue.edu" target="_blank">lucier@math.purdue.edu</a>></span></tt><tt><br>
</tt>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><tt>On 04/24/2013 12:37 PM, Zhen Shen wrote:</tt></div>
</blockquote>
<div><tt><br>
</tt></div>
<div><tt>[...]</tt></div>
<div><tt> </tt></div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><tt>
> Now, doing (declare (flonum)) at the top level, does
this stop gambit</tt><tt><br>
</tt><tt>
> from boxing flonums across function calls?</tt><tt><br>
</tt>
<tt><br>
</tt>
</div>
<tt>No. Gambit keeps flonums unboxed inside a basic block,
whenever there's</tt><tt><br>
</tt><tt>
a jump (or the possibility of a jump), Gambit boxes up all
the</tt><tt><br>
</tt><tt>
still-needed flonums.</tt><tt><br>
</tt></blockquote>
<div><tt><br>
</tt></div>
<div><tt>What about fixnums, would they remain unboxed in a
loop?</tt></div>
</div>
</blockquote>
<tt><br>
</tt><tt>Yes. Fixnums are always "immediate" (not boxed) values.</tt><tt><br>
</tt><tt><br>
</tt>
<blockquote
cite="mid:CACbx-M9RFkC-4OmtEUm5iJ6o8Ke9LH1JovngzO3f=p1q6h04+w@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div><tt><br>
</tt></div>
<div><tt>Also btw, are there any tricks that can be applied to
make it keep flonums and fixnums unboxed in loops, like,
(declare (not interrupts-enabled)) or (not safe)?</tt><tt><br>
</tt></div>
</div>
</blockquote>
<tt><br>
</tt><tt>Use (declare (not safe)) and flonum-specific operations to
keep flonums unboxed in a basic block. There's no way to keep
them unboxed across jumps.</tt><tt> (With generic operations,
flonums are boxed even in a basic block.)<br>
</tt><tt><br>
</tt><tt>Or, you can use an f64vector as an explicit "box" for your
flonum and write monstrous code like this.</tt><tt><br>
</tt><tt><br>
</tt><tt>(define (Array-sum a)</tt><tt><br>
</tt><tt> (f64vector-ref (Array-reduce (lambda (result y)</tt><tt><br>
</tt><tt> (f64vector-set! result 0
(fl+ (f64vector-ref result 0) y))</tt><tt><br>
</tt><tt> result)</tt><tt><br>
</tt><tt> (f64vector 0.)</tt><tt><br>
</tt><tt> a)</tt><tt><br>
</tt><tt> 0))</tt><tt><br>
<br>
Brad<br>
</tt>
</body>
</html>