Commit graph

776 commits

Author SHA1 Message Date
Nikita Popov
bd1977282c Use zend_type inside type lists
Instead of having a completely independent encoding for type list
entries. This is going to use more memory, but I'm not particularly
concerned about that, as type unions that contain multiple classes
should be uncommon. On the other hand, this allows us to treat
top-level types and types inside lists mostly the same.

A new ZEND_TYPE_FOREACH macros allows to transparently treat list
and non-list types the same way. I'm not using it everywhere it could be
used for now, just the places that seemed most obvious.

Of course, this will make any future type system changes much simpler,
as it will not be necessary to duplicate all logic two times.
2020-01-17 09:37:54 +01:00
Máté Kocsis
0b4778c377
Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Dmitry Stogov
8ee04946f0 typo 2020-01-13 16:25:42 +03:00
Nikita Popov
862a4f3a5e Fix build 2020-01-13 12:42:51 +01:00
Dmitry Stogov
27815959e1 Improve access to zend_map_ptr data 2020-01-13 14:27:35 +03:00
Nikita Popov
9b6c0bdcd6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove support for preloading on Windows
2020-01-06 22:42:31 +01:00
Nikita Popov
59c3ddab13 Remove support for preloading on Windows
Due to ASLR restrictions, preloading on Windows does not work with
any code that has preloading dependencies on internal classes.
This effectively makes it unusable for any non-trivial codebase.

Instead of pretending like preloading is going to work, only to
make people realize that it really doesn't once they get beyond
a dummy example, we disable support for preloading on Windows
entirely.

Closes GH-4999.
2020-01-06 22:41:55 +01:00
Nikita Popov
3262c28d5c Merge branch 'PHP-7.4'
* PHP-7.4:
  Also propagate include exceptions in opcache
  Make url_stats in resolve_path quiet
2019-12-30 23:22:39 +01:00
Nikita Popov
22e9f9fe4d Also propagate include exceptions in opcache 2019-12-30 23:22:26 +01:00
Dmitry Stogov
1e53769d82 Set opcode handler 2019-12-23 14:14:47 +03:00
Dmitry Stogov
ee45dbab37 Merge branch 'PHP-7.4'
* PHP-7.4:
  Addirional fix for bug #78918
2019-12-11 12:29:10 +03:00
Dmitry Stogov
3280209c03 Addirional fix for bug #78918 2019-12-11 12:21:49 +03:00
Dmitry Stogov
764c8159b7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix error message
2019-12-10 22:17:42 +03:00
Dmitry Stogov
518a8f89c1 Fix error message 2019-12-10 22:17:10 +03:00
Nikita Popov
c2d92ad971 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix incorrect zend_try usage
2019-12-10 15:22:46 +01:00
Nikita Popov
5ddcacac2e Fix incorrect zend_try usage 2019-12-10 15:22:31 +01:00
Nikita Popov
fa18c115be Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix release build failure
2019-12-10 13:53:19 +01:00
Nikita Popov
d6f86caa11 Fix release build failure
GCC complained about potentially uninitialized __orig_bailout,
even though the variable has an initializer. This warning was
quite persistent, I was only able to avoid it by using a separate
function.

Am I missing something?
2019-12-10 13:51:09 +01:00
Christoph M. Becker
f2dbe4297b Merge branch 'PHP-7.4'
* PHP-7.4:
  Improve error message
2019-12-10 13:20:55 +01:00
Christoph M. Becker
9e22c3d4d9 Improve error message
Formerly, the error message was like:

| Can't preload unlinked class MyException: Internal parent (Windows
| only limitation)Exception

Now it's like:

| Can't preload unlinked class MyException: Windows can't link to
| internal parent Exception
2019-12-10 13:19:58 +01:00
Nikita Popov
5cdea8d5e8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add support for class_alias to preloading
  Fixed bug #78935: Check that all linked classes can be preloaded
2019-12-10 13:12:29 +01:00
Nikita Popov
3f86adb0ef Fixed bug #78935: Check that all linked classes can be preloaded
During preloading, check that all classes that have been included
as part of the preload script itself (rather than through opcache_compile_file)
can actually be preloaded, i.e. satisfy Windows restrictions, have
resolved initializers and resolved property types. When resolving
initializers and property types, also autoload additional classes.
Because of this, the resolution runs in a loop.
2019-12-10 13:05:48 +01:00
Nikita Popov
7b34e30b9a Merge branch 'PHP-7.4'
* PHP-7.4:
  Preload: Better reason message for internal parents on windows
2019-12-04 09:53:08 +01:00
Nikita Popov
7cbf31a3c7 Preload: Better reason message for internal parents on windows
Related to bug #78881.
2019-12-04 09:52:40 +01:00
Adam Saponara
b35acd30f2 Fix misleading error message in ZendAccelerator.c.
Currently this error emits something like...

`Error Cannot kill process 12345: Success!`

...due to calling `time` before `strerror` which clears `errno`. This
patch adds an error log immediately after both `kill` calls which gives
us better indication of what exactly failed.
2019-12-02 10:06:32 +01:00
Nikita Popov
999e32b65a Implement union types
According to RFC: https://wiki.php.net/rfc/union_types_v2

