Commit Graph

217 Commits

Author SHA1 Message Date
Mikhail Galanin
9bea5f443b Add "Start time", "Last restart time" and "Last force restart time" to phpinfo()
for opcache.

Closes GH-9475.
2022-09-05 17:54:47 +01:00
Arnaud Le Blanc
fb242f41ba
Fix high opcache.interned_strings_buffer causing shm corruption (#9260) 2022-09-03 11:23:10 +02:00
Christoph M. Becker
9313cd899e
Don't enforce 64 hit counter on Windows
There is no particular need to have a 64bit hit counter on Windows.

Closes GH-9367.
2022-08-22 17:49:30 +02:00
Arnaud Le Blanc
efc8f0ebf8
Deprecate zend_atol() / add zend_ini_parse_quantity() (#7951)
Add zend_ini_parse_quantity() and deprecate zend_atol(), zend_atoi()

zend_atol() and zend_atoi() don't just do number parsing.
They also check for a 'K', 'M', or 'G' at the end of the string,
and multiply the parsed value out accordingly.

Unfortunately, they ignore any other non-numerics between the
numeric component and the last character in the string.
This means that numbers such as the following are both valid
and non-intuitive in their final output.

* "123KMG" is interpreted as "123G" -> 132070244352
* "123G " is interpreted as "123 " -> 123
* "123GB" is interpreted as "123B" -> 123
* "123 I like tacos." is also interpreted as "123." -> 123

Currently, in php-src these functions are used only for parsing ini values.

In this change we deprecate zend_atol(), zend_atoi(), and introduce a new
function with the same behavior, but with the ability to report invalid inputs
to the caller. The function's name also makes the behavior less unexpected:
zend_ini_parse_quantity().

Co-authored-by: Sara Golemon <pollita@php.net>
2022-06-17 14:12:53 +02:00
George Peter Banyard
926407f224
Fix some MSAN complaints under Clang (#8553) 2022-05-13 23:30:20 +01:00
Tony Su
2c4b9e995a
[JIT] Print out more meaningful warning message
* [JIT] Print out more meaningful warning message

When the setting value is out of range for jit_hot_loop, jit_hot_func,
jit_hot_return, and jit_hot_side_exit, current PHP only prints out
warning message like:
    Warning: Invalid "opcache.jit_hot_loop" setting.
    Should be between 0 and 256 in Unknown on line 0

With this small patch, PHP can print out more meaningful information,
and tell user default value will be used and correct value range, like
    Warning: Invalid "opcache.jit_hot_loop" setting; using default value instead.
    Should be between 0 and 255 in Unknown on line 0

This patch has been verified on my local machine.

Signed-off-by: Su, Tao <tao.su@intel.com>

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-7955.
2022-01-18 11:41:50 +01:00
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
09efad615b
Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
Dmitry Stogov
8ed8cf86a9 Use zend_string* instead of char* 2021-03-22 14:56:16 +03:00
Dmitry Stogov
c732ab400a Change Zend Stream API to use zend_string* instead of char*.
This allows to eliminate re-calculation of string lenght and hash value.
See the detailed list of changes in UPGRADING.INTERNALS.
2021-03-16 20:31:36 +03:00
Dmitry Stogov
4b59071844 Switch to new ZPP 2021-03-04 02:11:21 +03:00
Dmitry Stogov
ac7e967b67 Reduce ZPP API overhead 2021-02-20 13:59:29 +03:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Nikita Popov
0571f09424 Rename opcache.jit_max_loops_unroll to opcache.jit_max_loop_unrolls 2020-11-02 12:25:21 +01:00
Benjamin Eberlei
53ef244923 Add opcache.jit=tracing|function values, make on/yes/true synonym for tracing. 2020-08-04 10:15:22 +02:00
Dmitry Stogov
8a42f357bf Replace ZEND_JIT_TRACE_MAX_EXIT_COUNTERS constant by opcache.jit_max_exit_counters configuration directive 2020-07-28 11:18:18 +03:00
Nikita Popov
eb04cb5f20 Move checks after zpp in opcache_is_script_cached() 2020-07-22 10:52:50 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Dmitry Stogov
e9f295ac84 Tracing JIT support for megamorphic calls 2020-06-09 23:33:22 +03:00
Christoph M. Becker
d23cd354c0 Fix #79665: ini_get() and opcache_get_configuration() inconsistency
Overriding the given INI values in modifier callbacks is not possible,
so instead of enforcing "normalized" internal values, we just reject
the attempted changes.
2020-06-03 11:07:25 +02:00
Dmitry Stogov
efbe96166d Split "opcache.jit_max_recursion_unroll" into "opcache.jit_max_recursive_calls" and "opcache.jit_max_recursive_returns".
It's possible to disable recording of "recursive return loops" setting opcache.jit_max_recursive_returns to 0.
2020-05-28 12:28:05 +03:00
Dmitry Stogov
2dfd6cd373 Allow counter settings to be "zero" to disable corresponding counter 2020-05-21 01:06:50 +03:00
Nikita Popov
0a74da385d Add support for replaying warnings in opcache
If opcache.record_warnings is enabled, opcache will record
compilation warnings and replay them when the file is included
again. The primary use case I have in mind for this is automated
testing of the opcache file cache.

This resolves bug #76535.
2020-05-20 11:20:21 +02:00
Dmitry Stogov
928c796290 Make number of root and side traces configurable 2020-05-20 01:40:01 +03:00
Nikita Popov
74ef4bd7ed Fix opcache_get_configuration() test 2020-05-19 14:12:30 +02:00
Dmitry Stogov
8c19e611aa Make JIT parameters configurable through opcache.jit_... options 2020-05-19 13:35:02 +03:00
Dmitry Stogov
0695048e20 JIT refactoring to allow run-time changes of JIT options (triggers, optimization_level, debug flags, etc) 2020-05-18 10:23:06 +03:00
Christoph M. Becker
3689807998 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79588: Boolean opcache settings ignore on/off values
2020-05-12 19:50:16 +02:00
Christoph M. Becker
129fd647a1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79588: Boolean opcache settings ignore on/off values
2020-05-12 19:48:12 +02:00
Christoph M. Becker
5bdb4ab786 Fix #79588: Boolean opcache settings ignore on/off values
We should display boolean INI settings as boolean.
2020-05-12 19:44:39 +02:00
Nikita Popov
41c7d28c11 Add macro to get ini target address 2020-04-27 10:30:00 +02:00
Máté Kocsis
21cfa03f17
Generate function entries for another batch of extensions
Closes GH-5352
2020-04-05 21:15:30 +02:00
Máté Kocsis
345703724c
Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Christoph M. Becker
9b9fac78b0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78429: opcache_compile_file(__FILE__); segfaults
2019-09-16 16:01:49 +02:00
Christoph M. Becker
20f73d3d8f Fix #78429: opcache_compile_file(__FILE__); segfaults
We have to ensure that OPcache has been properly started up when
`opcache_compile_file()` is called.
2019-09-16 16:01:09 +02:00
Dmitry Stogov
3be83233c3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Execute preload script under user defined by opcache.preload_user directive
2019-09-03 14:23:44 +03:00
Dmitry Stogov
5dc37cc306 Execute preload script under user defined by opcache.preload_user directive 2019-09-03 14:23:13 +03:00
Nikita Popov
65fa6dac19 Add jit_bisect_limit
To help identify which function is being miscompiled.
2019-08-30 14:50:22 +02:00
Christoph M. Becker
0ab4fca8e3 Add ext\opcache stubs 2019-08-26 16:05:01 +02:00
Christoph M. Becker
54401001a8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Allow multiple cache instances per user/host on Windows
2019-07-17 19:52:49 +02:00
Christoph M. Becker
e2ed7e6716 Allow multiple cache instances per user/host on Windows
Formerly, there was at most a single OPcache instance per user and the
so called system ID (which is determined from the PHP version).
Sometimes multiple OPcaches might be desired, though, particularly for
unrelated CLI scripts, which may even be necessary (e.g. for our test
suite in parallel mode).

We therefore introduce a new INI directive `opcache.cache_id` which
allows to configure independent OPcache instances for the same user.

We also use `GetUserNameW()` instead of `php_win32_get_username()`,
because the latter retrieves the user name encoded in the
`default_charset`, which can obviously yield different results for
different charsets, leading to OPcache "incompatibilities".  Slightly
worse, some characters may not even be encodeable in the
`default_charset` and would be replaced by question marks, which could
result in different users sharing the same OPcache.

We also refactor, and re-use existing APIs to avoid duplicated code.
2019-07-17 19:51:07 +02:00
Nikita Popov
3faa903d47 Merge branch 'PHP-7.4' 2019-07-16 16:44:46 +02:00
Nikita Popov
49bac9b77b Introduce zend_stream_init_filename()
Avoid more ad-hoc initialization of zend_file_handle structures.
2019-07-16 16:44:37 +02:00
Nikita Popov
760308cbff Fix build without jit 2019-07-16 10:26:25 +02:00
Nikita Popov
8a10258a53 Merge branch 'PHP-7.4' 2019-07-15 10:33:31 +02:00
Nikita Popov
a520c24269 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-15 10:29:37 +02:00
Nikita Popov
3eb057c4a7 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-15 10:23:51 +02:00
Andrew Collington
768ad70f70 Fix bug #78291 Missing opcache directives
New opcache directives have been added recently which are returned
if using `ini_get_all('zend opcache')` but are not listed in the
directives if using `opcache_get_configuration()`.  This fix adds
those missing directives as well as if `opcache.mmap_base` is used
instead of `opcache.lockfile_path`.  Also adds a test to ensure the
directives match with both methods of fetching.
2019-07-15 10:22:47 +02:00