Commit graph

776 commits

Author SHA1 Message Date
Christoph M. Becker
2a545ba946 Fix #80175: PHP8 RC1 - JIT Buffer not working
On Windows, `SUCCESSFULLY_REATTACHED` does not imply that the process
has already been properly initialized; thus we must not skip some setup
steps in `zend_jit_startup()`.

Closes GH-6268.
2020-10-10 17:46:59 +02:00
Dmitry Stogov
739eb435c2 Tracing JIT support for preloaded scripts 2020-09-29 15:07:45 +03:00
Dmitry Stogov
8d9da8df28 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed unintended disabling of Optimizer for preloaded scripts introduced by 4a2646cf45
2020-09-29 12:13:17 +03:00
Dmitry Stogov
3928b6b435 Fixed unintended disabling of Optimizer for preloaded scripts introduced by 4a2646cf45 2020-09-29 12:11:01 +03:00
Sammy Kaye Powers
12306728c5
Add system ID entropy API
The `zend_system_id` is a (true global) system ID that fingerprints a process state. When extensions add engine hooks during MINIT/startup, entropy is added the system ID for each hook. This allows extensions to identify that changes have been made to the engine since the last PHP process restart.

Closes GH-5871
2020-09-18 14:26:44 -07:00
Dmitry Stogov
d5d31ea3b3 Cleanup observer API and add JIT support 2020-09-18 12:55:58 +03:00
Christoph M. Becker
f51bbcc2b2 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Avoid segfault if module/extension version is not defined
2020-09-14 22:36:00 +02:00
Christoph M. Becker
15236fb83e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Avoid segfault if module/extension version is not defined
2020-09-14 22:34:58 +02:00
Christoph M. Becker
4e198c0064 Avoid segfault if module/extension version is not defined 2020-09-14 22:34:10 +02:00
Sammy Kaye Powers
3375374c33
Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
2020-09-09 13:00:25 -07:00
Sammy Kaye Powers
1b5268265c
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
2020-09-09 12:36:51 -07:00
Sammy Kaye Powers
2d4aa1ef3d
Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
Modules may have changed after restart which can cause dangling pointers from custom opcode handlers in the second-level cache files. This fix includes the installed module names and versions in the accel_system_id hash as entropy. Closes GH-5836
2020-09-09 12:08:19 -07:00
Christoph M. Becker
5fdabeb969 Fix Windows build 2020-09-03 15:31:44 +02:00
Nikita Popov
7620ea1580 Don't intern compiled_filename
For php-ast interning the file name is an effective memory leak,
see php-ast#134.

I don't think there's any reason to do this. At some point this
was needed due to bugs in the interned string mechanism that
caused issues if the string was later interned, e.g. through a
__FILE__ reference. These issues have since been resolved.

In conjunction with the filenames_table removal in c4016ecd44
this means that filenames now need to be refcounted like normal
strings. In particular the filename reference in op_arrays and CEs
are refcounted.
2020-09-03 12:31:23 +02:00
Levi Morrison
66c3e900e2 Add zend_observer API
Closes GH-5857.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Co-authored-by: Sammy Powers <sammyk@datadoghq.com>
2020-09-01 09:59:59 -06:00
George Peter Banyard
fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
Christoph M. Becker
08d2e511e4 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #80002: calc free space for new interned string is wrong
2020-08-24 11:04:27 +02:00
Christoph M. Becker
10df94dd0e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80002: calc free space for new interned string is wrong
2020-08-24 11:04:03 +02:00
Christoph M. Becker
fcd26ffcc3 Fix #80002: calc free space for new interned string is wrong
We need to calculate the free size in bytes.

Patch contributed by t-matsuno.

