1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00
Commit Graph

931 Commits

Author SHA1 Message Date
Nikita Popov 0615c59a4f Mark all $php_errormsg as refs to inhibit optimization 2016-04-30 12:34:01 +02:00
Dmitry Stogov 6499162ff0 - get rid of EG(scope). zend_get_executed_scope() should be used instead.
- ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter.
2016-04-28 04:13:34 +03:00
Nikita Popov d94b9545d6 Support known static/method calls in call graph
For this purpose extract the function lookup call into a helper
zend_optimizer_get_called_func().
2016-04-27 17:10:45 +02:00
Nikita Popov 4f54c15cb1 Ct bind private/final $this method call args
The test covers two edge-cases wrt opcache support.
2016-04-27 17:10:44 +02:00
Nikita Popov 434e0fb3a5 Take pi defs into account when propagating defs
Previously pi placement happened after initial phi placement.
Afterwards a second phi placement pass was performed, however it
incorrectly only placed phis on the dominance frontier, rather
than the iterated dominance frontier.

This is fixed by moving pi placement before the propagation of
defs on the iterated DFs, and adding a def for each added pi.

While this ensures that we generate correct conservative SSA, there
is still one remaining case in which we may generate non-minimal
SSA form. Consider:

   |1|
    |pi
    v
   |2|<--\
    |    |
    \----/

The pi is semanically located along the edge 1->2, however we place
it (and its def point) in 2, thus leading to the generation of an
additional (trivial) phi in 2.

Conflicts:
	ext/opcache/Optimizer/zend_ssa.c
2016-04-24 21:46:20 +02:00
Nikita Popov 721be3e0c1 Make pi placement independent of phi placement
This interdependence is problematic because we can't propagate pi
def points in the initial dominance frontier propagation. The used
rule for multiple-predecessor blocks may also miss cases where
placing the pi would have been useful.

The new heuristic for pi placement checks that a) the variable is
live-in and b) for the "from" block that generated the pi, the
other successor does not dominate all other predecessors of the
"to" block.

The purpose of case b) may be illustrated with an example:

    if (is_int($i)) {
        // place pi here
    }
    // but don't place pi here

The reason we do not want to place the second pi is that we generally
place pis in positive+negative pairs, and in this case the pair
would merge in a phi and cancel out, so we get no useful information
out of it.
2016-04-24 21:45:22 +02:00
Nikita Popov 65faf0a5a2 Drop some unnecessary checks 2016-04-24 17:15:46 +02:00
Nikita Popov cafe78d12a Introduce ZEND_BITSET_FOREACH macros 2016-04-24 17:05:13 +02:00
Nikita Popov 304e5ae3d6 Adjust DFG allocation size
Now we need one set less...
2016-04-21 23:49:37 +02:00
Nikita Popov 55caaac73f Make MAY_BE_ERROR handling more accurate
This ended up causing weird things like MAY_BE_ERROR CVs.

Also make sure that ASSIGN result isn't MAY_BE_REF.
2016-04-21 23:49:20 +02:00
Nikita Popov a5944f8dd5 Merge def and gen sets
For live-variable analysis it does not matter if def includes
variables that are previously use in the same block, the data flow
equations still have the same result. As such there is no need to
compute separate gen & def sets.

I'm keeping the name "def", because use of "gen" in this context is
pretty confusing (gen is usually the use set, not the def set).
2016-04-21 23:32:01 +02:00
Nikita Popov 4f726be682 Fix SSA for SEND_UNPACK 2016-04-16 22:38:52 +02:00
Nikita Popov 4a568dd7c9 Drop left-over debugging statement in block pass 2016-04-16 20:23:23 +02:00
Nikita Popov 64f91774f2 Remove IS_VAR_RET_REF flag
Instead decide whether a function returned by reference or by value
by checking whether the return value has REFERENCE type. This means
that functions returning by reference must always return a reference
and functions returning by value must not return a reference.
2016-04-15 15:32:20 +02:00
Dmitry Stogov d57505e234 Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src:
  Fixed bug #72014 (Including a file with anonymous classes multiple times leads to fatal error)
