January 28, 2013 Re: Incorporating D | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | Am 28.01.2013 17:30, schrieb deadalnix:
> On Monday, 28 January 2013 at 16:26:29 UTC, Paulo Pinto wrote:
>> This is not true for current native compilers and JVMs.
>>
>> If escape analysis can prove the object does not leave scope, new
>> actually allocates on the stack.
>>
>
> Modern can even speculate that an object will not leave scope, allocate
> it on stack, and move it on heap if it escape !
That is how Go works if you return a pointer to something declared on the stack.
|
January 28, 2013 Re: Incorporating D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | On Mon, Jan 28, 2013 at 06:21:17PM +0100, Paulo Pinto wrote: > Am 28.01.2013 17:30, schrieb deadalnix: > >On Monday, 28 January 2013 at 16:26:29 UTC, Paulo Pinto wrote: > >>This is not true for current native compilers and JVMs. > >> > >>If escape analysis can prove the object does not leave scope, new actually allocates on the stack. > >> > > > >Modern can even speculate that an object will not leave scope, allocate it on stack, and move it on heap if it escape ! > > That is how Go works if you return a pointer to something declared on the stack. I think DMD needs something like this, to fix all of those ref-to-stack bugs, like: - Unsafe slicing of static arrays - Slicing of variadic arguments - Delegates that reference a returned struct (becomes invalid because caller moves the struct but doesn't update the delegate's context ptr) - ref functions returning ref to local variables And many others. All of these become non-problems if the compiler (or code at runtime) detects the escaping reference and move the stuff onto the heap. T -- Some ideas are so stupid that only intellectuals could believe them. -- George Orwell |
January 28, 2013 Re: Incorporating D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Freddie Chopin | On Sunday, 27 January 2013 at 08:49:39 UTC, Freddie Chopin wrote: > On Saturday, 26 January 2013 at 22:16:09 UTC, Rob T wrote: >> For comparison, I wonder what the situation is for the various major implementations of C++11. Anyone know? > > You're looking for something like this? > > http://gcc.gnu.org/projects/cxx0x.html > > 4\/3!! More like this. http://gcc.gnu.org/bugzilla/buglist.cgi?product=gcc&component=c%2B%2B&resolution=--- Those are bugs listed for C++ front end only. --rt |
Copyright © 1999-2021 by the D Language Foundation