5 Jun 2012 00:42
Re: Optimizing a simple Common Lisp Gibbs sampler program (redux) with fun GC issues
Faheem Mitha <faheem <at> faheem.info>
2012-06-04 22:42:49 GMT
2012-06-04 22:42:49 GMT
On Mon, 4 Jun 2012, Pierpaolo Bernardi wrote: > On Mon, Jun 4, 2012 at 11:11 PM, Faheem Mitha <faheem <at> faheem.info> wrote: >> 2) This code emits a bunch of compiler warnings. Let me just focus on >> one. >> >> ; note: forced to do GENERIC-* (cost 30) >> ; unable to do inline fixnum arithmetic (cost 4) because: >> ; The result is a (VALUES (MOD 288230374541099011) &OPTIONAL), not a (VALUES >> ; FIXNUM >> ; &REST >> ; T). >> ; unable to do inline (signed-byte 32) arithmetic (cost 5) because: >> ; The result is a (VALUES (MOD 288230374541099011) &OPTIONAL), not a (VALUES >> ; (SIGNED-BYTE >> ; 32) >> ; &REST >> ; T). >> ; etc. >> ; >> >> I've seen the term MOD appear in this context frequently. I've >> searched, but have not been able to find any explanation of >> this. Would someone be kind enough to explain MOD and the magic number >> 288230374541099011, and also if possible a suggestion for getting rid >> of the warning? By guess is that this reflects some kind of integer >> overflow issue, but I'm fuzzy on the details. Would some kind of range >> restriction be a solution? > This one is easy: > - go to http://www.lispworks.com/documentation/HyperSpec/Front/index.htm > - click on "Symbol Index", then "M", then "MOD", then "Type Specifier" Hi Pierpaolo, Thanks for the reply and the pointer. I missed it somehow. You didn't copy the list, which I presume was unintentional, so I'm ccing back to it. I've got into the bad habit of googling for error messages, when using other, more disorderly languages. I've come to realise that with Common Lisp, all roads lead to the Hyperspec. So I'll check there first next time I see a term I don't recognize. So, per http://www.lispworks.com/documentation/HyperSpec/Body/t_mod.htm "This denotes the set of non-negative integers less than n." So, this is saying, this product is too big for a fixnum. Really not the best notation. To anyone's mind, this suggests modulus. As regards that magic value, my guess would have been the square of the largest possible fixnum (most-positive-fixnum), which is 536870911, but in fact it is (most-positive-fixnum * ( most-positive-fixnum - 1)) + 1 = 536870911 * 536870910 + 1 = 288230374541099011L Not sure why. Hmm. I guess I could try restricting the range of i and thin, and seeing what happens. Regards, Faheem
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Sbcl-help mailing list Sbcl-help <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sbcl-help
RSS Feed