Commit Graph

178 Commits

Author SHA1 Message Date
Dmitry Stogov
3e57e50fb0 Removed useless #ifdef 2015-06-16 17:17:49 +03:00
Dmitry Stogov
48ed660cdf Make CALL VM with FP and IP in global registers not to return anything from opcode handlers.
Set OPLINE to NULL to terminate VM loop instead.
This saves 1 CPU instruction for each opcode handler.
2015-06-16 14:11:16 +03:00
Dmitry Stogov
7f39ee7159 Delay checks for undefined CV variables after checks for fast paths. 2015-06-05 01:53:32 +03:00
Bob Weinand
b1bd6f502f Properly define ZEND_OP_DATA in zend_vm_def.h
This allows zend_vm_gen.php to define them in zend_vm_opcodes.{c,h} without further hacks.
2015-04-19 23:21:57 +02:00
Dmitry Stogov
690843fa37 Fixed GOTO executor 2015-04-09 18:18:10 +03:00
Dmitry Stogov
4d4a5336f1 Embed "fast" operator functions (add, sub, increment, etc) into executor with additional optimizations 2015-03-17 18:53:19 +03:00
Xinchen Hui
8247f49fb2 Exposed ZEND_VM_KIND etc 2015-03-16 17:00:04 +08:00
Dmitry Stogov
ae26a51f0f Added API function to call VM opcode handler in a portable way 2015-03-13 11:29:43 +03:00
Dmitry Stogov
249c2323f4 Allow CALL executor to keep few very often used vaiables in CPU registers.
This is disabled by default yet, but may be enabled compiling zend_execute.c with -DHAVE_GCC_GLOBAL_REGS.
Only tested on Linux x86 and x86_64 with GCC 4.9.2.
2015-03-13 03:28:21 +03:00
Dmitry Stogov
6289f7e52f Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build additional PHP-5.0 compatible VM, hide executor implementation details. 2015-03-12 20:39:04 +03:00
Dmitry Stogov
1c94ff0595 Implement engine exceptions
RFC: https://wiki.php.net/rfc/engine_exceptions_for_php7

Pending changes regarding naming of BaseException and whether it
should be an interface.
2015-03-09 14:01:32 +01:00
Dmitry Stogov
2bb9a59175 Fixed ability to build unspecialized executor 2015-02-26 17:53:03 +03:00
Dmitry Stogov
ff86267632 Fixed compilation warnings 2015-02-25 23:20:47 +03:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Anatol Belski
e112f6a04e second shot on removing TSRMLS_* 2014-12-14 14:07:59 +01:00
Dmitry Stogov
14e29f5146 Reduced size of zend_op on 64-bit systems.
the main idea - the smaller the zend_op structure, the lees memory traffic is required to load VM instructions during execution. The patch reduces the size of each opcode from 48 to 32 bytes (saves 16 bytes for each opcode, and applications use thousands of opoceds). This reduced the number of CPU cache misses by 12% and improved performance of real-life apps by 1-2%.

The patch affects how constants and jump targets are represented in VM during execution. Previously they were implemented as absolute 64-bit pointers. Now they are relative 32-bit offsets.

In run-time constant now should be accessed as:
  RT_CONSTANT(op_array, opine->op1) instead of opline->op1.zv
  EX_CONSTANT(opline->op1) instead of opline->op1.zv

Jump targets:
  OP_JMP_ADDR(opline, opline->op2) instead of opline->op2.jmp_addr

The patch doesn't change zend_op representation for 32-bit systems. They still use absolute addresses. The compile-time representation is also kept the same.
2014-12-12 10:19:41 +03:00
Dmitry Stogov
f70545678b Pass znode_op structure by value (it fits into one word) instead of pointer to structure. 2014-12-09 03:03:38 +03:00
Dmitry Stogov
b6c6e7960a Improved ASSIGN_DIM and ASSIGN_OBJ 2014-12-09 00:10:23 +03:00
Dmitry Stogov
c7f695f311 Get rid of duplicate handlers (where the code for IS_TMP_VAR and IS_VAR operands is the same) 2014-12-05 12:40:47 +03:00
Anatol Belski
e04971ce21 fix TS build 2014-12-03 19:50:02 +01:00
Dmitry Stogov
e5716d1b5a Get rid of duplicate handlers (ZEND_ADD_SPEC_TMP_TMP and ZEND_ADD_SPEC_VAR_VAR are absolutely the same). 2014-12-03 18:02:02 +03:00
Stanislav Malyshev
7daa97a383 Merge branch 'PHP-5.6'
* PHP-5.6:
  fix NEWS order
  update NEWS
  Update the VM generation script, per Bob.
  Update NEWS after rebase.
  Add BEGIN_EXTERN_C() and END_EXTERN_C() to .h files missing them.
