1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 19:52:20 +02:00
Commit Graph

99 Commits

Author SHA1 Message Date
Nikita Popov
2f92957fd3 Convert some notices to warnings
Part of https://wiki.php.net/rfc/engine_warnings.
2019-10-02 10:34:08 +02:00
Nikita Popov
27ad0efb58 Revert "Save opline before fallible arg type check in recv_init jit"
This reverts commit b09bddcaa5.

This causes test failures on macos -- presumably the relevant
difference is that it has no global regs. I suspect that this
is related to the fact that SAVE_VALID_OPLINE may use r0 as
a scratch register, which is already in use. Reverting for now.
2019-10-01 22:16:56 +02:00
Nikita Popov
b09bddcaa5 Save opline before fallible arg type check in recv_init jit
The verify arg functions may throw an exception, so we need to save
the opline beforehand. Asan failures could be observed in
Zend/tests/type_declarations/scalar_constant_defaults.phpt
with a ZTS build.
2019-10-01 17:19:27 +02:00
Nikita Popov
01fc1a3057 Remove most uses of the ERROR type
It is now only used to signal exceptions for property reads. ERROR
zvals are never returned back to the VM anymore, so there's no
need to check for them when receiving a VAR.

Also return MAY_BE_ERROR, as ERROR is now no longer relevant for
inference.
2019-09-30 11:35:07 +02:00
Nikita Popov
e8b0163e0b Promote write "use scalar as array" warning to Error 2019-09-27 15:49:18 +02:00
Nikita Popov
0ebf2bdba0 Convert "Illegal offset type" warnings to exceptions 2019-09-27 13:00:07 +02:00
Nikita Popov
f2b09969db Convert "cannot add element" warning to exception 2019-09-27 13:00:07 +02:00
Dmitry Stogov
7d7b20ea91 Don't generate useless stubs 2019-09-26 23:21:48 +03:00
Dmitry Stogov
1030ff5f5f Use cheaper code for scalar type check 2019-09-23 23:04:08 +03:00
Dmitry Stogov
6e226c188c Change ZEND_RECV and ZEND_RECV_VARIADIC to use extended_value for cache slot (instead of op2), to be consistent with ZEND_RECV_INIT. 2019-09-23 22:28:56 +03:00
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
Dmitry Stogov
ddfb3d6056 Fixed 32-bit JIT 2019-09-19 21:53:36 +03:00
Nikita Popov
cdd4e591a4 Don't make argument nullable based on AST null initializer
Closes GH-4720.
2019-09-19 11:27:00 +02:00
Dmitry Stogov
2aefd11211 Optimize access to thread local cache.
This patch saves one CPU instruction on each "_tsrm_ls_cache" access in ZTS CLI/CGI/FPM builds.
This reduce typical instruction sequence for EG(current_execute_data) access from 4 to 3 CPU instructions.
2019-09-18 14:03:07 +03:00
Dmitry Stogov
628fd6ec71 clenup 2019-09-09 22:40:28 +03:00
Dmitry Stogov
f43fe067e9 Avoid hash value recalculation on each counter update 2019-09-09 21:25:54 +03:00
Nikita Popov
ee4b11c668 Detect calls to abstract methods in get_method() already
Instead of checking for this during DO_FCALL, already detect this
case during get_method()/get_static_method(), similar to visibility
checks.

