<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Leandro,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 10, 2019 at 10:08 AM lgvidal <<a href="mailto:lgvidal@gmail.com">lgvidal@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hello!<br>
<br>
We've been working with storing some object metadata on instance variable<br>
assignments (i.e. the assigned object's class). Doing so in the "Stack VM"<br>
meant adding some code to certain primitives, we now find ourselves failing<br>
to extend this functionality to the Cog VM (StackToRegisterMappingCogit).<br>
<br>
As a proof of concept, we decided to use non-inlined C versions of the<br>
methods we defined for the Stack VM in the cogged primitives. We tried<br>
defining a new trampoline (with 3 arguments and no return) for this and then<br>
generating calls to it from the cogged primitive generators, but to no<br>
avail. <br></blockquote><div><br></div><div>Have you looked at the delivery of the #attemptToAssign:withIndex: message used to report a read-only object modification error?  his code works and has been in production in both the StackInterpreter and the Cogit for over a year now.</div><div><br></div><div>Browse references to VMBasicConstants' #IMMUTABILITY class var, e.g.</div><div><div><br></div><div>self systemNavigation browseAllCallsOn: (VMBasicConstants bindingOf: #IMMUTABILITY)</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Is this the way to go or is there an easier way to call a VM C function from<br>
a cogged primitive?<br></blockquote><div><br></div><div>This is the way to go.  But it has to be done just so :-).  Follow the scheme used for  #attemptToAssign:withIndex: and you should do OK.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
Is there any documentation on how to define and use a new trampoline?<br></blockquote><div><br></div><div>No, only the examples in the system.  Some errors should be straight-toward to fix; the various implementations of numTrampolines must compute a large enough trampoline table.  Other errors, such as failure to provide a valid continuation on returning from the "send back" may be more difficult.  I'm here to help.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Thanks in advance!<br>
Leandro<br><br>
--<br>
Sent from: <a href="http://forum.world.st/Smalltalk-VM-Beginners-f3068605.html" rel="noreferrer" target="_blank">http://forum.world.st/Smalltalk-VM-Beginners-f3068605.html</a><br>
_______________________________________________<br>
VM-beginners mailing list<br>
<a href="mailto:VM-beginners@lists.squeakfoundation.org" target="_blank">VM-beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div></div></div>