Commit Graph

149 Commits

Author SHA1 Message Date
Dmitry Stogov
8e10e8f921 Avoid zval duplication in ZVAL_ZVAL() macro (it was necessary only in few places).
Switch from ZVAL_ZVAL() to simpler macros where possible (it makes sense to review remaining places)
2015-06-12 12:33:23 +03:00
Bob Weinand
69b54ba926 Also unreserve T_CLASS 2015-05-25 22:58:30 +02:00
krakjoe
49608e0608 Rebase Joe's anon classes implementation 2015-04-26 15:04:22 +02:00
Nikita Popov
38eb3cdf67 Drop ??? for AST_ZNODE in ast pretty printer 2015-04-14 21:35:38 +02:00
Nikita Popov
acd61be985 Add "yield from" support to ast pretty printer 2015-04-14 19:15:40 +02:00
Dmitry Stogov
ea09a9fa32 Convert fatal errors into EngineExceptions
Make zval_update_constant_ex(), zval_update_constant(), zend_update_class_constants() and zend_ast_evaluate() return SUCCESS or FAILURE.
2015-04-02 02:05:25 +03:00
Dmitry Stogov
acfc31c0f8 Use zend_error_noreturn() for fatal errors 2015-04-01 13:32:23 +03:00
Xinchen Hui
1c31ad4f0d Unused var 2015-02-21 10:58:23 +08:00
Dmitry Stogov
6b779596d7 Implemented AST pretty-printer 2015-02-19 11:11:17 +03:00
Levi Morrison
c8576c5a46 Implement return types
RFC is documented here: https://wiki.php.net/rfc/return_types
2015-01-27 11:49:56 -07:00
Sara Golemon
1010b0ea4f Provide compiler hook for altering the AST pre-compilation. 2015-01-19 10:43:57 -08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Xinchen Hui
b5b617674e Micro optimaztion (yeah, I know compiler supposed to do that) 2014-12-22 00:10:46 -05:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Anatol Belski
c00424e427 bring back all the TSRMLS_FETCH() stuff
for better comparability with the mainstream
2014-10-15 09:37:55 +02:00
Anatol Belski
06d0230a0f cleanup TSRMLS_FETCH 2014-09-26 09:58:19 +02:00
Anatol Belski
4e09d782ef fix unsigned negation 2014-09-15 12:58:43 +02:00
Nikita Popov
9e75353184 Use zval_ptr_dtor_nogc to destroy literals
Also move the definition of zval_ptr_dtor_nogc to zend_variables.h
(from zend_execute.h/.c) as it's used in a few places.
2014-09-03 15:18:06 +02:00
Anatol Belski
d4a05d1990 fix C89 compat 2014-08-31 21:58:05 +02:00
Nikita Popov
545fd5168e Don't distinguish between ast/list in parser
This removes the need to use $<ast>{n} or $<list>$ casts in the
reduction actions.

Keeping the distinction in the parser doesn't really give us any
benefit and only makes changing the grammar harder.
2014-08-29 21:02:10 +02:00
Nikita Popov
6db293d5e0 Merge remote-tracking branch 'php-src/master' into ast
Conflicts:
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_globals.h
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner.l
	Zend/zend_types.h
2014-08-25 21:52:18 +02:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Nikita Popov
69f0deb399 Fix ast size computation in case of zero children 2014-08-19 11:38:09 +02:00
Nikita Popov
1bab755a35 Fix GC when opcache is in use 2014-08-17 19:15:54 +02:00
Nikita Popov
38a173916c Fix merge 2014-08-16 22:08:02 +02:00
Nikita Popov
71675a4bf8 Merge remote-tracking branch 'php-src/phpng' into ast
Conflicts:
	Zend/zend_ast.c
	Zend/zend_compile.c
	Zend/zend_language_parser.y

