[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] New suggestion about call convention



> No problem, there is a solution for that. If A, B and C form a loop,
> you can put a `save-all' wrapper around one of them, and the loop will
> be broken.

> The only thing that matters is the register set of the callee; if
> that set is empty, you can delete the (caller; callee) edge from the
> graph, the loop vanishes, and you can handle the rest like any other
> non-recursive function. Inserting a `save-all' wrapper by definition
> empties the register set, so...

Well it's not so easy. What append if :

A call B
B call C
C call an external function
This external function call A.

You don't have any information about the external function, so you must save 
all register before calling it (I really mean all, not only the one that used 
by C, but the one that are used by B too, because B will certainly crash 
them).

So we must detect call back function, but that not so easy. Of course you have 
pointer to function, it's easy to say that their are callback, but sometime 
you give fixed name to callback, and in that case you can't detect them (With 
some graphical toolkit, I remember that I used a "callback" to initialise the 
interface before the interface call it. So it's not because a function is 
call in your source code, that it isn't a callback).

This is a very big problem of your algorithm. The only solution is to use a 
call-graph to know who call each function and to link it with every 
library...

In fact the problem is that you can take a decision only if you totally know 
the world around your program ! That's a big problem.

Cedric
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/