<br><br><div class="gmail_quote">On Thu, Jul 3, 2008 at 5:48 PM, Igor Stasenko <<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2008/7/4 Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>>:<br>
<div><div></div><div class="Wj3C7c">> Hi All,<br>
><br>
> does anyone know (or even better has anyone fixed it) how hard it is to<br>
> make Slang inline methods that contain simple type declarations?<br>
><br>
> I would like to eliminate compile-time integer/pointer mismatch errors in<br>
> the new StackInterpreter I'm writing. I'd like to say things like:<br>
><br>
> callerSPOf: theFP<br>
> "Answer the SP of the caller provided theFP is not a base frame.<br>
> This points to the hottest item on the frame's stack."<br>
> self var: #theFP type: 'char *'.<br>
> self returnTypeC: 'char *'.<br>
> self assert: (self isBaseFrame: theFP) not.<br>
> ^theFP + FoxCallerSavedIP + ((self frameNumArgs: theFP) + 2 * BytesPerWord)<br>
> but Slang refuses to inline anything that has C declarations. I'm guessing<br>
> that the issue is moving the type information from the method to its inlined<br>
> form. It took me half a day to discover where Slang refuses to inline<br>
> (should have looked in the obvious place CCodeGenerator>>collectInlineList,<br>
> instead of in the inlining code :/ ). So I'm afraid to waste the time<br>
> trying to find out where the restriction bites. Anyone know how to fix this<br>
> or better still have a fix?<br>
><br>
<br>
</div></div>Doesn't 'self inline: true' helps?</blockquote><div><br>No. Slang refuses to inline anything containing a C declaration (retrnTypeC:, var:type: cCode:inSmalltalk: etc)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Or, can't you circumvent that by coercing a value to corresponding<br>
type at call site? Like:<br>
<br>
newSP := self cCoerce: (self callerSPOf: blabla) to: 'char *'.</blockquote><div><br>That's worse than the disease :) There are many more uses than definitions. So I want the uses to look clean and I'll tolerate noisy definition. There are also argument types to consider. localIP has type char * for example, so where it is used as an argument I want the argument type to be char * or void *, etc.<br>
<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">And don't touch the return type of function.<br>
<br>
> best<br>
> Eliot<br>
><br>
><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</font></blockquote></div><br>