Incomplete merge!
2014-08-16 21:55:08 +02:00
Anatol Belski
8ee2a4a9b5 first shot on merging the core fro the int64 branch 2014-08-16 11:16:11 +02:00
Dmitry Stogov
4a3e501fb3 cleanup 2014-08-08 13:47:34 +04:00
Dmitry Stogov
7301994c28 Merge branch 'master' into phpng
* master: (46 commits)
  PHP_INT_MIN and _MAX tests
  NEWS and UPGRADING
  Added PHP_INT_MIN
  Fix wrong lenght size
  Bug #51096 - Remove unnecessary ? for first/last day of
  Moved streams related functions to xp_ssl.c
  Remove duplicate NEWS
  Update NEWS
  Update NEWS
  Update NEWS
  BFN
  BFN
  Fixed bug #67715 (php-milter does not build and crashes randomly).
  We need to turn off any strict mode here for this warning to show up
  Disable restrictions regarding arrays in constants at run-time. For the discussion around it, see the thread on the mailing list: http://www.mail-archive.com/internals@lists.php.net/msg68245.html
  Revert "Fix bug #67064 in a BC safe way"
  Updated NEWS for #67693
  Updated NEWS for #67693
  Fixed bug #67693 - incorrect push to the empty array
  add missing entry to NEWS
  ...

Conflicts:
	Zend/tests/errmsg_040.phpt
	Zend/tests/ns_059.phpt
	Zend/zend_language_parser.y
	Zend/zend_vm_def.h
	ext/openssl/openssl.c
	ext/reflection/php_reflection.c
	ext/session/session.c
	ext/spl/spl_directory.c
	ext/spl/spl_iterators.c
	ext/sqlite3/sqlite3.c
	ext/standard/array.c
2014-08-04 13:56:27 +04:00
Nikita Popov
ad5677e4cd Use ZVAL_COPY until proven wrong 2014-07-30 17:46:00 +02:00
Nikita Popov
cf7f0c412d zend_ast_create determined child count automatically 2014-07-28 18:18:47 +02:00
Nikita Popov
1d79fb308b Add zend_ast_list* variant to parser stack element 2014-07-28 15:10:58 +02:00
Nikita Popov
f29b84ab46 Minor cleanups in AST code 2014-07-28 14:51:08 +02:00
Nikita Popov
d3cb239305 Use separate node type for lists
This saves storing the children count for normal ast nodes.
2014-07-28 12:06:57 +02:00
Nikita Popov
21eb6807c9 Store lineno for zval ast nodes more efficiently 2014-07-27 13:25:32 +02:00
Nikita Popov
edd9fcab1e Fix leaks
Must find a good way to handle constant expressions...
2014-07-26 18:08:31 +02:00
Nikita Popov
d46f67a3a7 Use arena allocator (currently leaky!) 2014-07-26 17:45:45 +02:00
Dmitry Stogov
7c6477ce37 Merge branch 'master' into phpng
* master:
  Removed second zval_copy_ctor()
  Fixed crash on self-referencing constant expression (part of a constant AST)
  Fixed support for constant arrays in context of "const" statement (Zend/tests/constant_expressions_arrays.phpt failed when opcache.protect_memort was set)

Conflicts:
	Zend/zend_ast.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/reflection/php_reflection.c
2014-07-24 01:54:21 +04:00
Dmitry Stogov
39740a33e5 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed crash on self-referencing constant expression (part of a constant AST)
2014-07-24 00:59:42 +04:00
Dmitry Stogov
d909b6330e Fixed crash on self-referencing constant expression (part of a constant AST) 2014-07-24 00:37:15 +04:00
Nikita Popov
d4d4b69e72 Merge branch 'phpng' into ast
Conflicts:
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h

