escaping pointer to scope local array: bug or not?

Steven Schveighoffer schveiguy at yahoo.com
Tue Aug 18 10:57:50 PDT 2009


On Tue, 18 Aug 2009 13:48:23 -0400, Robert Jacques <sandford at jhu.edu>  
wrote:

> On Tue, 18 Aug 2009 10:38:50 -0700, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>
>> On Tue, 18 Aug 2009 13:34:36 -0400, bearophile  
>> <bearophileHUGS at lycos.com> wrote:
>>
>>> Steven Schveighoffer:
>>>> Another way is to perform escape analysis, but Walter has expressed  
>>>> that
>>>> he doesn't want to do that.  It would require an intermediate  
>>>> interface
>>>> language for imports where annotations could be added by the compiler.
>>>
>>> Why is that bad?
>>
>> I don't think it's bad, but definitely a lot of work.  I would be all  
>> for it.
>>
>> -Steve
>
> Actually, it's really bad. Escape analysis requires whole program  
> analysis. It would be impossible to do incremental compilation or to  
> ship/sell D libraries in binary format. I'd recomend checking out  
> http://en.wikipedia.org/wiki/Escape_analysis for an overview of the  
> issues involved. You can avoid doing whole program analysis by  
> introducing ownership types and being a bit conservative in what you  
> allow. There's a (bit confusing) wiki page proposal an how to implement  
> it at http://www.prowiki.org/wiki4d/wiki.cgi?OwnershipTypesInD.

Admitting I didn't read any of that, I think incremental analysis is  
possible as long as import files are generated by the compiler  
post-analysis.  i.e. the compiler is able to alter the function signature  
indicating escape analysis information.

With something like that, you could still ship in binary format, along  
with generated import files that describe the function signatures (if one  
requires building against your product).  In fact, the import files could  
be a part of the binary files, similar to how java works.

-Steve




More information about the Digitalmars-d mailing list