On Apr 12, 2011, at 4:46 AM, Laurynas Biveinis wrote: >> So what's the plan for the case where you need to change the lifetime of >> an object? > > Copying it. Frankly at the moment I don't how much trouble does deep > copying from scratch to function entails,
The code to copy isn't too hard and if fairly simple to understand, test and do. Roughly, you just need to understand how deep you have to copy, part of this is ensuring you iterator over all the pointers in the objects that might point to the shorter lifetime. The problems of the past would be, all the other folks that have live pointers into anything which is copied. You have the first pointer and that is trivial to change, but all the other pointers could be problematic. Some of the problems were when some of the pointers pointed to the new and some of the pointers pointed to the old, then, for all the data hanging off those data structures that were supposed to be single pieces of data, there were now two copies of that data. Imagine if you had two TREE_ASM_WRITTENs for a `single' decl. RTL is vastly simpler than a _DECL node. For just generated RTL (combine temp rtl building), I would not expect any problems. Likewise scratch to function, those should be easy enough. Harder are function to anything longer, say, permanent.