2014-11-23 16:25:10 -08:00
Stanislav Malyshev
faee48506d Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  Update the VM generation script, per Bob.
  Update NEWS after rebase.
  Add BEGIN_EXTERN_C() and END_EXTERN_C() to .h files missing them.
2014-11-23 16:18:52 -08:00
Dmitry Stogov
c746dcd7fd Get rid of zend_free_op structure (use zval* instead).
Get rid of useless TSRMLS arguments.
2014-11-18 09:05:48 +03:00
Adam Harvey
4bb836be20 Update the VM generation script, per Bob. 2014-10-31 10:10:49 -07:00
Dmitry Stogov
bd9a234645 Replaced EG(This) and EX(object) with EX(This).
Internal functions now recieves zend_execute_data as the first argument.
2014-10-03 19:32:46 +04:00
Dmitry Stogov
06103d65b1 Use zval_ptr_dtor_nogc() to free IS_TMP_VAR operands.
Removed ZEND_SWITCH_FREE opcode (ZEND_FREE used instead).
2014-09-23 17:21:29 +04:00
Dmitry Stogov
2c8ac3a252 Replace IS_OP?_TMP_FREE() with more clear (OP?_TYPE == IS_TMP_VAR) 2014-09-22 12:47:10 +04:00
Dmitry Stogov
319ce224d2 LOAD_REGS() is not used anymore 2014-08-28 10:55:16 +04:00
Dmitry Stogov
f2b0370193 Use 'const' qualifier for pointrs to code used at run-time (the code must not be changed) 2014-08-28 02:44:06 +04:00
Dmitry Stogov
8ec40397cd Cleanup IS_VAR handling 2014-08-27 19:10:29 +04:00
Dmitry Stogov
2febfbab8e Micro optimization for the main interpreter loop 2014-07-17 11:18:44 +04:00
Stanislav Malyshev
c291033469 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Make sure the generator script also creates a newline at the end of file
  Add newline at end of file to prevent compilation warning
2014-07-06 22:15:35 -07:00
Lior Kaplan
716d2a3937 Make sure the generator script also creates a newline at the end of file
Similar to commit d6713f39 in master
2014-07-06 22:15:09 -07:00
Dmitry Stogov
0a77dcd4b9 Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something. 2014-07-03 01:02:25 +04:00
Dmitry Stogov
f9927a6c97 Merge mainstream 'master' branch into refactoring
During merge I had to revert:
	Nikita's patch for php_splice() (it probably needs to be applyed again)
	Bob Weinand's patches related to constant expression handling (we need to review them carefully)
	I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway)

Conflicts:
	Zend/zend.h
	Zend/zend_API.c
	Zend/zend_ast.c
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_constants.c
	Zend/zend_exceptions.c
	Zend/zend_execute.c
	Zend/zend_execute.h
	Zend/zend_execute_API.c
	Zend/zend_hash.c
	Zend/zend_highlight.c
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner_defs.h
	Zend/zend_variables.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/date/php_date.c
	ext/dom/documenttype.c
	ext/hash/hash.c
	ext/iconv/iconv.c
	ext/mbstring/tests/zend_multibyte-10.phpt
	ext/mbstring/tests/zend_multibyte-11.phpt
	ext/mbstring/tests/zend_multibyte-12.phpt
	ext/mysql/php_mysql.c
	ext/mysqli/mysqli.c
	ext/mysqlnd/mysqlnd_reverse_api.c
	ext/mysqlnd/php_mysqlnd.c
	ext/opcache/ZendAccelerator.c
	ext/opcache/zend_accelerator_util_funcs.c
	ext/opcache/zend_persist.c
	ext/opcache/zend_persist_calc.c
	ext/pcre/php_pcre.c
	ext/pdo/pdo_dbh.c
	ext/pdo/pdo_stmt.c
	ext/pdo_pgsql/pgsql_driver.c
	ext/pgsql/pgsql.c
	ext/reflection/php_reflection.c
	ext/session/session.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
	ext/standard/array.c
	ext/standard/basic_functions.c
	ext/standard/html.c
	ext/standard/mail.c
	ext/standard/php_array.h
	ext/standard/proc_open.c
	ext/standard/streamsfuncs.c
	ext/standard/user_filters.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_variables.c
	sapi/phpdbg/phpdbg.c
	sapi/phpdbg/phpdbg_bp.c
	sapi/phpdbg/phpdbg_frame.c
	sapi/phpdbg/phpdbg_help.c
	sapi/phpdbg/phpdbg_list.c
	sapi/phpdbg/phpdbg_print.c
	sapi/phpdbg/phpdbg_prompt.c