This causes a minor difference in behavior, in that arguments will
no longer be evaluated. I think this is correct though (and consistent
with visibility errors).
2019-09-06 15:05:24 +02:00
Nikita Popov
d9750ac41e Load execute_data without global regs 2019-09-05 10:46:50 +02:00
Nikita Popov
5d490742cb Fix deprecated args freeing with JIT
I'm including the logic for this rare case in the helper function
to avoid complicating the main JIT logic.
2019-09-05 10:05:46 +02:00
Nikita Popov
24b1c2447c JIT: Fix missing free on JMPZ_EX with op1 == res
We need to free the operand before we overwrite it with the result.
2019-08-30 14:50:22 +02:00
Nikita Popov
65fa6dac19 Add jit_bisect_limit
To help identify which function is being miscompiled.
2019-08-30 14:50:22 +02:00
Nikita Popov
8239b58bea Fix closure extra args freeing for JIT as well 2019-08-30 10:35:41 +02:00
Dmitry Stogov
3cc6dd9c76 Fixed JIT 2019-07-19 10:50:51 +03:00
Nikita Popov
cf7dd00280 Drop support for JIT without SSE
Closes GH-4388.
2019-07-10 17:31:51 +02:00
Nikita Popov
36235cf5d7 Read from original address
References are derefed into FCARG1, which is later clobbered by the
undef handling code. Make sure we load from the original address
instead.
2019-07-10 14:13:29 +02:00
Nikita Popov
26431d1995 Implement array access notice in JIT 2019-07-10 12:20:16 +02:00
Dmitry Stogov
db02d7ae75 Reduce cost for GC references to strings and resources in JIT 2019-07-10 12:41:19 +03:00
Nikita Popov
3ee570ae0d Remove redundant variable declaration 2019-07-08 12:50:00 +02:00
David Carlier
5e13688142 JIT: Reading php binary symbols list on FreeBSD
Closes GH-4363.
2019-07-08 12:39:18 +02:00
Nikita Popov
da8b583ac1 Always generate interrupt check in jit
Even if zend_interrupt_function is NULL, we still need to perform
the interrupt check for timeouts (which do not use
zend_interrupt_function).
2019-07-05 20:52:30 +02:00
Dmitry Stogov
1b5b8175af Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace ZEND_ASSIGN_ADD (and others) by ZEND_ASSIGN_OP, ZEND_ASSIGN_DIM_OP, ZEND_ASSGIN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP
2019-07-05 12:16:30 +03:00
Nikita Popov
4a8fe02c7c Undef opline result on mod/shift error in jit 2019-07-01 10:15:06 +02:00
Nikita Popov
b7ed20662e Fix out of bounds read in jit_fetch_obj_read 2019-07-01 09:54:21 +02:00
Nikita Popov
7a1ca07a60 Don't try to exclude zreg_none
zreg_none has no representation in the regset, so this operation
doesn't make sense.
2019-06-21 10:24:58 +02:00
Nikita Popov
291eb19419 Dasm: Perform unaligned stores through unaligned pointers 2019-06-21 09:47:25 +02:00
Nikita Popov
42f3ed480d Avoid shift ub for regsets 2019-06-20 17:24:32 +02:00
Nikita Popov
bb940d9969 Avoid UB in overflow checks
Some of the overflow checks in zend_may_overflow were optimized
away by clang, causing JIT failures on release macos.
2019-06-19 12:02:42 +02:00
Dmitry Stogov
22b2d9d088 Fixed JIT failure, on ZTS build without global register vatriables 2019-06-18 13:52:52 +03:00
Dmitry Stogov
7a236b6761 Attempt to fix JIT on Mac OSX ZTS build 2019-06-17 17:08:58 +03:00
Nikita Popov
4d90848d68 Don't verify arginfo types for internal functions
To avoid duplicate type checks. In debug builds arginfo is still
checked and will generate an assertions if the function doesn't
subsequently throw an exception.

Some test results change due to differences in zpp and arginfo
error messages.
2019-06-17 11:46:28 +02:00
Dmitry Stogov
5883dbcb18 Fixed incorect register allocation in ZTS build 2019-06-14 00:29:22 +03:00
Nikita Popov
3b27689d46 Fix helper call on 32-bit
This is using the fast-call calling convention. Use FCARG1a and
same code for 32-bit and 64-bit.
2019-06-13 12:11:23 +02:00
Nikita Popov
792e38d863 Fix bug #78154 with JIT 2019-06-13 11:53:31 +02:00
Nikita Popov
51d82da6b0 Suppress -Wtautological-compare in dasc file 2019-06-13 09:59:42 +02:00
Nikita Popov
39034dbc67 Determine thread ID on macos
Also initialize the variable to 0 -- I don't think we really care
if this is not determine on some platform, but it should at least
not be uninitialized.
2019-06-13 09:59:42 +02:00
Nikita Popov
e4fae9c061 Merge branch 'PHP-7.4' 2019-06-11 13:16:38 +02:00
Nikita Popov
45a0656e95 Remove get() object handler
Now that set() is gone, there is little point in keeping get(), as
it is essentially just a different way of writing cast_object()
now.

Closes GH-4202.
2019-05-29 17:15:19 +02:00
Nikita Popov
b7a6430a52 Don't JIT functions with many blocks
Avoids a stack overflow in Zend/tests/runtime_compile_time_binary_operands.php
that happens in recursive RPO calculation. We could make that code
non-recursive, but I don't think it makes sense to JIT this kind of
function in the first place.
2019-05-29 11:49:44 +02:00
Nikita Popov
4d1d5babde Respect optimization_level when running JIT inference
Don't enable unsafe type inference by default -- we'll segfault on
some FFI tests.
2019-05-28 17:29:28 +02:00
Nikita Popov
0bd1fc225d JIT: Fix SWITCH_LONG/STRING codegen with exact type
We were not loading the operand if the type was known exactly.
2019-05-28 15:25:19 +02:00