Commentary Cmm page (Observations and Areas for Improvement)
p.tanski at gmail.com
Thu Nov 23 13:18:59 EST 2006
On Nov 22, 2006, at 11:52 AM, Simon Peyton-Jones wrote:
> Peter Tanski wrote:
>> There is no difference: all calls are "foreign" to the caller.
> Again I'm confused. The form
> x = %%foo( p, q )
> in the C-- spec has *nothing* to do with foreign calls. Not a
> thing! Nor, does it necessarily have anything to do with *calls*.
> It might be implemented by a single inline machine instruction.
I am reading too much into the call syntax (sections 5.4 and 6.8.1)
and the 'foreign "C--"' terminology in the C-- Spec. Thanks for
>> This is is where the Cmm implementation details come up: would the
>> caller state *always* save (conversely, the %%op would generate a
>> call) when the %%op contains code that might change the control
>> flow? That would depend on how the control flow might change, as
>> suggested in section 4.4 of your "C-- Extension..." paper,
>> "Informing the optimiser." Does this sound correct?
> I think I'm misunderstanding your question. Let me try again
I was trying to determine the grounds for when a side-effecting
primop would be inlined and when it would be coded as a separate
> * The primops in a C-- *expressions* have no side effects, and
> it's unspecified what order they are done in.
> * A %% op in a C-- *statement* (no more than one in one statement!)
> can have side effects. The order in which C-- statements are
> executed is completely specified by the control flow.
Got it. Well stated.
More information about the Cvs-ghc