Nikita Popov
8c0c06da86
Merge branch 'PHP-7.3' into PHP-7.4
2019-09-16 15:01:14 +02:00
Nikita Popov
8a11f1284e
Merge branch 'PHP-7.2' into PHP-7.3
2019-09-16 15:01:05 +02:00
Nikita Popov
2f6efd835d
Fixed bug #78545
...
By using an explicit (double) cast.
2019-09-16 15:00:20 +02:00
Peter Kokot
638c21765c
Remove HAVE_STRCOLL check
...
The strcoll function is defined in the C89 standard and should be
on today's systems always available via the <string.h> header.
https://port70.net/~nsz/c/c89/c89-draft.html#4.11.4.3
- Remove also SKIPIF strcoll check in test
2019-06-28 00:05:55 +02:00
Nikita Popov
e4455c32ed
Bail out earlier in zend_memnrstr
...
To avoid decrementing a null pointer lateron. As we need to check
for NULL here anayway, we should take the chance to bail out right
away.
2019-06-20 16:21:53 +02:00
Dmitry Stogov
741468d145
Use ZEND_ASSUME() to perform the following check only on "slow" path.
2019-06-06 14:22:10 +03:00
Dmitry Stogov
90a2e4ba66
Fixed reference-counting
2019-06-06 01:40:40 +03:00
Nikita Popov
a31f46421d
Allow exceptions in __toString()
...
RFC: https://wiki.php.net/rfc/tostring_exceptions
And convert some object to string conversion related recoverable
fatal errors into Error exceptions.
Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Sebastian Pop
79a84e00fa
speed up increment and decrement operators with overflow detection
...
On A72, google-benchmark measure before and after the patch:
--------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------
BM_inc_before 6.54 ns 6.54 ns 106985447
BM_dec_before 6.54 ns 6.54 ns 107011667
BM_inc_after 4.36 ns 4.36 ns 160525864
BM_dec_after 4.36 ns 4.36 ns 160524243
Before the patch:
fast_long_add_function:
ldr x0, [x1]
add x2, x0, 1
cmp x2, x0
blt .L11
str x2, [x1]
ret
.L11:
mov x0, 4890909195324358656
mov w2, 5
str x0, [x1]
str w2, [x1, 8]
ret
With the patch:
fast_long_add_function:
ldr x5, [x1]
adds x5,x5,1
bvs .L2
str x5, [x1]
ret
.L2:
mov x0, 4890909195324358656
mov w2, 5
str x0, [x1]
str w2, [x1, 8]
ret
php$ ./sapi/cli/php Zend/bench.php
Base: Patch:
simple 0.091 simple 0.091
simplecall 0.014 simplecall 0.014
simpleucall 0.041 simpleucall 0.041
simpleudcall 0.045 simpleudcall 0.045
mandel 0.193 mandel 0.193
mandel2 0.229 mandel2 0.229
ackermann(7) 0.044 ackermann(7) 0.044
ary(50000) 0.010 ary(50000) 0.010
ary2(50000) 0.008 ary2(50000) 0.008
ary3(2000) 0.096 ary3(2000) 0.102
fibo(30) 0.149 fibo(30) 0.148
hash1(50000) 0.016 hash1(50000) 0.016
hash2(500) 0.020 hash2(500) 0.020
heapsort(20000) 0.055 heapsort(20000) 0.055
matrix(20) 0.057 matrix(20) 0.057
nestedloop(12) 0.091 nestedloop(12) 0.091
sieve(30) 0.032 sieve(30) 0.032
strcat(200000) 0.010 strcat(200000) 0.010
------------------------ ------------------------
Total 1.199 Total 1.204
php$ ./sapi/cli/php Zend/micro_bench.php
Base: Patch:
empty_loop 0.051 empty_loop 0.050
func() 0.181 0.130 func() 0.181 0.131
undef_func() 0.186 0.135 undef_func() 0.186 0.136
int_func() 0.116 0.064 int_func() 0.116 0.065
$x = self::$x 0.235 0.183 $x = self::$x 0.229 0.179
self::$x = 0 0.198 0.147 self::$x = 0 0.199 0.148
isset(self::$x) 0.229 0.178 isset(self::$x) 0.225 0.174
empty(self::$x) 0.231 0.180 empty(self::$x) 0.227 0.177
$x = Foo::$x 0.144 0.093 $x = Foo::$x 0.142 0.092
Foo::$x = 0 0.107 0.056 Foo::$x = 0 0.105 0.054
isset(Foo::$x) 0.140 0.088 isset(Foo::$x) 0.140 0.089
empty(Foo::$x) 0.148 0.097 empty(Foo::$x) 0.144 0.094
self::f() 0.238 0.187 self::f() 0.240 0.190
Foo::f() 0.209 0.158 Foo::f() 0.201 0.150
$x = $this->x 0.123 0.072 $x = $this->x 0.120 0.070
$this->x = 0 0.124 0.073 $this->x = 0 0.124 0.074
$this->x += 2 0.151 0.099 $this->x += 2 0.151 0.101
++$this->x 0.137 0.086 ++$this->x 0.139 0.088
--$this->x 0.137 0.086 --$this->x 0.137 0.087
$this->x++ 0.170 0.119 $this->x++ 0.172 0.122
$this->x-- 0.171 0.119 $this->x-- 0.172 0.122
isset($this->x) 0.170 0.119 isset($this->x) 0.170 0.120
empty($this->x) 0.179 0.128 empty($this->x) 0.179 0.129
$this->f() 0.194 0.143 $this->f() 0.194 0.144
$x = Foo::TEST 0.188 0.137 $x = Foo::TEST 0.188 0.138
new Foo() 0.482 0.431 new Foo() 0.482 0.432
$x = TEST 0.109 0.058 $x = TEST 0.109 0.059
$x = $_GET 0.190 0.138 $x = $_GET 0.188 0.137
$x = $GLOBALS['v'] 0.242 0.191 $x = $GLOBALS['v'] 0.246 0.196
$x = $hash['v'] 0.196 0.145 $x = $hash['v'] 0.192 0.142
$x = $str[0] 0.146 0.094 $x = $str[0] 0.142 0.092
$x = $a ?: null 0.144 0.093 $x = $a ?: null 0.144 0.094
$x = $f ?: tmp 0.174 0.123 $x = $f ?: tmp 0.174 0.124
$x = $f ? $f : $a 0.153 0.101 $x = $f ? $f : $a 0.153 0.102
$x = $f ? $f : tmp 0.148 0.097 $x = $f ? $f : tmp 0.148 0.098
------------------------ ------------------------
Total 6.143 Total 6.108
2019-05-07 15:42:19 +03:00
Sebastian Pop
adc3b72076
speed up add and sub operators with overflow detection
...
On A72, google-benchmark measure before and after the patch:
--------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------
BM_add_before 13.3 ns 13.3 ns 52626058
BM_sub_before 8.72 ns 8.72 ns 80259343
BM_add_after 4.80 ns 4.80 ns 145926004
BM_sub_after 4.80 ns 4.80 ns 145936496
Before the patch:
fast_long_add_function:
ldr x1, [x1]
ldr x2, [x2]
add x3, x1, x2
eor x4, x1, x2
tbz x4, #63 , .L5
.L2:
mov w1, 4
str x3, [x0]
str w1, [x0, 8]
ret
.p2align 2
.L5:
eor x4, x1, x3
tbz x4, #63 , .L2
scvtf d0, x1
scvtf d1, x2
mov w1, 5
str w1, [x0, 8]
fadd d0, d0, d1
str d0, [x0]
ret
With the patch:
fast_long_add_function:
ldr x5, [x1]
ldr x6, [x2]
adds x5, x5, x6
bvs .L2
mov w6, 4
str x5, [x0]
str w6, [x0, 8]
ret
.L2:
ldr x1, [x1]
mov w3, 5
ldr x2, [x2]
str w3, [x0, 8]
scvtf d0, x1
scvtf d1, x2
fadd d0, d0, d1
str d0, [x0]
ret
php$ ./sapi/cli/php Zend/bench.php
Base: Patch:
simple 0.091 simple 0.091
simplecall 0.014 simplecall 0.014
simpleucall 0.041 simpleucall 0.041
simpleudcall 0.045 simpleudcall 0.045
mandel 0.193 mandel 0.193
mandel2 0.229 mandel2 0.229
ackermann(7) 0.044 ackermann(7) 0.044
ary(50000) 0.010 ary(50000) 0.010
ary2(50000) 0.008 ary2(50000) 0.008
ary3(2000) 0.096 ary3(2000) 0.095
fibo(30) 0.149 fibo(30) 0.148
hash1(50000) 0.016 hash1(50000) 0.016
hash2(500) 0.020 hash2(500) 0.020
heapsort(20000) 0.055 heapsort(20000) 0.054
matrix(20) 0.057 matrix(20) 0.057
nestedloop(12) 0.091 nestedloop(12) 0.091
sieve(30) 0.032 sieve(30) 0.032
strcat(200000) 0.010 strcat(200000) 0.010
------------------------ ------------------------
Total 1.199 Total 1.197
php$ ./sapi/cli/php Zend/micro_bench.php
Base: Patch:
empty_loop 0.051 empty_loop 0.051
func() 0.181 0.130 func() 0.181 0.130
undef_func() 0.186 0.135 undef_func() 0.186 0.135
int_func() 0.116 0.064 int_func() 0.116 0.064
$x = self::$x 0.235 0.183 $x = self::$x 0.233 0.182
self::$x = 0 0.198 0.147 self::$x = 0 0.198 0.147
isset(self::$x) 0.229 0.178 isset(self::$x) 0.229 0.178
empty(self::$x) 0.231 0.180 empty(self::$x) 0.231 0.180
$x = Foo::$x 0.144 0.093 $x = Foo::$x 0.144 0.093
Foo::$x = 0 0.107 0.056 Foo::$x = 0 0.107 0.056
isset(Foo::$x) 0.140 0.088 isset(Foo::$x) 0.140 0.088
empty(Foo::$x) 0.148 0.097 empty(Foo::$x) 0.148 0.097
self::f() 0.238 0.187 self::f() 0.238 0.187
Foo::f() 0.209 0.158 Foo::f() 0.209 0.158
$x = $this->x 0.123 0.072 $x = $this->x 0.123 0.072
$this->x = 0 0.124 0.073 $this->x = 0 0.124 0.073
$this->x += 2 0.151 0.099 $this->x += 2 0.153 0.101
++$this->x 0.137 0.086 ++$this->x 0.138 0.086
--$this->x 0.137 0.086 --$this->x 0.138 0.086
$this->x++ 0.170 0.119 $this->x++ 0.172 0.121
$this->x-- 0.171 0.119 $this->x-- 0.172 0.121
isset($this->x) 0.170 0.119 isset($this->x) 0.170 0.119
empty($this->x) 0.179 0.128 empty($this->x) 0.179 0.128
$this->f() 0.194 0.143 $this->f() 0.194 0.143
$x = Foo::TEST 0.188 0.137 $x = Foo::TEST 0.188 0.136
new Foo() 0.482 0.431 new Foo() 0.479 0.427
$x = TEST 0.109 0.058 $x = TEST 0.109 0.058
$x = $_GET 0.190 0.138 $x = $_GET 0.190 0.139
$x = $GLOBALS['v'] 0.242 0.191 $x = $GLOBALS['v'] 0.242 0.191
$x = $hash['v'] 0.196 0.145 $x = $hash['v'] 0.196 0.145
$x = $str[0] 0.146 0.094 $x = $str[0] 0.145 0.094
$x = $a ?: null 0.144 0.093 $x = $a ?: null 0.144 0.093
$x = $f ?: tmp 0.174 0.123 $x = $f ?: tmp 0.174 0.123
$x = $f ? $f : $a 0.153 0.101 $x = $f ? $f : $a 0.153 0.101
$x = $f ? $f : tmp 0.148 0.097 $x = $f ? $f : tmp 0.148 0.097
------------------------ ------------------------
Total 6.143 Total 6.143
2019-05-07 15:38:17 +03:00
Peter Kokot
e06836a1a3
Remove checks for locale.h, setlocale, localeconv
...
The `<loccale.h>` header file, setlocale, and localeconv are part of the
standard C89 [1] and on current systems can be used unconditionally.
Since PHP 7.4 requires at least C89 or greater, the `HAVE_LOCALE_H`,
`HAVE_SETLOCALE`, and `HAVE_LOCALECONV` symbols defined by Autoconf in
configure.ac [2] can be ommitted and simplifed.
The bundled libmagic (file) has also been patched already in version
5.35 and up in upstream location so when it will be patched also in
php-src the check for locale.h header is still left in the configure.ac
and in windows headers definition file.
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.4
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
Omit the bundled libmagic files
2019-04-07 18:32:54 +02:00
Dmitry Stogov
9038d5c6ee
Make is_identical() functions return zend_bool (instead of int)
2019-04-04 18:18:12 +03:00
Peter Kokot
92ac598aab
Remove local variables
...
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.
A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.
This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.
With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.
Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files. All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
a81202ac49
Adios, yearly copyright ranges
2019-01-30 11:48:28 +01:00
Zeev Suraski
9afce019e0
Future-proof email addresses
2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc
Update email addresses. We're still @Zend, but future proofing it...
2018-11-01 17:20:07 +02:00
Nikita Popov
f57be4bdbe
Remove __GNUC__ guard around stddef.h include
...
HAVE_STDDEF_H guards have been removed by
6c1ff61a36
, because the header is
always available in C89. This removes a __GNUC__ guard for the
same header.
2018-09-17 12:08:11 +02:00
Ondřej Surý
02b0bc8bb1
Fix #76767 : ‘asm’ operand has impossible constraints in zend_operators.h
...
We disable assembly code with gcc 4.8 on i386.
2018-08-22 13:57:21 +02:00
Peter Kokot
8d3f8ca12a
Remove unused Git attributes ident
...
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.
In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.
This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
ebd1f5af3e
API cleanup.
...
Removed useless filename and lineno arguments, used in DEBUG build.
The patch doesn't break source compatibility of public API (only binary compatibility).
2018-07-23 15:24:07 +03:00
Dmitry Stogov
ca40664ad6
Conversion related optimizations
2018-07-06 01:26:43 +03:00
Dmitry Stogov
5eb1f92f31
Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence.
2018-05-28 16:27:12 +03:00
Dmitry Stogov
63f5e11d9b
Use add/sub instead of inc/dec
2018-05-08 00:00:59 +03:00
Anatol Belski
fa9ea3c9eb
Use const pointers where appropriate
2018-03-16 20:37:51 +01:00
Dmitry Stogov
19676fdf55
Added zendi_smart_streq() for smart string equality check
2018-01-16 17:24:00 +03:00
Xinchen Hui
a6519d0514
year++
2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49
year++
2018-01-02 12:55:14 +08:00
Dmitry Stogov
74c84cd7f0
Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage.
2017-12-04 17:17:02 +03:00
Dmitry Stogov
084c17fe0b
Use zend_string_tolower() where it's possible (to avoid reallocations).
...
Allow zend_string_tolower_ex() to create parsistent strings
2017-11-30 01:13:39 +03:00
David Carlier
4e0b3c0c4c
Add configure check for asm goto support
...
asm goto is not supported by couple of systems. To make sure it does,
we can check it at configure-time.
2017-11-28 22:55:41 +01:00
Dmitry Stogov
6acfade8a1
Prefer "GNU asm goto" to __builtin_saddl_overflow() for overflow detection. This allows generation of significantly better code.
2017-11-28 12:37:00 +03:00
Dmitry Stogov
efa4d8d3ac
Optimized zend_is_true() for objects (in most cases, it doesn't need to call the conversion handler).
2017-11-20 12:38:31 +03:00
Anatol Belski
24356e307c
Fix condition
2017-11-17 18:19:32 +01:00
Dmitry Stogov
ccc12b82da
Avoid unnecessary reference-counting on strings.
2017-11-16 17:09:32 +03:00
Dmitry Stogov
ce18738a30
Removed "_" from API functions.
2017-11-16 17:09:01 +03:00
Anatol Belski
793ca716fb
Fix datatypes and compiler warnings
...
Switch to size_t
Not critical as an unsigned is already used, but fixes a couple of
warnings in other areas.
Normalize signature
It's a function with the usual compare semantics, returning a platform
specific at least produces unnecessary warnings elsewhere and is otherwise
inappropriate.
Fix return value
Drop unused var
Fix compiler warnings
Fix compiler warning
Fix var name in arginfo
Fix cast
2017-10-23 08:56:57 +02:00
tianhe1986
e6519cb69d
memcmp
begins from the second char.
...
Signed-off-by: tianhe1986 <w1s2j3229@163.com>
2017-10-12 22:46:26 +08:00
Dmitry Stogov
4960c41e1f
Small improvement with zend_memnstr (tianhe1986)
2017-10-12 11:54:40 +03:00
Anatol Belski
0d1eeeb68d
move zend_ato*() to size_t and remove casts
2017-07-28 14:59:31 +02:00
Anatol Belski
bc5811f361
further sync for vim mode lines
2017-07-04 18:12:45 +02:00
Sammy Kaye Powers
9e29f841ce
Update copyright headers to 2017
2017-01-02 09:30:12 -06:00
TAKEKOSHI Akishige
15735678c3
when needle is short, Sunday algorithm is slower than glibc memchr()
2016-09-18 15:46:40 +09:00
Nikita Popov
dd7affa9ff
Merge branch 'PHP-7.1'
2016-09-16 21:06:52 +02:00
Nikita Popov
cab7bc7e07
Merge branch 'PHP-7.0' into PHP-7.1
2016-09-16 21:06:11 +02:00
Michael Orlitzky
0e76cafaf1
Disable add/sub asm for gcc 4.9 pic/pie builds
2016-09-16 21:06:02 +02:00
Nikita Popov
e0e5063173
Drop some pieces of commented-out code
2016-09-04 12:56:06 +02:00
Nikita Popov
852a5ff23c
Fix typos
2016-08-11 17:57:58 +02:00
Xinchen Hui
75017520c3
Check them in autoconf
2016-08-11 19:57:30 +08:00
Andrea Faulds
9bbbb1bd80
Use checked add/sub intrinsics instead of asm for ++ and --
2016-08-10 00:46:05 +01:00
Andrea Faulds
0987737397
Use checked arithmetic intrinsics instead of asm, when possible
2016-08-10 00:46:05 +01:00