2016-04-14 16:08:54 +03:00
Dmitry Stogov b73517c1a1 Use DO_FCALL_BY_NAME instead of DO_FCALL, if possible 2016-04-14 16:07:28 +03:00
Xinchen Hui 17c3aa9dd1 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72014 (Including a file with anonymous classes multiple times leads to fatal error)
2016-04-14 20:21:34 +08:00
Xinchen Hui 8a17b1a241 Fixed bug #72014 (Including a file with anonymous classes multiple times leads to fatal error) 2016-04-14 20:21:19 +08:00
Xinchen Hui 4fafd7309c Merge branch 'PHP-7.0'
* PHP-7.0:
  This only make sense on *nix
2016-04-12 15:31:35 +08:00
Xinchen Hui 9458f54969 This only make sense on *nix 2016-04-12 15:31:21 +08:00
Lior Kaplan bffd78fa77 Merge branch 'PHP-7.0'
* PHP-7.0:
  Enable configure without opcache-file and huge-code-pages
2016-04-09 16:35:50 +03:00
Lior Kaplan c6c44c3629 Enable configure without opcache-file and huge-code-pages
This doesn't chagne the default (yes for both features), but respects
--disable-opcache-file and --disable-huge-code-pages configure flags if given.
2016-04-09 15:57:57 +03:00
Xinchen Hui 3e7b429663 We should always serialize the op->handler 2016-04-09 01:43:28 -07:00
Lior Kaplan 2875ac9c00 Merge branch 'PHP-7.0'
* PHP-7.0:
  opcache config.m4: Use = for comparison
2016-04-09 01:38:37 +03:00
Lior Kaplan 403c3f95fe Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  opcache config.m4: Use = for comparison
2016-04-09 01:35:30 +03:00
Lior Kaplan c1f597d9a1 opcache config.m4: Use = for comparison 2016-04-08 22:38:07 +03:00
Nikita Popov 3ad0e1d6ca Fix static method arg binding in traits 2016-04-08 01:48:21 +02:00
Dmitry Stogov aed4249653 Fixed handling of return statement without a value. 2016-04-07 18:59:04 +03:00
Dmitry Stogov 8921449785 Added missing "break" 2016-04-07 18:27:49 +03:00
Dmitry Stogov 3444c1ae24 Use return type hints for type inference and eliminate useless VERIFY_RETRUN_TYPE opcodes. 2016-04-07 17:34:53 +03:00
Anatol Belski 2ead9be91b Merge branch 'PHP-7.0'
* PHP-7.0:
  make opcache lockfile path configurable
2016-04-06 13:50:24 +02:00
Fatih ACAR d54eafb349 make opcache lockfile path configurable
Signed-off-by: William Dauchy <william@gandi.net>
Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>
Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
2016-04-06 13:29:52 +02:00
Dmitry Stogov 82050dfd3c fixed type inference mistake (typo) 2016-04-01 20:29:54 +03:00
Dmitry Stogov f3c70f118c Manual CSE 2016-03-31 17:26:27 +03:00
Andrea Faulds d6fc6d4ae6 Fix memory leak
Leak was introduced in c88ffa9a56.
2016-03-30 14:16:07 +01:00
Andrea Faulds 1e82ad8038 Warn about invalid strings in arithmetic
Squashed commit of the following:

commit e05d3b6732
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Mar 30 01:43:35 2016 +0100

    UPGRADING and NEWS

commit 6caf1d4585
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Mar 20 21:18:33 2016 +0000

    Fixes

commit 6dadb1b0ef
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 02:15:01 2016 +0000

    Add test for numeric string errors in assignment

commit bd5f04e8dd
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 23:53:05 2016 +0000

    Add test for numeric string errors