Some of dmitry's optimizations are not merged in yet!
2014-07-22 18:24:58 +02:00
Nikita Popov
df970e9fc2 Pre-evaluate magic constants 2014-07-21 18:02:31 +02:00
Nikita Popov
b24bda6be1 Partial port of class declarations 2014-07-21 16:34:45 +02:00
Nikita Popov
461bce5222 Prepare zend_ast_decl for reuse with classes 2014-07-21 15:38:21 +02:00
Nikita Popov
547331d24d Port methods
The duplicated magic method checks are ugly
2014-07-19 12:52:44 +02:00
Nikita Popov
adbddf4e5b Support static closures 2014-07-18 15:47:46 +02:00
Nikita Popov
405b97e8a9 Handle function doc comments 2014-07-18 15:23:16 +02:00
Nikita Popov
cdcf78f730 Fix lexer/compiler interdependency 2014-07-18 15:05:31 +02:00
Nikita Popov
359f99fe48 Use dedicated func_decl ast node
Functions need a bunch of extra info, that becomes inconvenient
to handle using the normal ast structure.
2014-07-18 14:57:00 +02:00
Nikita Popov
20d2a044ee Lineno corrections 2014-07-16 23:33:22 +02:00
Nikita Popov
f589713cc4 Preliminary function decl support
Problem: __FUNCTION__ etc don't work anymore, due to lexer/parser
interdependency.
2014-07-16 00:07:09 +02:00
Nikita Popov
069da161cf approx correct linenos in errors 2014-07-12 17:10:10 +02:00
Nikita Popov
8577f58e52 Store (bad) estimate of lineno with ast
Currently not used yet
2014-07-12 14:03:42 +02:00
Nikita Popov
80c44ad510 Support creating of ast nodes with >3 children 2014-07-10 15:18:08 +02:00
Dmitry Stogov
acfbb7b6dc Merge branch 'master' into test
* master: (67 commits)
  remove the NEWS entry for the reverted fpm fix
  remove the NEWS entry for the reverted fpm fix
  remove the NEWS entry for the reverted fpm fix
  Revert "Fix Bug #67530 	error_log=syslog ignored"
  --enable-fpm for the travis build
  fix the last fpm NEWS entry, the other bug is related, but not the same what we fixed here
  NEWS
  NEWS
  Fix bug #67091: make install fails to install libphp5.so on FreeBSD 10.0
  adding NEWS entry for the fix for bug #65641
  Updated NEWS file for recent phpdbg fixes
  Fixed issue krakjoe/phpdbg#94 - List behavior is inconsistent
  Fix issue krakjoe/phpdbg#97 - list now appends a newline if there is none The prompt should always ensure it is on a newline
  Fixed test
  Inform about back command existence in help - Fixes krakjoe/phpdbg#100 No way to list the current stack/frames
  Fix issue krakjoe/phpdbg#98 break if does not seem to work
  Fix issue krakjoe/phpdbg#99 register function has the same behavior as run
  Fix readline/libedit (Thanks to @remicollet)
  Replace incorrect `E` command with `ev` in watch help
  Fix typo in `finish` help
  ...

Conflicts:
	Zend/zend_ast.c
	Zend/zend_highlight.c
	Zend/zend_indent.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
	ext/standard/info.c
