<br><br><div class="gmail_quote">2013/6/18 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

These functions already exist:<br>
<br>
> (##object->encoding (cons 11 22))<br>
4562002011<br>
> (##encoding->object 4562002011)<br>
(11 . 22)<br>
<br>
Of course, this is unsafe...<br></blockquote><div> </div><div>Great! </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">The container_body is a pointer to the body of the copied object.  So it is the new location.</div></blockquote><div><br></div><div>Super!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="im"><br>
> (Or alternatively, how do I cancel the garbage collection, and get the ___SCMOBJ for container_body in its present location)<br>
<br>
</div>I don't think aborting a GC is safe.  *Don't do it*<br></blockquote><div><br></div><div>Ok. Considering the above there's no reason anyhow.</div><div> </div><div><br></div><div>Soo:</div><div><br></div>

<div>The equivalence printing block, I defined now as</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div><div>fprintf(stderr,"The scanned for object reference %lu was referenced to by %lu .\n",DEBUG_scanned_for_object_ref,(reference_location == IN_OBJECT) ? ((int*) container_body) : 0);</div>

</div><div><br></div></div></blockquote><div class="gmail_quote"><div>So if there's a valid object reference, it should be printed out. (The int typecast here may be a bit dirty but on this 32bit setup it should be non-destructive)</div>

<div><br></div><div>Run code:</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div><div>(define a (vector 1 2 3))</div><div><br></div><div>(define b (lambda () a)) (define c (vector a)) (define d (list a))</div>

<div><br></div><div>(define r (##object->encoding a)) r</div></div><div><br></div></div></blockquote><div class="gmail_quote"><div><br></div><div>prints 3081924705.</div><div><br></div><div>In GDB, I do</div><div><br>
</div>
</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div>set var DEBUG_scanned_for_object_ref=3081924705 </div><div>cont</div></div></blockquote><div class="gmail_quote"><div><br>
</div>
<div>and then in Gambit</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div>(##gc)</div><div><br></div></div></blockquote><div>And Gambit prints:</div><div>

<br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>The scanned for object reference 3081924705 was referenced to by 0 .</div><div>The scanned for object reference 3081924705 was referenced to by 3083239844 .</div>

<div>The scanned for object reference 3081924705 was referenced to by 3083239968 .</div></blockquote><div><br></div><div>The 0 should refer to the reference to the object from the global variable a, so that's fine.</div>

<div><br></div><div>Also, I guess we see here that the lambda refers to the global variable slot in a general way and not to this variable specifically, so therefore the lambda doesn't create an object reference.</div>

<div><br></div><div>Then to inspect the objects refering to a:</div><div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>>  (##encoding->object 3083239844)</div><div>-302931863</div>

<div>>  (##encoding->object 3083239968)</div><div>-302931832</div><div><br></div></blockquote></div><div>So something is invalid about doing what I did in the printf above, which should correspond to</div><div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>___SCMOBJ newref = (reference_location == IN_OBJECT) ? ((int*) container_body) : ___FAL;</div></blockquote><div><br></div><div>Em. The ___SCMOBJ *is* the new location, isn't it, so this should have worked - </div>

<div><br></div><div>What did I miss, how is this done correctly?</div><div><br></div><div><br></div><div><br></div><div><br></div>