The type representation now makes use of both the pointer payload
and the type mask at the same time. Additionall, zend_type_list is
introduced as a new kind of pointer payload, which is used to store
multiple class types. Each of the class types is a tagged pointer,
which may be either a class name or class entry. The latter is only
used for typed properties, while arguments/returns will instead use
cache slots. A type list can contain a mix of both names and CEs at
the same time, as not all classes may be resolvable.

One thing this is missing is support for union types in arginfo
and stubs, which I want to handle separately.

I've also dropped the special object code from the JIT implementation
for now -- I plan to add this back in a different form at a later time.
For now I did not want to include non-trivial JIT changes together
with large functional changes.

Another possible piece of follow-up work is to implement "iterable"
as an internal alias for "array|Traversable". I believe this will
eliminate quite a few special-cases that had to be implemented.

Closes GH-4838.
2019-11-08 15:15:48 +01:00
Nikita Popov
ac4e0f0852 Make zend_type a 2-field struct
We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.

To avoid increasing the size of arginfo structures, the
pass_by_reference and is_variadic fields are now stored as part of
the type_mask (8-bit are reserved for custom use).

Different types of pointer payloads are distinguished based on bits
in the type_mask.
2019-11-08 15:15:48 +01:00
Dmitry Stogov
626a5837c0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Allow loading FFI bindings through ffi.preload directive
2019-10-22 17:53:24 +03:00
Dmitry Stogov
1417352dda Allow loading FFI bindings through ffi.preload directive 2019-10-22 17:52:56 +03:00
Dmitry Stogov
42f4bdba2a Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78512 (Cannot make preload work)
2019-10-21 14:53:03 +03:00
Dmitry Stogov
05c5e5dfde Fixed bug #78512 (Cannot make preload work) 2019-10-21 14:52:26 +03:00
Dmitry Stogov
daac578b51 Fixed JIT of preloaded script 2019-10-11 12:54:07 +03:00
Nikita Popov
f61f122b9a Merge branch 'PHP-7.4' 2019-09-12 16:41:45 +02:00
Nikita Popov
4b9ebd837b Allow throwing exception while loading parent class
This is a fix for symfony/symfony#32995.

The behavior is:

* Throwing exception when loading parent/interface is allowed
  (and we will also throw one if the class is simply not found).
* If this happens, the bucket key for the class is reset, so
  it's possibly to try registering the same class again.
* However, if the class has already been used due to a variance
  obligation, the exception is upgraded to a fatal error, as we
  cannot safely unregister the class stub anymore.
2019-09-12 16:41:18 +02:00
Nikita Popov
c70bab7b24 Merge branch 'PHP-7.4' 2019-09-11 09:53:18 +02:00
Nikita Popov
0a24cd4e7c Preloading: Fix handling of static vars in inherited methods
Part of bug #78512.
2019-09-11 09:53:10 +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
Dmitry Stogov
f64650408a Merge branch 'PHP-7.4'
* PHP-7.4:
  typo
2019-08-06 13:58:29 +03:00
Dmitry Stogov
ef35556498 typo 2019-08-06 13:58:17 +03:00
Dmitry Stogov
e2440c3da5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Preloading is not comatible with dl() function
2019-08-06 12:45:48 +03:00
Dmitry Stogov
d5d76ea6e7 Preloading is not comatible with dl() function 2019-08-06 12:44:55 +03:00
Dmitry Stogov
d6a8a5ac64 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78376 (Incorrect preloading of constant static properties)
2019-08-05 22:56:03 +03:00
Dmitry Stogov
3fc0e2bb80 Fixed bug #78376 (Incorrect preloading of constant static properties) 2019-08-05 22:55:06 +03:00
Christoph M. Becker
7548421202 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix build for --disable-signals
2019-07-29 18:50:13 +02:00
Christoph M. Becker
3429370d69 Fix build for --disable-signals 2019-07-29 18:49:44 +02:00
Nikita Popov
9a3aef3c21 Merge branch 'PHP-7.4' 2019-07-29 17:15:35 +02:00
Nikita Popov
6df1665bb3 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-29 17:14:40 +02:00
Nikita Popov
bbed5564eb Merge branch 'PHP-7.2' into PHP-7.3 2019-07-29 16:57:57 +02:00
Nikita Popov
38f1288b64 Fix Zend signals unblocking
There are a few parts here:
 * opcache should not be blocking signals while invoking compile_file,
   otherwise signals may remain blocked on a compile error. While at
   it, also protect SHM memory during compile_file.
 * We should deactivate Zend signals at the end of the request, to make
   sure that we gracefully recover from a missing unblock and signals
   don't remain blocked forever.
 * We don't use a critical section in deactivation, because it should
   not be necessary. Additionally we want to clean up the signal queue,
   if it is non-empty.
 * Enable SIGG(check) in debug builds so we notice issues in the future.
2019-07-29 15:17:32 +02:00