1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 16:08:35 +02:00
Commit Graph

500 Commits

Author SHA1 Message Date
Nikita Popov 1a780e6727 Add assertion to prevent type narrowing
Currently type narrowing is always a bug, make sure we know about
it.
2016-08-05 16:30:57 +02:00
Nikita Popov fc7c81ff54 Fixed bug #72762 2016-08-05 16:27:55 +02:00
Nikita Popov 42260325a4 Fix optimization of $i = $i++ 2016-07-17 22:47:49 +02:00
Dmitry Stogov 0da7c08e39 Prevent wrong optimization 2016-07-13 15:05:11 +03:00
Nikita Popov 5f6effed43 Add opcodes to zend_wrong_string_offset() 2016-07-10 15:15:34 +02:00
Aaron Piotrowski d9a9cf8eca Merge branch 'master' into iterable 2016-07-03 22:42:10 -05:00
Dmitry Stogov acdafc0a27 Prevent inlining through call_user_func() and call_user_func_array() 2016-07-01 00:16:54 +03:00
Dmitry Stogov f2e4fc307b Fixed ext/opcache/tests/bug70207.phpt 2016-06-30 21:50:57 +03:00
Dmitry Stogov 1a14533806 Introduce new CHECK_VAR instruction to keep warnings about undefined variables. 2016-06-30 21:40:34 +03:00
Dmitry Stogov 3a45242669 Disable inlining for $this->foo(), because $this may be not in object context 2016-06-30 21:05:48 +03:00
Dmitry Stogov c3667a5eed Disable inlining for $this->foo(), because $this may be used not in object context 2016-06-30 21:03:08 +03:00
Dmitry Stogov 5ae07dc34a Fixed incorrect constant propagation 2016-06-30 20:48:16 +03:00
Nikita Popov 6f8273e3bf Fix RT_CONSTANT_EX typo 2016-06-30 17:42:57 +02:00
Dmitry Stogov d898344663 Inline simple constant functions 2016-06-30 17:04:25 +03:00
Dmitry Stogov 871cd76af4 clanup 2016-06-29 17:53:39 +03:00
Nikita Popov 2710ce22a0 Remove assert for now 2016-06-28 18:47:29 +02:00
Nikita Popov cdd58edf42 More type inferences fixes 2016-06-28 11:49:50 +02:00
Dmitry Stogov 1433162083 Fixed compilation warnings 2016-06-21 20:12:29 +03:00
Nikita Popov a171522983 Exception safety for direct CV assign of *CALL instrs
Converting T = *CALL; ASSIGN $v, T into $v = *CALL may not be
safe if an exception is thrown after the return value has been
populated -- in this case the value might be destroyed twice.
2016-06-18 00:08:38 +02:00
Nikita Popov 811dfba4bf More type inference fixes 2016-06-16 14:25:48 +02:00
Dmitry Stogov ff363e2e7c Implemented RFC: Replace "Missing argument" warning with "Too few arguments" exception
Squashed commit of the following:

commit 8b45fa2acb
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jun 16 01:52:50 2016 +0300

    Separate slow path of ZEND_RECV into a cold function.

commit 9e18895ee5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 23:26:28 2016 +0300

    Required argument can't be IS_UNDEF anymore.

commit 662db66e39
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 31 17:14:50 2016 +0300

    Replace "Missing argument" warning by "Too few arguments" exception.
2016-06-16 02:32:02 +03:00
Dmitry Stogov a9512af810 Implemented RFC: Fix inconsistent behavior of $this variable
Squashed commit of the following:

commit bdd3b6895c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jun 16 00:19:42 2016 +0300

    Fixed GOTO VM

commit 2f1d7c8b89
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 21:01:57 2016 +0300

    Removed unused variable

commit cf749c42b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 19:06:16 2016 +0300

    Protection from $this reassign through mb_parse_str()

commit 59a9a6c83c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:14:50 2016 +0300

    Added type inference rule for FETCH_THIS opcode

commit 73f8d14a85
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:11:18 2016 +0300

    Restored PHP-7 behavior of isset($this->foo).
    It throws exception if not in object context.
    Removed useless opcode handlers.

commit fa0881381e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 31 12:25:47 2016 +0300

    Changed "Notice: Undefined variable: this" into "Exception: Using $this when not in object context".

commit e32cc528c0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 02:02:43 2016 +0300

    Throw exception on attempt to re-assign $this through extract() and parse_str().

commit 41f1531b52
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 22:18:36 2016 +0300

    Fixed inconsistent $this behavior
2016-06-16 02:30:23 +03:00
Nikita Popov fba6f90ae3 Fix type inference bugs
* Add proper array_key_any|array_of_any|array_of_ref in some more
  places
* strlen() on objects may be null
* IS fetch on string dim may be null
2016-06-15 22:52:48 +02:00
Dmitry Stogov d12987256a Fixed mistakes in type inference rules. 2016-06-15 23:04:17 +03:00
Nikita Popov 046889518d Add support for "instanceof" pi nodes 2016-06-13 19:03:59 +02:00
Nikita Popov 9877d8f019 Use union for pi constraints
This will make it easier to extend pi constraints without impacting
structure sizes.
2016-06-13 19:03:57 +02:00
Aaron Piotrowski 0dc772c9b4 Add iterable type to opcache 2016-06-10 19:01:27 -05:00
Nikita Popov be37de1ff1 Use LCA for object(ce) type joins
For B, C extending A the join of object(B) and object(C) should
be object(instanceof A). For simplicity we only handle the class
hierarchy, as computing the least common unique ancestor for
interfaces would be more involved.

