<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 22 Jun 2015, at 19:47, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com" class="">eliot.miranda@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Mon, Jun 22, 2015 at 10:40 AM, Eliot Miranda<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank" class="">eliot.miranda@gmail.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class="">Hi Esteban,<div class=""><br class=""></div><div class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>you can set up a test using the LargeInteger comparison primitives.&nbsp; They're both named and numberd. &nbsp;e.g.</div><div class=""><br class=""></div><div class="">23 primitiveLessThanLargeIntegers<br class=""></div><div class=""><br class=""></div><div class="">So you can write e.g.</div><div class=""><br class=""></div><div class=""><div class="">LargePositiveInteger&gt;&gt;#&lt; anInteger&nbsp;</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>"Primitive. Compare the receiver with the argument and answer true if</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>the receiver is less than the argument. Otherwise answer false. Fail if the</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>argument is not a SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824).</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>Optional. See Object documentation whatIsAPrimitive."</div><div class=""><br class=""></div><div class=""><span style="white-space: pre-wrap;" class="">        </span>&lt;primitive: 23&gt;</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>^super &lt; anInteger</div></div><div class=""><br class=""></div><div class="">as</div><div class=""><br class=""></div><div class=""><div class="">numberedLessThan: anInteger&nbsp;</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>"Primitive. Compare the receiver with the argument and answer true if</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>the receiver is less than the argument. Otherwise answer false. Fail if the</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>argument is not a SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824).</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>Optional. See Object documentation whatIsAPrimitive."</div><div class=""><br class=""></div><div class=""><span style="white-space: pre-wrap;" class="">        </span>&lt;primitive: 23&gt;</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>^super &lt; anInteger</div></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div><div class=""><div class="">namedLessThan: anInteger&nbsp;</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>"Primitive. Compare the receiver with the argument and answer true if</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>the receiver is less than the argument. Otherwise answer false. Fail if the</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>argument is not a SmallInteger or a LargePositiveInteger less than 2-to-the-30th (1073741824).</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>Optional. See Object documentation whatIsAPrimitive."</div><div class=""><br class=""></div><div class=""><span style="white-space: pre-wrap;" class="">        </span>&lt;primitive: 'primitiveLessThanLargeIntegers'&gt;</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>^super &lt; anInteger</div></div></div><div class=""><br class=""></div><div class="">and test it with two suitable large integers.&nbsp; Will you report back?&nbsp; I'd like to know the answer.&nbsp; Named primitive invocation should be slightly slower.&nbsp; As Clément says, a return different address is written to the stack, overwriting the primitive code, but that return path is essentially the same as for numbered primtiives.&nbsp; So I expect that there will be almost no measurable difference.</div><div class=""><br class=""></div><div class="">This is all to do with callbacks.&nbsp; Numbered primitives are assumed never to callback (so far that's a valid assumption).&nbsp; But named primitives (such as an FFI call) may indeed callback and hence, by the time the primitive finally returns the code zone may have been compacted and the original method containing the callout may have moved.&nbsp; So the VM can't simply return to a primitive that may have called back, and then have that primitive's code return form the primitive, because that codee may have moved.&nbsp; The solution is to provide a piece of code at a fixed address that returns from a named primitive call, and have the return sequence run that code.</div></div></blockquote><div class=""><br class=""></div><div class="">I should have said that numbered primitives other than 117 (primitiveExternalCall) &amp; &nbsp;120 (primitiveCalloutToFFI) are assumed never to call-back.&nbsp; In fact, the VM code in&nbsp;primitivePropertyFlagsForSpur: &amp;&nbsp;primitivePropertyFlagsForV3: won't set the required flags to tell the Cogit to substitute the return address if you use&nbsp;<span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;">primitiveCalloutWithArgs as a named primitive instead of 120 as a numbered primitive.&nbsp; So please use 120.&nbsp; Anyway, the test should demonstrate that there's no difference.</span></div><div class=""><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;"><br class=""></span></div><div class=""><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;">If you /do/ want to use&nbsp;</span><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;">primitiveCalloutWithArgs instead of 120 then&nbsp;</span>primitivePropertyFlagsForSpur: &amp;&nbsp;primitivePropertyFlagsForV3: are going to get more complicated.&nbsp; The system is currently setup for the FFP plugin to be unloaded and hence the system made secure by not shipping the FFI plugin.&nbsp; But including a reference to&nbsp;<span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;">primitiveCalloutWithArgs in the main VM needs to be done carefully to avoid having to link the FFI plugin into the VM.&nbsp; So this should be done with e.g. a&nbsp;</span></div><div class=""><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;">&nbsp; &nbsp; self cppIf: PharoVM ifTrue: ...</span></div><div class=""><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;">idiom.</span></div></div></div></blockquote><div><br class=""></div><div>I will not change anything until I actually find a reason to do it… and if I find a reason, I will discuss it here, so do not worry about.&nbsp;</div><div>Right now I’m just wondering, because I’m writing the NB to FFI backend and I’m thinking on better ways to do it… and since this is all while we wait for the new FFI implementation, most probably everything can wait…&nbsp;</div><div>but, it would be nice to actually know the numbers, instead just guessing… :)</div><div><br class=""></div><div>Esteban</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px;"><br class=""></span></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="gmail_extra"><div class=""><div class="h5"><br class=""><div class="gmail_quote">On Mon, Jun 22, 2015 at 5:13 AM, Esteban Lorenzano<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:estebanlm@gmail.com" target="_blank" class="">estebanlm@gmail.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br class="">Hi,<br class=""><br class="">Any idea how slower is? I mean, any measure/estimation/something around?<br class=""><br class="">cheers,<br class="">Esteban<br class=""><br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div></div></div><span class="HOEnZb"><font color="#888888" class="">--<span class="Apple-converted-space">&nbsp;</span><br class=""><div class="">best,<div class="">Eliot</div></div></font></span></div></blockquote></div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br clear="all" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_signature" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">best,<div class="">Eliot</div></div></div></blockquote></div><br class=""></body></html>