<div class="gmail_quote">On Fri, Dec 9, 2011 at 4:04 PM, James Wright <span dir="ltr"><<a href="mailto:james@chumsley.org">james@chumsley.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<br>
<br>
I have encountered the following problem a couple of times before,<br>
although not as reproducibly as the memory corruption issue from my<br>
previous message:  If I use the #m reader macro in a function<br>
somewhere, dump an SBCL core image, load the image, and call the<br>
function, I get memory corruption.  I have mostly dealt with it up<br>
until now by not using the #m() notation in anything that I plan to<br>
dump to a binary.<br></blockquote><div><br>This is odd.  There is a make-load-form for foreign-arrays, so I assumed this would work.  Example?<br></div><div><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


I believe that the cause is that the #m macro returns a foreign-array<br>
object directly (when foreign-array is the default grid type).  If it<br>
returned a `make-grid' form instead, it would operate identically on<br>
e.g. the REPL.  It would have the advantage, however, of being usable<br>
in a dumped image, since the array would be created at run-time<br>
instead of at read-time, and hence no foreign-pointers would be saved<br>
into the image.<br></blockquote><div><br>My intent is that it be analogous to #, e.g. #(1.0d0 2.0d0) expands to a (CL) array.  I used to have it the way you want but I changed it as of 3e610bd4d5261 to be analogous to the regular array macro (in fact, #m should make a CL array if grid:*default-grid-type* is set accordingly; I'm still not sure about the wisdom of doing that).  I had a good reason for changing it, but I can't recall exactly what it was.  Something was not working right is all I recall.<br>

<br>By the way, do you know about grid:grid?  Maybe that's what you want.  It's a function, so it evaluates its arguments<br>(grid:grid pi pi pi)<br>#m(3.141592653589793d0 3.141592653589793d0 3.141592653589793d0)<br>

<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
I've attached a patch that changes the #m reader macro to return a<br>
creation form instead of a literal.  I hope you'll consider adding it.<br>
 I've pasted a repl session below that demonstrates the difference.<br></blockquote><div><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


Thanks,<br>
      James<br></blockquote><div><br>I think I'd like to figure out why #m can't be saved before I consider changing this back.  <br><br>Liam<br> <br></div></div>