This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] statically initialize spu FILE values


On Mon, Apr 09, 2007 at 10:53:57AM +0900, Kazunori Asayama wrote:
> Patrick Mansfield <patmans@us.ibm.com> wrote:
> > Use a static initialization of the spu FILE values, and get rid of the
> > runtime spu calls to CHECK_INIT.
> > 
> > RFC especially on the location and use of the new defines.
> > 
> > Ran some simple tests for predefined FILE streams.
> > 
> > Hacked spu to test that it compiles OK without the special defines, and
> > that spu _REENT_INIT_PTR compiled OK (spu code does not use
> > _REENT_INIT_PTR).
> 
> With your changes, the cleanup function (__cleanup) seems no longer
> called. We need to set the address of __cleanup to REENT->__cleanup
> somewhere.

Yes, that is bad ...

> One major reason why CHECK_INIT is called on runtime, is to reduce
> code size. This approach can avoid linking an SPE program with
> __cleanup if the program doesn't use stdio functions.

Yes.

> I propose to modify CHECK_INIT macro as following instead of remove
> it, to minimize runtime overhead and code size, and still to do
> cleanup correctly:
> 
>     #define CHECK_INIT(ptr) ((ptr)->__sdidinit = 1, (ptr)->__cleanup = __cleanup)

I wanted to remove all those calls. And we are still missing close of
files opened via open.

Are you OK with closing all opened files (for both fopen and open) in libspe? 

Then we could remove stdio.c and the spu CHECK_INIT.

-- Patrick Mansfield


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]