2014-07-01 00:19:41 +04:00
Nikita Popov
111ad71d38 Rename ZEND_CONST to ZEND_AST_ZVAL 2014-06-28 18:03:26 +02:00
Nikita Popov
dd60c8e0f1 Reuse expr for static_scalar 2014-06-26 22:02:54 +02:00
Nikita Popov
7f01b6fcec Bring static scalar arrays in line 2014-06-26 13:20:39 +02:00
Nikita Popov
0237954778 Bring static scalar AST more in line with normal AST 2014-06-26 13:06:39 +02:00
Nikita Popov
1b84b87e78 Const eval unary pm (as previously) 2014-06-26 12:43:20 +02:00
Xinchen Hui
18bde665f5 Merge branch 'PHP-5.6' 2014-06-24 13:53:43 +08:00
Xinchen Hui
9d49492fd6 Fixed bug #67368 (Memory leak with immediately dereferenced array in class constant) 2014-06-24 13:53:05 +08:00
Nikita Popov
e26c6d663a Implement constant expression folding as a separate pass 2014-06-23 21:59:14 +02:00
Nikita Popov
b6789b1dd6 zend_ast_dynamic_ast returns new node 2014-06-21 19:31:08 +02:00
Nikita Popov
657762ee2b AST stage 2.4 2014-06-21 18:54:13 +02:00
Nikita Popov
55ab55c417 Add ability to specify additional attr in AST 2014-06-19 13:48:50 +02:00
Nikita Popov
89ecd73a04 Make ast->children a uint
Future optimization: only use uint for dynamic lists and use a
uchar or even an introspection function to get the child count.
2014-06-19 13:48:50 +02:00
Nikita Popov
258a733ed2 AST-based compiler: Stage 1 2014-06-14 15:22:18 +02:00
Nikita Popov
98918fe65b Remove (&ast->u.child)[i] weirdness 2014-06-06 22:35:21 +02:00
Dmitry Stogov
0c6a6f0fba Re-applyed Bob's patch with minor fixes 2014-05-07 15:03:56 +04:00
Dmitry Stogov
4ecc527976 Reverted Bob's patch (it breaks many tests when run with opcache and needs to be fixed first). 2014-05-07 03:26:13 +04:00
Nikita Popov
6e87a0857d Fix ZTS build 2014-05-06 19:03:48 +02:00
Bob Weinand
f3c1881f1d Re-added fix for bug #66015 and adapted for phpng branch 2014-05-06 14:59:03 +02: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
df7ca608ce Optimized constant lookup 2014-04-25 00:56:15 +04:00
Bob Weinand
ca447a8f6f Merge branch 'PHP-5.6' 2014-04-11 20:14:44 +02:00
Bob Weinand
096e40a027 Fixed tests for recent constant array changes 2014-04-11 20:13:24 +02:00
Bob Weinand
ccf863c8ce Merge branch 'PHP-5.6' 2014-04-11 19:35:11 +02:00
Bob Weinand
35b895fdf0 Removed useless void* parameter and replaced with zend_bool on zval_update_constant* functions 2014-04-11 19:18:58 +02:00
Bob Weinand
38ec4d20bf Merge branch 'PHP-5.6' 2014-04-11 18:24:41 +02:00
Bob Weinand
ee2a7c7d41 Fixed disallowal of array usage in constants at run-time
Added at the same time the possibility of array dereferencing
to complete the set of features (useful application of arrays in constants)
2014-04-11 18:21:46 +02:00
Bob Weinand
9663193bbc Merge branch 'PHP-5.6' 2014-04-11 10:11:58 +02:00
Bob Weinand
f614fc6898 Fix bug #66015 by reverting "Removed operations on constant arrays." 2014-04-11 10:08:44 +02:00
Dmitry Stogov
3bc8810b1e Constant duplication optimization
Argument receiving optimization
2014-04-04 03:55:27 +04:00
Dmitry Stogov
76cc99fe60 Refactored ZVAL flags usage to simplify various checks (e.g. Z_REFCOUNTED(), candidate for GC, etc) 2014-04-03 15:26:23 +04:00
Bob Weinand
75435e30ae Merge branch 'PHP-5.6' 2014-03-07 07:41:16 +01:00
Tjerk Meesters
3d1fa4cb17 Allow T_POW in constant expressions 2014-03-07 09:14:27 +08:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04: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
Kalle Sommer Nielsen
d14670ccdb Eliminate another TSRMLS_FETCH() in i_zend_is_true()
# Affected extensions have all been updated, ext/opcache and ext/zip
# both have macros for cross version compatibility
2013-12-18 07:25:05 +01:00
Dmitry Stogov
5a87b7ff39 Fixed bug #66252 (Problems in AST evaluation invalidating valid parent:: reference. Constant expessions have to be evaluated in context of defining class). 2013-12-10 14:19:17 +04:00
Bob Weinand
152898ff28 Moved arrays again to "static_scalar:" & little cleanup 2013-11-07 16:39:47 +01:00
Dmitry Stogov
e0135014c3 Renaming 2013-11-07 10:22:49 +04:00
Dmitry Stogov
9647c61dc1 Constant expressions refactoring 2013-11-06 22:21:07 +04:00
Bob Weinand
b45043a1b7 converted several switches to ifs and made more opcache friendly 2013-11-01 16:16:58 +01:00
Bob Weinand
466c5dd1fe Fixed mem leaks, added tests and ternary operator 2013-10-31 18:21:37 +01:00
Bob Weinand
2361745806 Working commit for constant scalar expressions (with constants).
Tests will follow.
2013-10-31 08:57:12 +01:00