[llvm-commits] [llvm-gcc-4.2] r63087 - /llvm-gcc-4.2/trunk/gcc/tree-nested.c

Duncan Sands baldrick at free.fr
Tue Jan 27 12:02:22 PST 2009


Hi Dale,

> He says the intent is that blocks code should never access variables  
> in the parent, thus we should never need a static chain.   Ah, I see,  
> the default is to assume a static chain (peculiar), so the problem is  
> ObjC may need to set that bit explicitly, probably isn't doing  
> that...you can put the assertion back if you like.

IIRC the way DECL_NO_STATIC_CHAIN works is: when creating trees (before
tree-nested is run) you can set DECL_NO_STATIC_CHAIN on a nested function
to indicate that it definitely doesn't need a static chain.  So if blocks
are known not to use static chains then they should set this.  Later on,
when tree-nested runs, IIRC, tree-nested examines functions with
!DECL_NO_STATIC_CHAIN and works out which ones need chains, and sets
DECL_NO_STATIC_CHAIN if none is needed.

The Ada front-end sets DECL_NO_STATIC_CHAIN on functions declared as
nested functions but imported from C (eg: you can import a C standard
library function as a local nested function - using nesting for
visibility control).

Ciao,

Duncan.



More information about the llvm-commits mailing list