Commit Graph

109 Commits

Author SHA1 Message Date
Nikita Popov
9e8ba7891e Change representation of zend_type from type code to MAY_BE_* mask
This switches zend_type from storing a single IS_* type code to
storing a MAY_BE_* type mask. Right now most code still assumes
that there is only a single type in the mask (or two together
with MAY_BE_NULL). But this will make it a lot simpler to introduce
union types.

An additional advantage (and why I'm doing this separately), is
that a number of special cases no longer need to be handled
separately: We can do a single mask & (1 << type) check to handle
all simple types, booleans (true|false) and null.
2019-09-23 15:31:35 +02:00
Nikita Popov
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Dmitry Stogov
fd4e2e77dc Merge branch 'PHP-7.4'
* PHP-7.4:
  ARM64 may be big endian
2019-05-13 13:34:07 +03:00
Dmitry Stogov
3322ae2eb2 ARM64 may be big endian 2019-05-13 13:33:03 +03:00
Dmitry Stogov
8f4f5fc040 Merge branch 'PHP-7.4'
* PHP-7.4:
  Load 8 bytes at a time in hash_func. (Sebastian Pop)
2019-05-13 12:36:49 +03:00
Dmitry Stogov
071793a0bb Load 8 bytes at a time in hash_func. (Sebastian Pop) 2019-05-13 12:34:53 +03:00
Dmitry Stogov
370f4e4c6f Merge branch 'PHP-7.4'
* PHP-7.4:
  Improve PHP hash function. See Daniel Lemire's blog post https://lemire.me/blog/2016/07/21/accelerating-php-hashing-by-unoptimizing-it/
2019-05-08 16:48:42 +03:00
Dmitry Stogov
90e285f6fd Improve PHP hash function.
See Daniel Lemire's blog post https://lemire.me/blog/2016/07/21/accelerating-php-hashing-by-unoptimizing-it/
2019-05-08 16:47:12 +03:00
Nikita Popov
c4e4ef0498 Merge branch 'PHP-7.4' 2019-03-18 16:58:59 +01:00
Nikita Popov
2b9acd37f0 Fixed bug #72685
We currently have a large performance problem when implementing lexers
working on UTF-8 strings in PHP. This kind of code tends to perform a
large number of matches at different offsets on a single string. This
is generally fast. However, if /u mode is used, the full string will
be UTF-8 validated on each match. This results in quadratic runtime.

This patch fixes the issue by adding a IS_STR_VALID_UTF8 flag, which
is set when we have determined that the string is valid UTF8 and
further validation is skipped.

A limitation of this approach is that we can't set the flag for interned
strings. I think this is not a problem for this use-case which will
generally work on dynamic data. If we want to use this flag for other
purposes as well (mbstring?) then it might be worthwhile to UTF-8 validate
strings during interning. But right now this doesn't seem useful.
2019-03-18 16:58:48 +01:00
Peter Kokot
18295b396f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix typos in code comments in Zend/ [skip ci]
2019-02-18 17:56:38 +01:00
Tyson Andre
da3316ff0f Fix typos in code comments in Zend/ [skip ci] 2019-02-18 17:56:28 +01:00
Peter Kokot
623911f993 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove local variables
2019-02-03 21:23:18 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Nikita Popov
0dfd918ee7 Remove support for __autoload()
There are probably some improvements we can do to the SPL
implementation now that __autoload() is gone. In particular having
EG(autoload_func) as a property zend function, rather than a simple
callback probably doesn't make sense.
2019-01-30 14:00:16 +01:00
Zeev Suraski
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Zeev Suraski
02557f87bc Adios, yearly copyright ranges 2019-01-30 11:23:29 +02:00
Nikita Popov
12cbe930cd Merge branch 'PHP-7.3' 2018-11-13 12:31:44 +01:00
Jan Rękorajski
f76be1a0d6 Fix compilation on x32
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
2018-11-13 12:31:00 +01:00
Remi Collet
dbef28ea8f Merge branch 'PHP-7.3'
* PHP-7.3:
  NEWS
  Fix: #77110 undefined symbol zend_string_equal_val in C++ build
2018-11-05 17:06:49 +01:00
Remi Collet
d53ecd040b Fix: #77110 undefined symbol zend_string_equal_val in C++ build 2018-11-05 17:05:49 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +02:00
Dmitry Stogov
33e777acbf Improved shared interned strings handling. The previous implementation worked incorrectly in ZTS build. It changed strings only in function/class tables of one thread. Now all threads gets the same shared interned strings. Also, on shutdown, we don't try to replace SHM interned strings back to process strings, but delay dettachment of SHM instead. 2018-10-25 20:30:51 +03:00
Peter Kokot
be49d61b19 Remove old SVN keywords substitutions
When the PHP source code was versioned in Subversion, there was
possible to substitute certain keywords such as $Id$ with revision
number, last change time and author name. Such approach is not used
in Git so this patch removes these outdated artifacts from source
code files.
2018-06-16 13:04:30 +02:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Dmitry Stogov
858d545ce6 micro optimization 2018-05-08 00:22:04 +03:00
Dmitry Stogov
cb464a53c8 Use "fastcall" calling convention 2018-04-04 01:12:59 +03:00
Dmitry Stogov
a89eb2f101 Removed commented unoptimized code 2018-01-22 16:14:56 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Nikita Popov
b6581038eb Use GC_FLAGS_SHIFT in a few more places
Rather than hardcoding 8.
2017-12-30 23:40:25 +01:00
Dmitry Stogov
8305a73483 Implemented x86 and x86_64 assembler functions for zend_string equality check.
They take into account zend_string layout (value alignment and trailing padding) and perform comparison by double or quad words.
2017-12-04 23:40:54 +03:00
Dmitry Stogov
74c84cd7f0 Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage. 2017-12-04 17:17:02 +03:00
Dmitry Stogov
7cc6f60134 Added "argv" and "argc" as known strings.
Fixed incorrect "argc" update and corresponding phpdbg test.
2017-12-01 01:35:47 +03:00
Dmitry Stogov
f2b91b31e4 Switch back from "request" interned strings storage to "permanent" in MSHUTDOWN 2017-11-02 23:29:21 +03:00
Nikita Popov
5b044aacbe Use known strings for reflection properties 2017-10-31 15:46:55 +01:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Dmitry Stogov
272f5a1716 Extend zend_string API to avoid reallocation in zend_string_init_interned() 2017-10-19 00:02:56 +03:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Dmitry Stogov
f00d1c72b4 Added ZEND_GET_CLASS, ZEMD_GET_CALLED_CLASS, ZEND_GET_TYPE instructions, to implement corresponding builtin functions. 2017-05-25 18:41:28 +03:00
Dmitry Stogov
293d99052d Optimized parse_url() by using "known" strings 2017-05-22 23:23:12 +03:00
Anatol Belski
c698299550 Interned strings unification for TS/NTS
Hereby, interned strings are supported in thread safe PHP. The patch
implements two types of interned strings

- interning per process, strings are not freed till process end
- interning per request, strings are freed at request end

There is no runtime interning.

With Opcache, all the permanent iterned strings are copied into SHM on
startup, additional copying into SHM might happen on demand.
2017-03-04 10:39:13 +01:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Anatol Belski
afbb3b858a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  use already exported symbol
  Revert "export symbol missing by phpdbg"
2016-10-13 10:08:10 +02:00
Anatol Belski
3104882cf8 Revert "export symbol missing by phpdbg"
This reverts commit 611ab7fe5b.

Overseen strpprintf is there
2016-10-13 09:50:32 +02:00
Anatol Belski
c762c8f3c0 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  export symbol missing by phpdbg
2016-10-12 22:21:19 +02:00
Anatol Belski
611ab7fe5b export symbol missing by phpdbg 2016-10-12 22:18:41 +02:00
Anatol Belski
47e26cf9db fix known interned strings init with TS per request 2016-06-02 17:55:48 +02:00