Commit graph

249 commits

Author SHA1 Message Date
Nikita Popov
6fd880890c Add exception check to zend_jit_fetch_obj_w_slow()
This ports 247105ae1a to the JIT
implementation. The issue doesn't trigger on the original test
case with JIT, but I ran into a case that does trigger with JIT
once we have typed properties.
2021-07-14 16:56:12 +02:00
George Peter Banyard
069a9fa5e4
Pure Intersection types (#6799)
Implement pure intersection types RFC

RFC: https://wiki.php.net/rfc/pure-intersection-types

Co-authored-by: Nikita Popov <nikic@php.net>
Co-authored-by: Ilija Tovilo <ilutov@php.net>
2021-07-05 14:11:03 +02:00
Dmitry Stogov
973ae8d3e2 Move the whole "cold" path into the "cold" function. 2021-06-23 14:55:58 +03:00
George Peter Banyard
b6958bb847
Implement "Deprecate implicit non-integer-compatible float to int conversions" RFC. (#6661)
RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-05-31 15:48:45 +01:00
Nikita Popov
445b649228 Fix bug #81090 in JIT as well 2021-05-31 12:39:36 +02:00
Dmitry Stogov
a50a1b643e Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81051 (Broken property type handling after incrementing reference)
2021-05-27 15:23:20 +03:00
Dmitry Stogov
ac65f6af6e Fixed bug #81051 (Broken property type handling after incrementing reference) 2021-05-27 15:22:34 +03:00
Dmitry Stogov
ab1827f3d4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Add missing undefined variable warning an result initialization. (This fixes Zend/tests/bug78531.phpt without PROFITABILITY_CHECKS).
2021-05-21 10:04:38 +03:00
Dmitry Stogov
bf21261c63 Add missing undefined variable warning an result initialization.
(This fixes Zend/tests/bug78531.phpt without PROFITABILITY_CHECKS).
2021-05-21 10:03:00 +03:00
Dmitry Stogov
6881a002d4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't assign to string offset after exception (This fixes Zend/tests/bug31098.phpt failure without PROFITABILITY_CHECKS)
2021-05-21 00:49:44 +03:00
Dmitry Stogov
db309b2e4b Don't assign to string offset after exception (This fixes
Zend/tests/bug31098.phpt failure without PROFITABILITY_CHECKS)
2021-05-21 00:48:24 +03:00
Dmitry Stogov
cb376d8f61 Fixed Zend/tests/type_declarations/union_types/incdec_prop.phpt failure
masked by PROFITABILITY_CHECKS.
2021-05-20 22:52:47 +03:00
George Peter Banyard
c40231afbf
Mark various functions with void arguments.
This fixes a bunch of [-Wstrict-prototypes] warning,
because in C func() and func(void) have different semantics.
2021-05-12 14:55:53 +01: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
Dmitry Stogov
76452651ba Fixed incorrect error message 2021-04-22 02:40:22 +03:00
Dmitry Stogov
d8e4fbae62 Fast Class Cache
This is generalization of idea, that was previously usesd for caching
resolution of class_entries in zend_type. Now very similar mechanizm is
used for general zend_string into zend_class_entry resolution.

Interned zend_string with IS_STR_CLASS_NAME_MAP_PTR GC_FLAG uses its
refcount to adress corresponding zend_class_entry cache slot.
The refcount keeps an offset to this slot from CG(map_ptr_base).
Flag may be checked by ZSTR_HAS_CE_CACHE(str), cache slot may be read by
ZSTR_GET_CE_CACHE(str) and set by ZSTR_SET_CE_CACHE(str, ce).
2021-04-08 23:37:40 +03:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Dmitry Stogov
6690547a58 Use zend_hash_lookup() 2021-03-19 23:34:38 +03:00
Nikita Popov
2f73cbb1b1 Update one more use of NO_AUTOLOAD 2021-03-18 16:25:22 +01:00
Dmitry Stogov
ef51648185 Use zend_type.ce_cache__ptr for caching class resulution during argument/result type checks 2021-02-10 18:00:00 +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
63263abff8 Remove unnecessary INDIRECT checks in JIT helpers 2021-01-06 14:28:17 +01:00
Dmitry Stogov
c8df28d276 Fixed 32-bit JIT 2020-11-20 15:12:30 +03:00
Dmitry Stogov
069f9cbaa5 Added missing deoptimization code for trampoline handling 2020-11-19 12:32:36 +03:00
Alex Dowad
d44235acae Convert numeric string array keys to integers correctly in JITted code
While fixing bugs in mbstring, one of my new test cases failed with a strange
error message stating: 'Warning: Undefined array key 1...', when clearly the
array key had been set properly.

GDB'd that sucker and found that JIT'd PHP code was calling directly into
`zend_hash_add_new` (which was not converting the numeric string key to an
integer properly). But where was that code coming from? I examined the disasm,
looked up symbols to figure out where call instructions were going, then grepped
the codebase for those function names. It soon became clear that the disasm I
was looking at was compiled from `zend_jit_fetch_dim_w_helper`.
2020-10-30 22:07:08 +02:00
Dmitry Stogov
0ac810bbc5 Improve JIT for fetching character form string 2020-10-20 20:29:33 +03:00
Dmitry Stogov
fc14dbb713 Keep the same JIT code for PHP-8.0 and master (workaround against PHP-8.0 ABI freeze) 2020-10-09 16:54:26 +03:00
Dmitry Stogov
e9820bf470 Fixed memory leak in ext/spl/tests/bug77263.phpt 2020-09-17 11:55:50 +03:00
Dmitry Stogov
f786c0e097 Optimize code for FETCH_THIS + INIT_METHOD_CALL/ASSIGN_OBJ_OP/etc 2020-09-16 14:22:36 +03:00
Dmitry Stogov
5f1fb1a5a4 JIT for INIT_METHOD_CALL 2020-09-16 10:25:36 +03:00
Dmitry Stogov
a351da55bf Simplify zend_jit_pre/post_inc/dec_typed_ref() helpers 2020-09-14 22:26:34 +03:00
Dmitry Stogov
8f342ad4d2 JIT for PRE/POST_INC/DEC_OBJ 2020-09-14 19:36:15 +03:00
Dmitry Stogov
bf515649ff JIT for ASSIGN_OBJ_OP 2020-09-14 13:31:41 +03:00
Dmitry Stogov
7b0a053169 JIT for ASSIGN_OBJ 2020-09-10 23:41:50 +03:00
Dmitry Stogov
73c7fa272d JIT for FETCH_DIM_W/RW insructions 2020-09-09 02:41:22 +03:00
Nikita Popov
a1a4c03b9b Fix call to type error functions from jit
Missed to adjust those calls.
2020-08-28 17:37:00 +02:00
Dmitry Stogov
9d409f2c1e Eliminate ZSTR_IS_INTERNED() check 2020-08-27 11:38:15 +03:00
Nikita Popov
c48b745f00 Promote "undefined array key" notice to warning
This implements the last remaining part of the
https://wiki.php.net/rfc/engine_warnings RFC.

Closes GH-5927.
2020-08-03 14:40:50 +02:00
Dmitry Stogov
4b4869ffe3 Merge common "cold" part 2020-07-29 10:10:37 +03:00
George Peter Banyard
b2248789ed Implement 'Saner Numeric Strings' RFC:
RFC: https://wiki.php.net/rfc/saner-numeric-strings

This removes the -1 allow_error mode from is_numeric_string functions and replaces it by
a trailing boolean out argument to preserve BC in a couple of places.

Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit
a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError.

This mostly affects:
 - String offsets
 - Arithmetic operations
 - Bitwise operations

Closes GH-5762
2020-07-29 02:51:09 +01:00
Dmitry Stogov
9f0213fff3 Remove old code (BP_VAR_RW warning) 2020-07-20 11:57:19 +03:00
Dmitry Stogov
ebb94af754 Fixed tracing JIT for ASSIGN to typed reference 2020-07-16 00:19:00 +03:00
Dmitry Stogov
d4fdf79add JIT for array merging 2020-07-13 12:04:08 +03:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Nikita Popov
e45f7053cf Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79793
2020-07-07 16:33:06 +02:00
Nikita Popov
6259eff352 Handle dim_w undefined variable notice in JIT as well 2020-07-07 15:30:43 +02:00
Nikita Popov
0e6ec974fb Check for undef variable exception in SEND_VAR JIT
Add a return value to zend_jit_undefined_op_helper(), so we can
check for exception based on the return value, instead of fetching
EG(exception).
2020-07-07 15:22:46 +02:00
Nikita Popov
cdc4ea2a5c JIT support for undefined index/offset handling 2020-07-07 15:13:03 +02:00
Xinchen Hui
d005a8e92b Fixed bug #79743 (Fatal error when assigning to array property with JIT enabled)
simple typo
2020-06-29 17:47:21 +08:00
Dmitry Stogov
9617c2a2f6 Use cheaper zend_hash_find_ex() to handle IS_CONST index 2020-06-26 11:18:04 +03:00