Sorry to reply to Steph&#39;s reply to Tim&#39;s original. &nbsp;I didn&#39;t get the original (because I had Anouncements checked by mistake inj my squeak-dev mail settings). &nbsp;I&#39;m really replying to Tim&#39;s message here.<br>
<br><div class="gmail_quote">On Tue, Jul 1, 2008 at 9:27 AM, stephane ducasse &lt;<a href="mailto:stephane.ducasse@free.fr">stephane.ducasse@free.fr</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
<br>
It&#39;s just a prim, ie a function somewhere.<br>
<br>
I&#39;m proposing that we name all those prims that are currently numbered - primitive 1 would become &quot;primitiveAdd&quot; in a similar manner to say &quot;primitiveDisablePowerManager&quot;. &nbsp;This would allow all prims to be built as plugin components, thereby allowing on the fly replacement of those plugins (making due allowance for handling retained state etc, of course). (It&#39;s sometihng I&#39;ve been wanting to see done since 1988; I had discussions with Alan Schiffman &amp; Peter Deutsch about it way before I even move to ParcPlace). We would lose the primitive table, saving a 8 kb or so. Oh and the *really* obsoleteIndexPrimitiveTable, saving another 8Kb or so.</blockquote>
</blockquote><div><br></div><div>Gettng rid of both obsolete tables is a really good thing (and I&#39;ve already done it).</div><div><br></div><div>Getting rid of indexed primitives for the core does not save anything. &nbsp;There still has to be a table somewhere that maps the primitive name to the primitive function. &nbsp;All you do is replace a table mapping indices to functions with one mapping strings to functions. You can&#39;t reply on the OS to do the lookup because you won&#39;t be able to strip VM executables if you do and that really costs space.</div>
<div><br></div><div>But more importantly I think its pointless. &nbsp;The bulk of primitives in the system are named, and they&#39;re in plugins and that all works fine, even though lookup is a little involved and slow. &nbsp;But I see nothing wrong with the core language primitives being indexed. &nbsp;They are pretty well fixed with unchanged semantics and unchanged references in the system (e.g. SmallInteger&gt;&gt;#+ is where you find &lt;primitive: 1&gt; and has always been where you find it). &nbsp;The table is quick to index and simple.</div>
<div><br></div><div>That said I think its worth cutting down the set of indexed primitives to a minimum:</div><div><br></div><div>Object primtives (class, ==, ~~, become:&nbsp;</div><div>Control primitives (blocks, perform, executeMethod, findUnwind, terminateTo)</div>
<div>Process primitives (signal, wait, resume, suspend, yield)</div><div>Accessing primitives (at:, at:put:, size, instVarAt:, instVarAt:put:)</div><div>Instantiation primitives (new, new:, shallowCopy)</div><div>SmallInteger primitives, Float primitives, LargeInteger primitives (although LargeInteger prims are arguable)</div>
<div>Mirror primitives (_object:instVarAt:, _objectClass: etc which the executuon simulation machinery needs to use instead of instVarAt: &amp; class etc to be able to simulate proxy execution correctly)</div><div><br></div>
<div>Primitives that absolutely should not be indexed primitives include things like</div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(90&nbsp;primitiveMousePoint)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(91 primitiveTestDisplayDepth)<span class="Apple-tab-span" style="white-space:pre">                        </span>&quot;Blue Book: primitiveCursorLocPut&quot;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(92 primitiveSetDisplayMode)<span class="Apple-tab-span" style="white-space:pre">                                </span>&quot;Blue Book: primitiveCursorLink&quot;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(93 primitiveInputSemaphore)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(94 primitiveGetNextEvent)<span class="Apple-tab-span" style="white-space:pre">                                </span>&quot;Blue Book: primitiveSampleInterval&quot;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(95 primitiveInputWord)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(98 primitiveStoreImageSegment)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(99 primitiveLoadImageSegment)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(101 primitiveBeCursor)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(102 primitiveBeDisplay)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(103 primitiveScanCharacters)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(105 primitiveStringReplace)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(106 primitiveScreenSize)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(107 primitiveMouseButtons)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(108 primitiveKbdNext)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(109 primitiveKbdPeek)</div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(126 primitiveDeferDisplayUpdates)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(127 primitiveShowDisplayRect)<span class="Apple-tab-span" style="white-space:pre"></span></div>
<div><span class="Apple-style-span" style="white-space: pre; ">                </span>(133 primitiveSetInterruptKey)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(134 primitiveInterruptSemaphore)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(140 primitiveBeep)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(141 primitiveClipboardText)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(142 primitiveVMPath)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(231 primitiveForceDisplayUpdate)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>(232 primitiveFormPrint)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(233 primitiveSetFullScreen)</div><div><br></div><div>as these are to do with the broader context, not the core execution engine.</div>
<div><br></div><div>I would go further and rip out support for named primitives from the VM and put it up in the image where it belongs. &nbsp;I would build the machinery for looking up named primitives in the image and have a primitive that allowed one to slam a function address into a method.</div>
<div><br></div><div>For me the VM should include an execution engine, a small and fast FFI and nothing else. &nbsp;One needs some VM support to bootstrap the FFI. &nbsp;i.e. the VM must include a primitive to load a platform library and another to lookup a name in it. &nbsp;But other than that everything can be up in the image. &nbsp;When one invokes a method with a primitive that has not been bound to a function yet then the primitive fails and the image&#39;s primitive failure code looks up the primitive&#39;s name and retries the call or reports an error if the library or name can&#39;t be found.</div>
<div><br></div><div>The indexed primitive table should then come down to under 256 entries, (512 if you include&nbsp;primitiveLoadInstVar)&nbsp;leaving those bits to be used for more useful things like a larger literal range.</div>
<div><br></div><div>But that&#39;s just my opinion.</div><div><br></div><div><br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
<br>
So do it.<br>
<br>
Stef<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Some code gets simplified, some space is saved, some flexibility is added, some bits are freed up in the CM header. THe downside is someone has to do some work.</blockquote></blockquote><div><br></div><div>:) &nbsp;back to my day job...</div>
<div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" target="_blank">http://www.rowledge.org/tim</a><br>
Advanced design: Upper management doesn&#39;t understand it.<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
<br>
</blockquote></div><br>