<br><br><div class="gmail_quote">On Thu, Jul 3, 2008 at 7:38 PM, tim Rowledge &lt;<a href="mailto:tim@rowledge.org">tim@rowledge.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
As mentioned this is likely &nbsp;a bit of precautionary restriction implemented way back, probably by John Maloney when at Apple. Any cCode stuff stops inlining.<br>
<br>
Given the fairly small set of types (ab)used you might specialise to the form #declareCharStar: #foo etc and instead of catching the various forms of #var:declareC: etc in TMethod&gt;recordDeclarations it would let them through. There&#39;d be some ugly fixups elsewhere though, guaranteed.<br>

<br>
It has to be said that the current state of the Slang translation is just insane. It was a fairly ugly hack to start with and has been mangled, folded, spindled and mutilated ever since. As an example gleaned whilst taking a quick look for a solution for you, consider<br>

&nbsp;- TMethod&gt;inlineCaseStatementBranchesIn:localizingVars: and its use of #hasNoCCode and<br>
&nbsp;- CCodeGenerator&gt;collectInlineList and its non-use of hasCCode but a mangled inline almost equivalent.</blockquote><div><br><br>Thanks Tim! &nbsp;That&#39;s what I needed. &nbsp;Being pointed to the right place. &nbsp;It has taken 20 minutes to understand the code and 20 minutes to fix it. &nbsp;Thanks so much!!<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The textual inlining is terribly poorly factored and horribly hacked. It makes decisions based on nonsense metrics like how many nodes in a tree and are there more than an arbitrary magic number. The code probably won&#39;t work if you don&#39;t inline! At least it didn&#39;t a while back. The inlining/internalising of the bytecode loop is nasty, resulting in near duplicates of many methods for no very good reason.<br>

<br>
My guess - and it is only a guess based on a few limited experiments ages ago - is that it would be smarter to drop the textual inlining completely, make the inline: pragma result in placement of a gcc __inline__ (or whatever the hell it is these days) on the function declaration line and let the compiler handle it.<br>

<br>
Or better yet, completely rewrite the whole damn thing to do the job properly. Invent a better Slang. Add those bitfileds handling capabilities you need, and structures.</blockquote><div><br>Right. &nbsp;Any one brave enough should have a go at this. &nbsp;Right now I can work within the existing system&#39;s limitations and so its not on my critical path (thank goodness).&nbsp;<br>
<br>The way that Dave Simmons and I thought would be a great way to do it is to run a simulation of the VM in some context that allows one to collect concrete type information. &nbsp;This could be e.g.<br><br>- a simulation of the simulation using ContextPart&gt;&gt;runSimulated:contextAtEachStep:, that captures the receiver type(s) at each send site, very slow being a simulation of a simulation<br>
<br>- a simulation above a VM that has polymorphic inline caches, extracting the type information from the PICs a la adaptive optimization/speculative inlining<br><br>The simulation has to be run with an exhaustive case that fully exercises the VM simulation so no code is left untouched. &nbsp;This can be checked (but not verified) by seeing that one has collected type information for all send sites in the VM code. (Not verified because it doesn&#39;t prove that for a given send site a different execution would not introduce another type).<br>
<br>Applying a closed-world assumption to the VM code (it doesn&#39;t change once compiled as a C program) one can then transform the Smalltalk code, decorated with type information, into C. &nbsp;Monomorphic send sites map to procedure calls and/or textual inlining. &nbsp;&lt;handwave&gt;Polymorphic send sites transform to some form of case sttement based on some sort of discriminated union, or perhaps a warning to the programmer to try again&lt;/handwave&gt;.<br>
<br>&lt;hint weight=&quot;heavy&quot;&gt;IMO THIS WOULD MAKE AN EXCELLENT MASTERS OR PHd TOPIC!!&lt;/hint&gt;<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
tim<br><font color="#888888">
--<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>
Fractured Idiom:- MONAGE A TROIS - I am three years old<br>
<br>
<br>
<br>
</font></blockquote></div><br>