2014-04-26 00:32:51 +04:00
Dmitry Stogov
6976eb2919 Fixed support for unspecialized and GOTO and SWITCH executor 2014-04-17 02:12:06 +04:00
Dmitry Stogov
cea26aa2eb Tergets of ASSIGN and ASSIGN_REF don't have to be initialized 2014-04-04 15:22:41 +04:00
Dmitry Stogov
c6cba55454 Use ZVAL_DEREF() macro 2014-03-27 13:39:09 +04:00
Dmitry Stogov
1be0df935f Fixed destruction of VM handler operands (FREE_OP1 and family) 2014-03-04 12:27:50 +04:00
Ferenc Kovacs
bfbdc032b6 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  typo spotted by Lajos Veres
2014-02-27 11:30:23 +01:00
Ferenc Kovacs
561843c973 typo spotted by Lajos Veres 2014-02-27 11:29:08 +01:00
Dmitry Stogov
5de7115679 Use better data structures (incomplete; able to run bench.php) 2014-02-18 16:27:38 +04:00
Dmitry Stogov
4e66abad54 Use better data structures (incomplete) - refactored return_value handling 2014-02-12 14:29:51 +04:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
Xinchen Hui
aba775fd34 Fixed warning "No new line at end of file" 2014-01-24 10:50:41 +08:00
Xinchen Hui
0f53e37494 Merge branch 'PHP-5.6' 2014-01-03 11:09:07 +08:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
47c9027772 Bump year 2014-01-03 11:06:16 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
Xinchen Hui
d6713f3989 Fixed warning "No new line at end of file" 2013-12-26 17:45:37 +08:00
krakjoe
2a1b60569f Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  stop warnings from unused opcode map
  - BFN
  - Fixed bug #66311 (Stack smashing protection kills PDO/ODBC queries) patch by: michael at orlitzky dot com
  Included new .c file in build too
  Fixed little typo in zend_vm_gen.php
  Moved to new file, killing a lot of warnings
2013-12-22 13:11:20 +00:00
krakjoe
247ec0d81f Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  stop warnings from unused opcode map
  - BFN
2013-12-22 13:07:41 +00:00
krakjoe
b1df00a7c9 stop warnings from unused opcode map 2013-12-22 13:00:51 +00:00
Bob Weinand
7e3af096b3 Merge branch 'PHP-5.4' into PHP-5.5
Conflicts:
	Zend/zend_vm_opcodes.c
2013-12-22 00:54:59 +01:00
Bob Weinand
97bf254385 Included new .c file in build too 2013-12-22 00:52:05 +01:00
Bob Weinand
00cc4dccb8 Fixed little typo in zend_vm_gen.php 2013-12-21 23:52:48 +01:00
Bob Weinand
0dd2765687 Merge branch 'PHP-5.4' into PHP-5.5
Conflicts:
	Zend/zend_vm_opcodes.h
2013-12-21 23:49:28 +01:00
Bob Weinand
61199be02f Moved to new file, killing a lot of warnings 2013-12-21 23:45:34 +01:00
Bob Weinand
b14f31872b Merge branch 'PHP-5.5' into PHP-5.6 2013-12-21 21:32:42 +01:00
Bob Weinand
560f90e511 Merge branch 'PHP-5.4' into PHP-5.5
Conflicts:
	Zend/zend_vm_gen.php
	Zend/zend_vm_opcodes.h
2013-12-21 21:31:48 +01:00
Bob Weinand
7894e397d8 Fixed build... 2013-12-21 21:29:08 +01:00
Bob Weinand
9b4b5fa737 Merge branch 'PHP-5.5' into PHP-5.6 2013-12-21 19:31:27 +01:00
Bob Weinand
b52c300eca Merge branch 'PHP-5.4' into PHP-5.5 2013-12-21 19:27:58 +01:00
Bob Weinand
50d50c2f04 Added an opcode to opcode name map
That way extensions etc. don't have to maintain their own lists anymore.
Also as phpdbg is included and needs such a map, it'd be counterproductive to need to change two things on every new opcode.
2013-12-21 19:22:47 +01:00
Dmitry Stogov
9447181d0c Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed ability to build non-specialized GOTO VM
2013-12-02 11:03:17 +04:00
Dmitry Stogov
7efcbecda9 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fixed ability to build non-specialized GOTO VM

