Success flag and using return value of primitive function

Igor Stasenko siguctua at gmail.com
Fri Dec 7 19:46:17 UTC 2007


On 07/12/2007, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
> Hi Igor,
>
> GCC (C compilers in general?!) is not a statement by statement compiler,
> it shuffels around common subexpressions etc, even if not being asked for
> optimizations. Also many the methods of the VM are inlined, and moreover
> values are kept in registers until pressure occurs (also done without
> being asked for optimizations).
>
Ah, yes, i forgot about codegenerator inlining.
Yes, keeping right order of things under such circumstances are harder.

> I have not counted the cases where something returned would be useful v.s.
> not useful but, for the Smalltalk developer this would be counting the
> beans (in a dedicated Workspace?) one way or the other :)
>
> Do you have metrics of the C-generated code for justifying the current
> v.s. your suggested form?
>
Of course not, but to my feel, it would be better to use return value.
But because of manual (codegenerator) inlining i see that this is hard
to achieve.

> What can be seen crystal clear from the code architecture of the VM is: if
> something is inlined then GCC most likely has the value of the success
> variable (which you've set before Slang returns from that method) in a
> register. If something isn't inlined then the frequency of call (which you
> associate with accessing the success value) is of no importance (but the
> CPU's pipe+cache might still know that value).
>
> If by "primitive function" you meant only the bytecode primitives and the
> numbered primitives then I'd say case 2 of the previous paragraph applies.
>
> /Klaus
>

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list