It's a theoretical question, rather than practical concerning Exupery, but i'd like to know, what you know/thinking about special compiler heuristics concerning simplifying expressions, when do inlining.
The problem, in basic can be demonstrated by following example.
Suppose you having a code:
mainMethod object = 0 ifTrue: [ object method1 ] ifFalse: [ object method2]
and now method bodies:
method1 object = 0 ifTrue: [ do something] ifFalse: [ do something else ]
method2 object ~= 0 ifTrue: [ do something] ifFalse: [ do something else ]
Now, the question is, when you inlining method1/2 into mainMethod you can see, that tests in inlined methods become redundant. If we inline both methods, code will look like:
mainMethod object = 0 ifTrue: [ object = 0 ifTrue: [ do something] ifFalse: [ do something else ] ] ifFalse: [ object ~= 0 ifTrue: [ do something] ifFalse: [ do something else ] ]
Is there any techniques, which can help in removing such redundancy, when analyzing code by compiler?