Conflicts:
	Zend/zend_vm_gen.php
2013-12-02 11:02:40 +04:00
Dmitry Stogov
9ed605892d Fixed ability to build non-specialized GOTO VM 2013-12-02 10:59:32 +04:00
Dmitry Stogov
3b2ca392f1 Removed unnecessary GC checks 2013-10-31 11:33:39 +04:00
Anatol Belski
07fa043cc3 Merge branch 'PHP-5.5'
* PHP-5.5:
  Suppress static analyzer warnings in specialized executor
  Update NEWS
2013-08-23 17:45:45 +02:00
Anatol Belski
716fc80fda Suppress static analyzer warnings in specialized executor
As things like if(0) will be removed by the compiler, no need
to see that tons of warnings with static analyzer enabled.
2013-08-23 17:41:07 +02:00
Veres Lajos
e9a95d78ef typo fixes 2013-07-15 00:23:03 -07:00
Veres Lajos
1b06e0be96 typo fixes 2013-07-15 00:19:49 -07:00
Veres Lajos
72085b0e5f typo fixes 2013-07-15 00:18:57 -07:00
Dmitry Stogov
273ad58295 Improved IS_VAR operands fetching 2013-05-17 13:15:09 +04:00
Xinchen Hui
a666285bc2 Happy New Year 2013-01-01 16:37:09 +08:00
Xinchen Hui
0a7395e009 Happy New Year 2013-01-01 16:28:54 +08:00
Xinchen Hui
9fb5cfdeb1 Fixed warning of no return in non-void funciton 2012-12-14 17:21:43 +08:00
Dmitry Stogov
fa30e4754b Slight performance improvement 2012-12-05 13:23:37 +04:00
Dmitry Stogov
7651d64556 Optimized access to temporary and compiled VM variables 2012-12-04 10:14:39 +04:00
Xinchen Hui
3c6b0db052 The /e modifier is deprecated 2012-11-04 00:53:45 +08:00
Xinchen Hui
383eafe482 Merge branch 'PHP-5.3' into PHP-5.4 2012-08-25 21:50:08 +08:00
Xinchen Hui
d92a89fe52 Fixed bug (segfault while build with zts and GOTO vm-kind) 2012-08-25 21:47:53 +08:00
Nikita Popov
b770b221e0 Make the GOTO and SWITCH VMs work again 2012-05-29 02:31:56 +02:00
Nikita Popov
f627be5254 Add support for executing a zend_execute_data
This adds another function execute_ex(), which accepts a zend_execute_data
struct to run (contrary to execute(), which accepts a zend_op_array from
which it initialized the execute_data).

This needs a bit more cleanup.
2012-05-26 17:53:13 +02:00
Nikita Popov
ececcbce0e Allow calling zend_vm_gen from everywhere
Before one could only call it with cwd=Zend.
2012-05-23 20:40:21 +02:00
Felipe Pena
e4ca0ed09f - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
8775a37559 - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
4e19825281 - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
ae40e5f400 - Year++ 2011-07-10 13:05:32 +00:00
Felipe Pena
31a69cd480 - Year++ 2011-07-10 13:05:32 +00:00
Felipe Pena
327a9d45c9 - Year++ 2011-07-10 13:05:32 +00:00
Dmitry Stogov
523b965cd4 Prevent generation of long strings 2010-08-10 14:44:50 +00:00
Felipe Pena
b65a473efb - Let's generate this #ifdef only on zend_vm_execute.h 2010-06-07 23:04:30 +00:00
Felipe Pena
d97ae93616 - Let's generate this #ifdef only on zend_vm_execute.h 2010-06-07 23:04:30 +00:00
Felipe Pena
d78fb2b14a - Fix script 2010-06-07 14:37:35 +00:00
Felipe Pena
80ab4dee7b - Fix script 2010-06-07 14:37:35 +00:00
Pierre Joye
6d1d27bc3a - show the free_op1 warning only once, until a fix is applied 2010-06-07 01:37:59 +00:00
Pierre Joye
2c8dcfa22a - show the free_op1 warning only once, until a fix is applied 2010-06-07 01:37:59 +00:00
Dmitry Stogov
453b49ed20 Added a number of small performance tweaks and optimizations
. ZEND_RECV now always has IS_CV as its result
  . ZEND_CATCH now has to be used only with constant class names
  . ZEND_FETCH_DIM_? may fetch array and dimension operans in a different order
2010-04-20 11:16:39 +00:00