Commit Graph

125 Commits

Author SHA1 Message Date
Nikita Popov
a846547ed4 Fix range() return type inference for undef operand
This results in a long range.
2021-09-21 17:03:18 +02:00
Nikita Popov
37337507ec Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't unconditionally add array value type for undef
2021-09-21 14:54:34 +02:00
Nikita Popov
55582a2527 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't replace values in unreachable code in sccp
2021-09-20 13:12:43 +02:00
Nikita Popov
bda1ee9511 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix FETCH_OBJ_IS type inference
2021-09-17 17:05:42 +02:00
Nikita Popov
e0e5b59d2e Try harder to clean up unreachable loop free block
While we can't drop the loop free, we can drop other instructions
in the same block. We should also indicate that it no longer has
predecessors.
2021-09-17 16:32:29 +02:00
Nikita Popov
3191f83146 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't const evaluate increment of array in SCCP
2021-09-16 14:43:28 +02:00
Nikita Popov
91aa78f9b4 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix may_throw for ASSIGN_OBJ
2021-09-16 12:47:04 +02:00
Nikita Popov
ce105f655a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Handle undef assignment to typed ref
2021-09-15 10:58:41 +02:00
Nikita Popov
54bbee96ba Check for no uses before removing result operand
It's possible for there to still be phi uses.
2021-09-14 13:20:28 +02:00
Nikita Popov
fa3d603ba2 Mark ASSIGN result as UNUSED in SCCP
We can't drop the ASSIGN entirely, but we should mark the result
as UNUSED. Otherwise we'll replace uses of it in operands and
will not free the ASSIGN result value. This can happen with
non-interned strings, but possibly there's some other cases that
can trigger this as well.
2021-09-14 13:16:51 +02:00
Nikita Popov
a2fc14c14f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix BIND_STATIC may_throw check
2021-09-14 10:10:51 +02:00
Dmitry Stogov
6d1a2b3aed Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Properly check if BIND_STATIC may throw
2021-09-13 21:59:47 +03:00
Nikita Popov
8c601edada Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  BIND_STATIC may throw
2021-09-13 17:25:13 +02:00
Nikita Popov
f6daf83e75 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Check that POST_INC/DEC has use in DFA optimization
2021-09-09 15:50:04 +02:00
Máté Kocsis
c8f858ef49
Add more specific array return type hints for various extensions - part 4 (#7469) 2021-09-06 17:14:52 +02:00
Máté Kocsis
6a47831e6e
Add more specific array return type hints for various extensions - part 3 (#7467) 2021-09-06 12:27:28 +02:00
Nikita Popov
9b170a41a7 Mark private function as static 2021-08-31 14:54:02 +02:00
Máté Kocsis
c19e4b9997
Generate optimizer func info from stubs for ext/standard - part 3 (#7426) 2021-08-30 15:56:47 +02:00
Máté Kocsis
1bf1481a2a
Specify a few array func info entries (#7425) 2021-08-30 14:29:18 +02:00
Máté Kocsis
8e6e9838b0
Add support for generating MAY_BE_ARRAY_OF_REF func info flag (#7416) 2021-08-30 13:50:34 +02:00
Nikita Popov
fab1222128 Ensure stub files are processed in predictable order
The zend_func_infos.h file was generated in a different order for
me.
2021-08-30 10:28:22 +02:00
Nikita Popov
0f7e0cf34b str_replace() can return the original string 2021-08-30 10:23:09 +02:00
Máté Kocsis
b49d340f74
Generate optimizer func info from stubs for ext/standard - part 2 (#7414) 2021-08-27 16:54:04 +02:00
Máté Kocsis
3f0b586338
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix a few func info
2021-08-27 16:48:06 +02:00
Nikita Popov
51a504c8be Avoid string copy in get_cfg_var()
basic_functions.c already has a macro for returning an ini
value to userland, so make use of it for get_cfg_var() as well,
after generalizing it to not write to return_value in particular.
2021-08-27 15:34:46 +02:00
Máté Kocsis
1ce81b6bcd
Generate optimizer func info from stubs for ext/standard - part 1 (#7413) 2021-08-27 13:11:57 +02:00
Máté Kocsis
8712fb5fe8
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix func info for str_replace() and str_ireplace()
2021-08-27 12:56:14 +02:00
Nikita Popov
7157a2a9ee Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove incorrect refcount info for addcslashes()
2021-08-27 12:13:57 +02:00
Máté Kocsis
fdc6082902
Generate optimizer func info from stubs for various extensions (#7409)
ext/hash, ext/iconv, ext/mbstring, ext/xml, ext/zlib
2021-08-26 19:52:11 +02:00
Máté Kocsis
68946bdd90
Generate optimizer func info from stubs for ext/gd and ext/pgsql (#7408) 2021-08-26 17:38:08 +02:00
Máté Kocsis
17ccabc6b6
Generate optimizer func info from stubs for ext/curl, ext/mysqli, ext/pcre (#7407) 2021-08-26 17:11:45 +02:00
Nikita Popov
6e1bedea5b Merge branch 'PHP-8.0'
* PHP-8.0:
  imagecolorsforindex() cannot return false
2021-08-26 16:37:05 +02:00
Máté Kocsis
5e424d2884
Fix a few ext/date return types 2021-08-26 15:26:13 +02:00
Máté Kocsis
9cd6c57ad1
Merge branch 'PHP-8.0'
* PHP-8.0:
  Sync ext/mysqli optimizer func info entries with the stubs
2021-08-26 12:14:21 +02:00
Máté Kocsis
765aec8623
Generate optimizer func info from stubs for ext/sodium (#7404) 2021-08-26 10:44:38 +02:00
Máté Kocsis
2d248c80b9
Generate optimizer func info from stubs for ext/date (#7403) 2021-08-25 21:29:46 +02:00
Máté Kocsis
50f31829b1
Generate optimizer func info from stubs for a few extensions - part 2 (#7401)
ext/bcmath, ext/fileinfo, ext/filter, ext/gettext, ext/session
2021-08-25 15:29:46 +02:00
Máté Kocsis
d379044066
Generate a few missing optimizer function entries from stubs 2021-08-25 10:37:43 +02:00
Máté Kocsis
4a7a414735
Fix callable and iterable handling 2021-08-25 10:37:43 +02:00
Máté Kocsis
bdfe0ab505
Generate Zend, ext/spl and ext/json optimizer func info from stubs
Closes GH-7397
2021-08-25 10:37:27 +02:00
Máté Kocsis
b1822899fc
Add support for generating optimizer function info from stubs (#7367) 2021-08-24 16:35:33 +02:00
Máté Kocsis
58fcded8ec
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix a few optimizer func info
2021-08-24 15:21:27 +02:00
Nikita Popov
8c67abb67f Drop gz aliases from func info
Func info does not need to include function aliases, we'll look
up based on the primary function name.
2021-08-23 10:41:41 +02:00
Nikita Popov
6e20f0f3a2 Returned interned string from fgetc()
Make use of single-character interned strings.
2021-08-16 11:15:23 +02:00
Nikita Popov
a4c2fb1462 Fix func info for constant()/get_defined_constants()
As pointed out on GH-7367, these have not been adjusted for
object constant support.

Now the only thing the type info specifies is that array of ref
is not possible.
2021-08-16 10:57:46 +02:00
Dmitry Stogov
1ffbb7372a Better specialization for packed/hash arrays
- improved packed/hash inference.
- added hash guards for ASSIGN_DIM, ASSIGN_DIM_OP, FETCH_DIM_W* instructions
- more accurate invariant type guards motion
- invariant packed/hash guards motion
- rename MAY_BE_ARRAY_HASH into MAY_BE_ARRAY_NUMERIC_HASH and add MAY_BE_ARRAY_STRING_HASH
- cleanup
2021-08-13 14:30:41 +03:00
Dmitry Stogov
aaa14501f8 Make private functions "static" and remove unused zend_inference_check_recursive_dependencies(). 2021-08-11 16:07:21 +03:00
Dmitry Stogov
14c103d7c5 Optimize "$x * 2" into "$x + $x" 2021-08-11 11:53:28 +03:00
Nikita Popov
315f40942b
Always use CE_CACHE, remove TYPE_HAS_CE (#7336)
Currently, CE_CACHE on strings is only used with opcache interned strings. This
patch extends usage to non-opcache interned strings as well. This means that
most type strings can now make use of CE_CACHE even if opcache is not loaded,
which allows us to remove TYPE_HAS_CE kind, and fix some discrepancies
depending on whether a type stores a resolved or non-resolved name.

There are two cases where CE_CACHE will not be used:

 * When opcache is not used and a permanent interned string (that is not an
   internal class name) is used as a type name during the request. In this case
   we can't allocate a map_ptr index for the permanent string, as it would be
   not be in the permanent map_ptr index space.
 * When opcache is used but the script is not cached (e.g. eval'd code or
   opcache full). If opcache is used, we can't allocate additional map_ptr
   indexes at runtime, because they may conflict with indexes allocated by
   opcache.

In these two cases we would end up not using CE caching for property types
(argument/return types still have the separate cache slot).
2021-08-11 10:28:52 +02:00
Nikita Popov
a4e206808c Use zend_string_equals_literal_ci() 2021-08-10 15:52:28 +02:00