Also ignore phi sources that don't have an object type: The join
of null and object(A) is now null|object(A) rather than
null|object.
2016-06-07 20:42:00 +02:00
Nikita Popov d8a2370884 Cleanup 2016-06-07 20:42:00 +02:00
Dmitry Stogov 80b39b498a Improve type narrowing (check only SSA definitions). 2016-06-06 14:57:02 +03:00
Nikita Popov 543649bd4c Fix correctness issues with type narrowing
Fixes bug #72335.
2016-06-06 14:56:17 +03:00
Nikita Popov e6296f0dcc Fix VERIFY_RETURN_TYPE elision
This both fixes incorrect elision and allows elision for cases
where we only have a subset (e.g. true of bool).
2016-06-05 23:44:08 +02:00
Nikita Popov 7b4618e396 Fix SSA NOP removal
NOPs need to be tracked in the shiftlist as well, as there may be
jumps to NOPs.
2016-06-05 23:00:32 +02:00
Nikita Popov 3be92120ba Fix handling of parse_str() with unpack in optimizer 2016-06-05 22:16:15 +02:00
Nikita Popov 70f0546885 Don't optimize special dynamic calls to non-dynamic
As it drops the warning. This is more problematic with constant
propagation, as tests would fail.

Extract a zend_optimizer_classify_function() function, as its now
needed by zend_cfg and update_opN.
2016-06-05 22:04:36 +02:00
Sara Golemon 51b3be7e76 Correct inline comments regarding pass1/pass2 actions
BRK/CONT no longer reach the optimizing following 8542befa7b
Pre-evaluate constant function calls is in pass1, not pass2
2016-05-31 22:41:37 +00:00
Dmitry Stogov b111da96d9 Split ZEND_SEND_VAR_NO_REF into ZEND_SEND_VAR_NO_REF and ZEND_SEND_VAR_NO_REF_EX (similar to ZEND_SEND_VAL) and remove ZEND_ARG_* flags. 2016-05-31 04:06:00 +03:00
Xinchen Hui c3495d5dc0 This is not a problem here
if only for PHI placement, we may get rid of this `use` here.
But as the comment said, it is useful if we are going to do code generation
2016-05-28 15:17:14 +08:00
Xinchen Hui 4935c03276 Revert "assert won't cause indrect var access if it's disabled"
in the other hand, it should not be there if it's disabled...

This reverts commit 27f40676e6.
2016-05-27 10:53:32 -07:00
Xinchen Hui 27f40676e6 assert won't cause indrect var access if it's disabled 2016-05-27 10:48:36 -07:00
Xinchen Hui da511f255a Typo & cleanup 2016-05-27 16:17:07 +08:00
Dmitry Stogov 2ae21abdf7 Fixed bug #72213 (Finally leaks on nested exceptions).
Squashed commit of the following:

commit 8461b0407f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:34:42 2016 +0300

    Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset.

commit 0c71e24964
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:04:53 2016 +0300

    Move SAVE_OPLINE() to its original place

commit 111432a4df
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:01:10 2016 +0300

    Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper.

commit 4f21c06c2e
Author: Nikita Popov <nikic@php.net>
Date:   Tue May 24 14:55:27 2016 +0200

    Improve finally fix

commit da5c727499
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 10:36:08 2016 +0300

    Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt

commit cfcedf2fb4
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 02:59:27 2016 +0300

    Added test

commit 4c6aa93d43
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 00:38:20 2016 +0300

    Added tests

commit 8a8f4704b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 23:27:34 2016 +0300

    Fixed bug #72213 (Finally leaks on nested exceptions)
2016-05-25 01:25:12 +03:00
Nikita Popov a19eb8e34a Ensure no entry predecessors for SSA construction 2016-05-24 18:29:45 +02:00
Nikita Popov e745b4cad8 Replace BB end with BB len
And support empty blocks everywhere.
2016-05-24 18:29:44 +02:00
Nikita Popov 0d62dfdf81 Improve previous fix
Do not mark loop var free blocks as reachable after all -- as we
can't construct SSA for unreachable blocks, this would cause
issues down the line.

Instead add an extra UNREACHABLE_FREE flag and retain only the
FREE instruction during NOP removal. (If we retain all
instructions in the BB we might leave a jump instruction that goes
into the nowhere.)
2016-05-22 00:05:06 +02:00
Nikita Popov fa9566627b Fix reachability detection if live ranges aren't split
Even if we don't split, we still want to keep the same logic for
reachibility detection.
2016-05-21 20:17:09 +02:00
Nikita Popov b65b15c6f4 Mark assert() as INDIRECT_VAR_ACCESS
I don't like this... we may want to detect "obviously not string"
operands by checking for the result of a comparison instruction.
2016-05-17 16:13:17 +02:00
Nikita Popov dd8379e046 Inference: $a[]= results in long keys 2016-05-14 17:16:32 +02:00
Nikita Popov 6079ba4b0c Inference: Fix undef handling for binary ops
We need to be careful about correctly handling that undef results
in a null value. Otherwise, apart from simply generating incorrect
results, we may also end up performing non-monotonic lattice
transitions, thus causing an infinite type inference loop (see
test).
2016-05-14 17:16:32 +02:00
Nikita Popov 773b377888 Inference: Use common handling for compound assign ops
Extract the inference code for binary operators and then handle all
ASSIGN_* opcodes the same way.
2016-05-14 17:16:32 +02:00