# Impact of CFLAGS on GOTO and SWITCH executers

- Thread: https://externals.io/message/26061
- Original archive: https://news-web.php.net/php.internals/26061
- Started by Sebastian Bergmann on 2006-10-15T12:41:38+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #26061 — Sebastian Bergmann — 2006-10-15T12:41:38+00:00

URL: https://externals.io/message/26061#26061

Today I built PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and current PHP_5_2 (the
 last two each with CALL, GOTO, and SWITCH VMs) with GCC 3.4.6 and
 GCC 4.1.1 with -O{0|1|2|3|s} [1].

 CFLAGS: -march=pentium-m -msse3 -O{0|1|2|3|s} -pipe
 configure options: --disable-cgi --disable-all

 I let each of the resulting binaries run the PHP_5_2/Zend/bench.php
 script (five times).

 I noticed that for the following configurations the running of the
 bench.php script results in a segmentation fault:

   GCC 3.4.6

     PHP 5.1.6

       GOTO:   -O1
       SWITCH: -O1

     PHP_5_2

       GOTO:   -O0, -O1, -O2, -O3, -Os
       SWITCH: -O0, -O1, -O2, -O3, -Os

   GCC 4.1.1

     PHP 5.1.6

       GOTO:   -O0
       SWITCH: -O0

     PHP_5_2

       GOTO:   -O0, -O1, -O2, -O3
       SWITCH: -O0, -O1, -O2, -O3

 What strikes me as odd are the segmentation faults when PHP is built
 with -O0 (no optimizations).

 These results also beg the question how well supported/tested the two
 alternative executers, GOTO and SWITCH, are.

 --
 [1] Yes, these means I build 80 PHP binaries.

-- 
Sebastian Bergmann                          http://sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

---

## #26062 — Sebastian Bergmann — 2006-10-15T13:21:00+00:00

URL: https://externals.io/message/26061#26062 · In reply to: #26061

Sebastian Bergmann wrote:
> What strikes me as odd are the segmentation faults when PHP is built
> with -O0 (no optimizations).

 Some more information of the segfaults: It looks as if the ackermann
 test is responsible for the segfaults.

 I uploaded a backtrace from GDB and a logfile from valgrind to
 http://static.phpunit.de/gdb-php_5_2-goto-gcc-4.1.1-O0.txt and
 http://static.phpunit.de/valgrind-php_5_2-goto-gcc-4.1.1-O0.txt,
 respectively.

-- 
Sebastian Bergmann                          http://sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

---

## #26063 — Ilia Alshanetsky — 2006-10-15T16:02:24+00:00

URL: https://externals.io/message/26061#26063 · In reply to: #26062

Given the tricky nature of enabling different execution modes I'd be  
very surprised to see people use non-default values, so to your  
answer of how well tested other executors are, I'd say not a whole lot.




> Sebastian Bergmann wrote:
> > […]
>
>  Some more information of the segfaults: It looks as if the ackermann
>  test is responsible for the segfaults.
>
>  I uploaded a backtrace from GDB and a logfile from valgrind to
>  http://static.phpunit.de/gdb-php_5_2-goto-gcc-4.1.1-O0.txt and
>  http://static.phpunit.de/valgrind-php_5_2-goto-gcc-4.1.1-O0.txt,
>  respectively.
>
> -- 
> Sebastian Bergmann                          http://sebastian- 
> bergmann.de/
> GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514  
> B85B 5D69
>
> -- 
> 
> 
>
>

Ilia Alshanetsky

---

## #26064 — Sara Golemon — 2006-10-15T18:42:21+00:00

URL: https://externals.io/message/26061#26064 · In reply to: #26061

>  Today I built PHP 4.4.4, PHP 5.0.5, PHP 5.1.6, and current PHP_5_2 (the
>  last two each with CALL, GOTO, and SWITCH VMs) with GCC 3.4.6 and
>  GCC 4.1.1 with -O{0|1|2|3|s} [1].
> 
That's a nice trick considering that PHP4 doesn't have a CALL or GOTO vm...

>  These results also beg the question how well supported/tested the two
>  alternative executers, GOTO and SWITCH, are.
> 
My guess is that there are only about ten people using alternate VMs to 
any serious degree and maybe a hundred who "tried it once".  The VMs 
aren't a heavily advertised feature and I personally like the 
flexibility of the CALL version best.

-Sara

---

## #26065 — Sebastian Bergmann — 2006-10-15T19:09:07+00:00

URL: https://externals.io/message/26061#26065 · In reply to: #26064

Sara Golemon wrote:
> > […]
> That's a nice trick considering that PHP4 doesn't have a CALL or
> GOTO vm.

 Please read the part in the braces again and you will see that I meant
 PHP 5.1.6 and PHP 5_2.

-- 
Sebastian Bergmann                          http://sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