Closes GH-6024
2020-08-24 11:03:19 +02:00
Nikita Popov
c439f1fa6a Fixed bug #62294
The primary issue was already resolved in 7c3e487289,
but the particular example used in this bug report ran into an
additional issue on PHP 8, because I forgot to drop a number of
zend_bailout calls when switch require failure to throw.
2020-08-10 12:54:02 +02:00
George Peter Banyard
a1fee87c9a Drop useless zend_accel_script_persistable() function 2020-07-17 17:00:42 +02:00
Nikita Popov
27800441b5 Reduce scope of preload compiler_options
Only set preloading compiler_options while executing the preload
file, not when performing linking afterwards. Otherwise options
like IGNORE_INTERNAL_CLASSES will hide classes from inheritance
verification.
2020-07-14 16:10:04 +02:00
Nikita Popov
06162194d6 Fix preloading property type resolution
This was causing many failures under --preload...
2020-07-14 12:59:04 +02:00
Christoph M. Becker
1a00d015be Remove out-dated comment
ZTS support has been added around ~7.2.
2020-07-13 19:14:59 +02:00
Christoph M. Becker
11a628d96c Fix typos 2020-07-13 19:13:45 +02:00
Dmitry Stogov
a75cf0c7e1 JIT support for opcache restart 2020-07-08 18:14:11 +03:00
Nikita Popov
75a04eac97 Make exit() unwind properly
exit() is now internally implemented by throwing an exception,
performing a normal stack unwind and a clean shutdown. This ensures
that no persistent resource leaks occur.

The exception is internal, cannot be caught and does not result in
the execution of finally blocks. This may be relaxed in the future.

Closes GH-5768.
2020-06-29 15:50:12 +02:00
Dmitry Stogov
bb3d4456ee Change GC_COLLECTABLE flag into GC_NOT_COLLECTABLE to simplify GC_MAY_LEAK() check 2020-06-15 14:26:22 +03:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Nikita Popov
975acfe71e Pass zend_string message to zend_error_cb
This makes the zend_error_cb API simpler, and avoid formatting
the same message in multiple places.

It should be noted that the passed zend_string is always
non-persistent, so if you want to store it persistently somewhere,
you may still need to duplicate it.

The last_error_message is cleared a bit more aggressive, to make
sure it doesn't hang around across allocator life-cycles.

Closes GH-5639.
2020-06-05 09:54:02 +02:00
Dmitry Stogov
95248491af Prefer already cached version of the script 2020-05-20 23:04:34 +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
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
Dmitry Stogov
78b64bd4ed Merge branch 'PHP-7.4'
* PHP-7.4:
  Check asserts early
  identation fix
  Call global code of preloaded script in global context
  Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script
2020-03-13 11:42:07 +03:00
Dmitry Stogov
b6492b4453 identation fix 2020-03-12 22:26:16 +03:00
Dmitry Stogov
3c6e9bed1a Call global code of preloaded script in global context 2020-03-12 22:19:47 +03:00
Dmitry Stogov
2dddab01ae Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script 2020-03-12 16:31:24 +03:00
Nikita Popov
bb85478bcc Merge branch 'PHP-7.4'
* PHP-7.4:
  Try to fix msvc build
2020-02-28 14:49:03 +01:00
Nikita Popov
a7de98fb12 Try to fix msvc build 2020-02-28 14:48:02 +01:00
Nikita Popov
519a72e0b4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79252
2020-02-28 12:49:45 +01:00
Nikita Popov
30ee3f48d4 Fixed bug #79252 2020-02-28 12:47:56 +01:00
Nikita Popov
f57f0920fd Remove ZEND_ACC_IMPLEMENTS_TRAITS flag
This is equivalent to checking ce->num_traits.
2020-02-06 10:45:49 +01:00
Nikita Popov
ebd00c5b65 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79128
2020-01-24 16:20:30 +01:00
Nikita Popov
3291891408 Fixed bug #79128
We need to extend the hash table before performing raw append
operations.

This doesn't matter if preloading happens in the same process,
as the tables will be large enough to hold all entries as a
side-effect of the preloading process. However, if preloading
happens in a different process, we need to reserve space here.
2020-01-24 16:18:48 +01:00
Xinchen Hui
ce5d722a6d Merge branch 'PHP-7.4'
* PHP-7.4:
  Let's make this safer from maliciously crafted filename
2020-01-20 12:35:08 +08:00
Xinchen Hui
2958cdc0b5 Let's make this safer from maliciously crafted filename 2020-01-20 12:33:37 +08:00
Xinchen Hui
5aa12d2e32 Merge branch 'PHP-7.4'
* PHP-7.4:
  minor cleanup
2020-01-20 12:29:23 +08:00
Xinchen Hui
dda2addab2 minor cleanup 2020-01-20 12:28:57 +08:00
Xinchen Hui
31dd635eb3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79114 (Eval class during preload causes class to be only half available)
2020-01-20 12:25:10 +08:00
Xinchen Hui
9c2fd55d01 Fixed bug #79114 (Eval class during preload causes class to be only half available) 2020-01-20 12:24:49 +08:00