commit c72e92f16d
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 23:28:33 2016 +0000

    Add test for scientific notation in integer operations

commit d94c08852d
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 01:25:57 2016 +0000

    Disable optimiser evaluation for numeric string errors

commit 30ee954ed1
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 01:46:25 2016 +0000

    fixup

commit a6403b79e0
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 22:00:27 2016 +0000

    Do not convert error-causing numeric strings ahead-of-time

commit f9dc354014
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 19:15:38 2016 +0000

    Disable compile-time evaluation for numeric string errors

commit e05b0cc849
Author: Andrea Faulds <ajf@ajf.me>
Date:   Fri Feb 5 11:42:26 2016 +0000

    Make _zval_get_long_func_noisy function for inlining

commit 84d66321a5
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 23:10:00 2016 +0000

    Update tests

commit 5ac4a0cc4b
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 22:08:19 2016 +0000

    Use is_numeric_string_ex for zval_get_long etc.

commit c21f088485
Author: Andrea Faulds <ajf@ajf.me>
Date:   Thu Jan 7 21:13:04 2016 +0000

    Update tests

commit 63e214cf81
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Jan 6 00:28:01 2016 +0000

    Warn on non-/bad numeric strings in arithmetic
2016-03-30 01:44:27 +01:00
Nikita Popov b867bd1c8d Fix FETCH_CLASS_SELF comparisons
Turns out those don't form a bitfield.
2016-03-26 22:45:23 +01:00
Nikita Popov d3ed75b9eb Remove HAVE_CRYPT checks
We always provide a crypt implementation. HAVE_CRYPT is only
relevant as to whether the crypt() C function exists.
2016-03-25 21:09:47 +01:00
Nikita Popov 8e5b139732 Evaluate arguments of new for classes without ctor
ML: http://markmail.org/message/4b3mk7jid64zvz34
2016-03-25 19:11:37 +01:00
Dmitry Stogov d8b75b0807 Convert ASSIGN_ADD $a, $b into $a = ADD $a, $b, if possible. 2016-03-22 23:57:26 +03:00
Dmitry Stogov 94812fa6cd Convert ASSIGN_ADD $cv, int(1) into PRE_INC $cv, if it's safe. 2016-03-22 22:50:43 +03:00
Xinchen Hui 85419b4f28 Unused var 2016-03-18 16:02:32 +08:00
Dmitry Stogov 681de72554 Enable DFA pass by default 2016-03-17 22:37:20 +03:00
Dmitry Stogov fc7cbdce61 Squashed commit of the following:
commit 98471821a8
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:56:04 2016 +0300

    Fixed wrong constant usage

commit 8183b811e7
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:10:23 2016 +0300

    Added ability to serialize and serialize opcode handlers for file-cache

commit 3516b261de
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:11:59 2016 +0300

    Added missed file

commit f4475a2360
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:00:45 2016 +0300

    Transparently introduce type-specialized opcode handlers.
    This affects only PHP VM, and doesn't change anything else.
2016-03-17 22:00:27 +03:00
Xinchen Hui 36dbaac595 Merge branch 'PHP-7.0' 2016-03-17 07:55:44 -07:00
Xinchen Hui 93499bfd8a Fixed test & ZEND_BOOL should result TMP_VAR 2016-03-17 07:55:25 -07:00
Xinchen Hui adb82514eb Merge branch 'PHP-7.0'
* PHP-7.0:
  Remove unnecessary pattern
  Fixed for PHP7
  Fixed bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER)

Conflicts:
	ext/opcache/Optimizer/block_pass.c
2016-03-17 20:24:59 +08:00
Xinchen Hui aef22ac1c1 Remove unnecessary pattern 2016-03-17 20:21:36 +08:00
Xinchen Hui 041a01fd6c Fixed for PHP7 2016-03-17 20:20:01 +08:00
Xinchen Hui 820b0aa2ab Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER)
2016-03-17 19:54:33 +08:00