Re: Safe Temporary Cleanup on Exception (Variable Liveness)
| From: | Dmitry Stogov | Date: | Tue, 10 Nov 2015 19:28:30 +0000 |
| Subject: | Re: Safe Temporary Cleanup on Exception (Variable Liveness) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89153@lists.php.net to get a copy of this message | ||
I've committed unrelated and obvious parts (without semantic changes).
The updated and extended patch now is much more clean
https://gist.github.com/dstogov/43eaa3f3b68583877322
Anyway, it's still incomplete.
Thanks. Dmitry.
On Tue, Nov 10, 2015 at 2:29 PM, Dmitry Stogov <dmitry@zend.com> wrote:
>
>
> On Tue, Nov 10, 2015 at 1:42 PM, Nikita Popov <nikita.ppv@gmail.com>
> wrote:
>
>> On Tue, Nov 10, 2015 at 10:53 AM, Dmitry Stogov <dmitry@zend.com> wrote:
>>
>>> Hi,
>>>
>>> Please take a look into
>>> https://gist.github.com/dstogov/43eaa3f3b68583877322
>>>
>>> This is variation on Bob's idea about variable liveness.
>>> The patch is incomplete. Liveness construction is still naive. However,
>>> all tests are passed.
>>>
>>> Ranges are represented by start/end/variable cartages. (I suppose this
>>> representation is more compact, than in the original proposal).
>>> In general, it's possible to use few ranges for the same variable, if
>>> its whole live range is not linear. (this is not implemented yet).
>>>
>>> Related ideas and tests are welcome.
>>>
>>> Thanks. Dmitry.
>>>
>>
>> One leak this does not cover yet is a discarded delayed return value:
>>
>> function test() {
>> try {
>> $a = [1, 2, 3];
>> return $a + [];
>> } finally {
>> throw new Exception;
>> }
>> }
>>
>> try {
>> test();
>> } catch (Exception $e) {}
>>
>> This case is a bit tricky because it violates the usual invariant that
>> all temporaries have well-defined liveness ranges (either alive or not, no
>> maybe). We'd have to change that first.
>>
>
> I see the problem. We can't statically define live-ranges for finally
> code, because we don't know where it's going to be called from.
> May be we may reconstruct this at run-time.
>
> Thanks. Dmitry,
>
>
>
>>
>> Nikita
>>
>>
>