CALL and SWITCH executors segfault

php.internals

Sebastian Bergmann

21 years ago
Tonight I wanted to do some benchmarks with PHP 4.3.11, PHP 5.0.4, and the three (CALL, GOTO, SWITCH) executors of PHP 5.1 with both GCC 3.4.4 and GCC 4.0.1 to get a feeling for the improvements in the VM for PHP 5.1. Both the CALL and SWITCH executors segfault for me on my Linux system when running the ZendEngine2/bench.php script. Below is the backtrace for the GOTO executor: (gdb) r Zend/bench.php Starting program: /usr/local/src/php/php-5.1/sapi/cli/php Zend/bench.php simple 0.294 simplecall 0.778 simpleucall 1.147 simpleudcall 1.379 mandel 1.223 mandel2 1.494 Program received signal SIGSEGV, Segmentation fault. execute (op_array=0x826ffe0) at zend_vm_execute.h:3834 3834 memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); (gdb) bt #0 execute (op_array=0x826ffe0) at zend_vm_execute.h:3834 #1 0x0816d534 in execute (op_array=0x812dcc0) at zend_vm_execute.h:3989 . . . #871 0x0816d534 in execute (op_array=0x8285194) at zend_vm_execute.h:3989 #872 0x0812fa34 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/php/php-5.1/Zend/zend.c:1077 #873 0x080ecb4d in php_execute_script (primary_file=0xbffff7a0) at /usr/local/src/php/php-5.1/main/main.c:1670 #874 0x081d3b4a in main (argc=2, argv=0xbffff874) at /usr/local/src/php/php-5.1/sapi/cli/php_cli.c:1036 Below is the backtrace for the SWITCH executor: (gdb) r Zend/bench.php Starting program: /usr/local/src/php/php-5.1/sapi/cli/php Zend/bench.php simple 0.316 simplecall 0.779 simpleucall 1.170 simpleudcall 1.389 mandel 1.384 mandel2 1.630 Program received signal SIGSEGV, Segmentation fault. execute (op_array=0x8273fe0) at zend_vm_execute.h:53 53 memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); (gdb) bt #0 execute (op_array=0x8273fe0) at zend_vm_execute.h:53 #1 0x0816f7b8 in execute (op_array=0x812dcc0) at zend_vm_execute.h:211 . . . #875 0x0816f7b8 in execute (op_array=0x8289194) at zend_vm_execute.h:211 #876 0x0812fa34 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/php/php-5.1/Zend/zend.c:1077 #877 0x080ecb4d in php_execute_script (primary_file=0xbffff7a0) at /usr/local/src/php/php-5.1/main/main.c:1670 #878 0x081d464a in main (argc=2, argv=0xbffff874) at /usr/local/src/php/php-5.1/sapi/cli/php_cli.c:1036
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Sebastian Bergmann

21 years ago
Sebastian Bergmann wrote:
> Tonight I wanted to do some benchmarks with PHP 4.3.11, PHP 5.0.4, and > the three (CALL, GOTO, SWITCH) executors of PHP 5.1 with both GCC 3.4.4 > and GCC 4.0.1 to get a feeling for the improvements in the VM for > PHP 5.1.
Initial results are here [1].
> Both the CALL and SWITCH executors segfault for me on my Linux system > when running the ZendEngine2/bench.php script.
The benchmark part that causes the segfault in both cases is the Ackermann function.
-- [1] http://sebastian-bergmann.de/stuff/benchmark.txt -- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Dmitry Stogov

21 years ago
Hi Sebastian, The problem in stack overflow. We will see how this can be fixed without performance lost. Do you use x86 (non x86-64)? What is your ./configure options? Thanks. Dmitry.

Sebastian Bergmann

21 years ago
Dmitry Stogov wrote:
> Do you use x86 (non x86-64)? > What is your ./configure options?
Intel(R) Pentium(R) M Processor 1500MHz / 1024 KB Cache / 512 MB RAM Linux 2.6.11-gentoo-r11 CFLAGS="-march=pentium-m -O2 -pipe" ./configure --disable-cgi --disable-all
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Stanislav Malyshev

21 years ago
DS>>The problem in stack overflow. DS>>We will see how this can be fixed without performance lost. I think it might be time to go easier on stack - maybe consider to make specialized fixed-size allocators for frequently used structures to avoid performance hits - it seems that PHP uses a lot of stack in recursion.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115