Commit Graph

1561 Commits

Author SHA1 Message Date
Nikita Popov
776800b0a0 Discard NS doc comments 2014-07-22 13:54:54 +02:00
Nikita Popov
130b6340d2 Code cleanup 2014-07-22 13:30:26 +02:00
Nikita Popov
cc0bef6636 Fix namespace\, maybe 2014-07-22 13:25:47 +02:00
Nikita Popov
9c69c41a64 Port top level stmt
Problem: namespace\foo no longer works :/
2014-07-22 13:02:51 +02:00
Nikita Popov
8a2ff6b53d Partial NS port (semicolon, no errors) 2014-07-22 12:45:44 +02:00
Nikita Popov
b6c9eb21d4 Port constant declaration 2014-07-22 11:55:07 +02:00
Nikita Popov
64151ec37a Port function/const use 2014-07-21 23:41:11 +02:00
Nikita Popov
573d25b5e7 Drop dead code 2014-07-21 22:58:38 +02:00
Nikita Popov
37ac1b96ed Port use statement 2014-07-21 22:49:31 +02:00
Nikita Popov
94d5d7d01b Remove one usage of implementing_class 2014-07-21 18:25:46 +02:00
Nikita Popov
6c6dd84c50 Dead code 2014-07-21 18:24:10 +02:00
Nikita Popov
f8ce5e6efc Handle const expr __CLASS__ in trait 2014-07-21 18:21:13 +02:00
Nikita Popov
61a6083e99 Fix some remaining class declaration issues 2014-07-21 18:15:09 +02:00
Nikita Popov
df970e9fc2 Pre-evaluate magic constants 2014-07-21 18:02:31 +02:00
Nikita Popov
18fd2a1897 Port __TRAIT__ and __CLASS__ to AST 2014-07-21 17:34:00 +02:00
Nikita Popov
005315510a Mostly finish class declarations (~50 failing tests) 2014-07-21 17:14:01 +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
09564ebacf zend_begin_func_decl 2014-07-21 15:22:13 +02:00
Nikita Popov
028c7d20fb Throw \self etc error
Could only enable this now that everything uses the new format
2014-07-19 23:44:33 +02:00
Nikita Popov
c8d99a1333 No need to handle leading \ in class_name_literal 2014-07-19 23:39:51 +02:00
Nikita Popov
e6e8867550 Fix class name resolution in traits 2014-07-19 23:36:01 +02:00
Nikita Popov
86f1004c4e Improve class name handling 2014-07-19 23:30:07 +02:00
Nikita Popov
e572a32657 Dead code 2014-07-19 22:46:22 +02:00
Nikita Popov
291bcfe4f1 Port trait uses 2014-07-19 22:39:01 +02:00
Nikita Popov
fd7387a761 Handle class const doc comment
Property doc comments not yet handled
2014-07-19 15:20:35 +02:00
Nikita Popov
222430d99c Port class const decl 2014-07-19 15:13:50 +02:00
Nikita Popov
43d6e599cf Port property declarations 2014-07-19 14:54:56 +02:00
Nikita Popov
1aaaedc1eb Dead code 2014-07-19 13:23:25 +02:00
Nikita Popov
6513e959d6 Fix for with empty expression lists 2014-07-19 13:21:12 +02:00
Nikita Popov
ef26f95676 Load lineno when compiling exprs 2014-07-19 13:13:58 +02:00
Nikita Popov
446cf29ab7 Fix compound assign to static property 2014-07-19 13:03:58 +02:00
Nikita Popov
09309a543f Remove dead code 2014-07-19 13:00:57 +02:00
Nikita Popov
74dba7e4db __autoload error 2014-07-19 12:57:31 +02:00
Nikita Popov
547331d24d Port methods
The duplicated magic method checks are ugly
2014-07-19 12:52:44 +02:00
Nikita Popov
b9f62be2e6 Cleanup 2014-07-18 20:24:44 +02:00
Nikita Popov
d0b66f3af3 zend_emit_jump and zend_emit_cond_jump 2014-07-18 20:03:29 +02:00
Nikita Popov
ca7a490758 zend_update_jump_target 2014-07-18 16:11:43 +02:00
Nikita Popov
0eab81f32b Remove bits of dead code 2014-07-18 15:53:38 +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
3ad55e001e Small cleanup
Current problem: build_runtime_defined_function_key is lexer
coupled
2014-07-18 13:15:58 +02:00
Nikita Popov
ae5ba9abfb Port closures 2014-07-18 12:58:24 +02:00
Nikita Popov
abfc8bd894 Port closure use 2014-07-18 12:30:39 +02:00
Nikita Popov
20d2a044ee Lineno corrections 2014-07-16 23:33:22 +02:00
Nikita Popov
64a7132185 Port __METHOD__ 2014-07-16 23:23:25 +02:00
Nikita Popov
a75921dcb1 Port __FUNCTION__ to AST 2014-07-16 23:10:16 +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
1ee3277aba Port parameter defs
Has one bug re \self
2014-07-14 23:03:53 +02:00
Dmitry Stogov
bcc677789c Fixed ZTS build 2014-07-14 15:46:09 +04:00
Dmitry Stogov
af7cb16907 Implemented builtin instruction for strlen() 2014-07-14 15:43:11 +04:00
Dmitry Stogov
42c4bcaed1 Fixed ZTS build 2014-07-14 14:25:04 +04:00
Dmitry Stogov
7dfb4f6b38 Implemented builtin instruction for type check functions - is_*() 2014-07-14 10:33:11 +04:00
Nikita Popov
47f0717a69 Rename params -> args 2014-07-13 13:11:55 +02:00
Nikita Popov
484ad86958 Moar removal 2014-07-12 19:20:21 +02:00
Nikita Popov
f9ed83469c Remove more dead code 2014-07-12 19:18:09 +02:00
Nikita Popov
b934dfe088 Remove dead code 2014-07-12 19:10:19 +02:00
Nikita Popov
856e2a05b6 Fix + improve try/catch 2014-07-12 19:08:09 +02:00
Nikita Popov
069da161cf approx correct linenos in errors 2014-07-12 17:10:10 +02:00
Nikita Popov
c58079b4fd Port static vars
Need to figure out the constant expr stuff
2014-07-12 17:00:53 +02:00
Nikita Popov
86a1cd0d82 Verious fixes 2014-07-12 16:25:47 +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
e367e68111 Port try/catch
Down to 50 failing Zend tests
2014-07-12 13:50:58 +02:00
Dmitry Stogov
6c8db864e0 Implemented builtin instruction for strlen() 2014-07-11 18:52:27 +04:00
Nikita Popov
32ca08f249 Fix leak 2014-07-11 15:33:39 +02:00
Nikita Popov
dde9faee2e Port switch 2014-07-11 15:31:47 +02:00
Nikita Popov
f12c1482a3 Port foreach 2014-07-11 12:16:21 +02:00
Dmitry Stogov
de306e7088 Implement call_user_func() and call_user_func_array() using special opcodes.
In some rare cases it leads to insignificant changes in error messages.
2014-07-11 00:32:18 +04:00
Nikita Popov
4215969904 Port if (partial) 2014-07-10 16:38:04 +02:00
Nikita Popov
3be63fca48 Port for 2014-07-10 15:51:47 +02:00
Nikita Popov
1738ee7e5a Port do/while 2014-07-10 14:46:22 +02:00
Nikita Popov
c7656c06cc Port while
Note: From here on everything is broken
2014-07-10 14:35:59 +02:00
Nikita Popov
68777b72b2 Expr stmts go through ast 2014-07-10 00:04:27 +02:00
Nikita Popov
1de1bc96a5 Make statement asty 2014-07-10 00:00:48 +02:00
Nikita Popov
117714d122 Port goto label 2014-07-09 23:46:22 +02:00
Nikita Popov
d14b763bb9 Make unticked_statement an ast node (usually NULL) 2014-07-09 23:39:21 +02:00
Nikita Popov
fc541418f2 Port goto 2014-07-09 23:11:32 +02:00
Nikita Popov
cc8a6fa91e Port break/continue 2014-07-09 23:05:21 +02:00
Nikita Popov
5bf0c28fe3 Port throw 2014-07-09 22:48:42 +02:00
Dmitry Stogov
b36aaea6ed ZEND_SEND_VAR and ZEND_SEND_VAL specialization 2014-07-08 02:13:53 +04:00
Nikita Popov
289265402a Port echo 2014-07-07 21:14:14 +02:00
Nikita Popov
36c3cf3198 Port return statement 2014-07-07 21:06:02 +02:00
Nikita Popov
2d4c962c61 Fix ZTS build 2014-07-05 14:12:20 +02:00
Nikita Popov
77fddc0ca2 Use zend_string* in some places 2014-07-05 00:11:00 +02:00
Nikita Popov
17c2d16d79 Refactor class name resolution as well 2014-07-04 23:45:20 +02:00
Nikita Popov
b3336270f6 Hack around global leak for now 2014-07-04 23:15:31 +02:00
Xinchen Hui
1d1226afa2 Suppress warning "cast from pointer to integer of different size" 2014-07-01 10:36:19 +08:00
Dmitry Stogov
b7715c7e8a Refactored parameter passing mechanism.
In PHP-5.6 and below each argument passed to user function was copies on VM stack twice.
Now we always have ZEND_INIT_FCALL (or simular) opcode that pushes "call frame" on top of VM stack.
"Call frame" is actually the same zend_execute_data structure.
All the following ZEND_SEND instructions push arguments on top of the stack in a way that they directly comes into corresponding CV variables of the called frame. Extra arguments are copied at the end of stack frame (after all CV and TMP variables) on function enterance.

There are two minor incompatibilities:
1) It's not allowed to decalre functions redefining arguments e.g. "function foo($a,$a) {}".
2) func_get_arg() and func_get args() return the current value of argument and not the original value that was sent.
2014-06-30 15:43:45 +04:00
Nikita Popov
fb98dd31a0 Some refactoring of fn/const resolution 2014-06-28 22:27:06 +02:00
Nikita Popov
e198132542 Drop addition of weird \ prefix for FQ consts
Also fixes a resolution bug
2014-06-28 18:24:59 +02:00
Nikita Popov
111ad71d38 Rename ZEND_CONST to ZEND_AST_ZVAL 2014-06-28 18:03:26 +02:00
Nikita Popov
64dab4b914 Drop dead code 2014-06-26 22:17:19 +02:00
Nikita Popov
0e44f4c583 Remove obseleted grammar productions 2014-06-26 22:09:05 +02:00
Nikita Popov
dd60c8e0f1 Reuse expr for static_scalar 2014-06-26 22:02:54 +02:00
Nikita Popov
dd60b9bb91 Handle ::class in const expr via ast as well 2014-06-26 21:44:46 +02:00
Nikita Popov
080e8bffa5 Compile const refs to CONST 2014-06-26 16:56:50 +02:00
Nikita Popov
b83c70416b Compile class const refs to CONST zval 2014-06-26 16:35:30 +02:00
Nikita Popov
08c4e01a1b Add compilation state for static scalars 2014-06-26 16:03:15 +02:00
Nikita Popov
1b84b87e78 Const eval unary pm (as previously) 2014-06-26 12:43:20 +02:00
Nikita Popov
e26c6d663a Implement constant expression folding as a separate pass 2014-06-23 21:59:14 +02:00
Nikita Popov
0644fbccf7 Implement CT eval of binary expressions
I totally hate this approach. It's ugly and I don't think I can
share code with the static scalar evaluation. Maybe I should use
the approach that static scalars use instead?
2014-06-22 15:57:44 +02:00
Nikita Popov
90d36554e2 Support string interpolation 2014-06-21 20:06:46 +02:00
Nikita Popov
b6789b1dd6 zend_ast_dynamic_ast returns new node 2014-06-21 19:31:08 +02:00
Nikita Popov
86db3942cf Remove dead code 2014-06-21 18:54:30 +02:00
Nikita Popov
657762ee2b AST stage 2.4 2014-06-21 18:54:13 +02:00
Nikita Popov
0c81b3eae2 Remove dead code 2014-06-19 13:48:49 +02:00
Nikita Popov
0ec49bba22 AST stage 1.9
Expressions (mostly) use the AST
2014-06-19 13:48:35 +02:00
Dmitry Stogov
b108267f2c Merge branch 'master' into phpng
* master: (41 commits)
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  NEWS
  Fix Request #67453 Allow to unserialize empty data.
  Update copyright year to 2014
  Update copyright year for re2c generated files
  Update copyright year to 2014
  Update copyright year for re2c files as well
  Fix patch for bug #67436
  fix failed test
  Fix test on modern distro where old unsecure algo are disabled in openssl config. Testing recent algo should be enough to check this function.
  Added tests for bug 67436
  Fixed wrong XFAIL test - already fixed
  Fix typo in Bug #67406 NEWS entry
  Fix typo in Bug #67406 NEWS entry
  ...

Conflicts:
	Zend/zend_compile.c
	ext/session/session.c
	ext/standard/array.c
	ext/standard/http_fopen_wrapper.c
	tests/classes/bug63462.phpt
2014-06-18 17:50:27 +04:00
Dmitry Stogov
e1b18e59f7 Use arena allocator for zend_class_entry, zend_op_array and zend_property_info that live till the end of request 2014-06-18 02:47:01 +04:00
Dmitry Stogov
a8e63d2b56 Fixed support for constants inherited from interfaces 2014-06-17 01:15:51 +04:00
Dmitry Stogov
909acec231 Avoid useles constants update 2014-06-16 23:32:58 +04:00
Dmitry Stogov
bd10db271c Use new zend_hash iteration API 2014-06-16 21:11:52 +04:00
Bob Weinand
3c2b42ac41 Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	Zend/zend_compile.c
2014-06-16 11:18:45 +02:00
Bob Weinand
e93f8e74d4 Merge branch 'PHP-5.4' into PHP-5.5 2014-06-16 11:16:33 +02:00
Bob Weinand
0a3979e08b Fix patch for bug #67436 2014-06-16 11:10:50 +02:00
Bob Weinand
f92143f740 Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	NEWS
	Zend/zend_compile.c
2014-06-15 23:06:15 +02:00
Bob Weinand
f5f1c702cd Merge branch 'PHP-5.4' into PHP-5.5 2014-06-15 22:24:44 +02:00
Bob Weinand
ca29063da5 Fix bug #67436 2014-06-15 22:18:25 +02:00
Nikita Popov
258a733ed2 AST-based compiler: Stage 1 2014-06-14 15:22:18 +02:00
Dmitry Stogov
592c8a0426 Improved conditions order 2014-06-11 02:46:50 +04:00
Nikita Popov
98918fe65b Remove (&ast->u.child)[i] weirdness 2014-06-06 22:35:21 +02:00
Dmitry Stogov
e499c3d259 Introduced new BIND_GLOBAL instraction instead of FETCH_W+ASSIGN_REF pair that caused a lot of useles checks 2014-06-06 15:04:30 +04:00
Dmitry Stogov
c1965f58d4 Use reference counting instead of zval duplication 2014-06-05 16:04:11 +04:00
Dmitry Stogov
3f6f0d5a70 Simplified and optimized ZEND_HANDLE_NUMERIC() 2014-06-03 13:10:42 +04:00
Nikita Popov
5c2120b6cf Forbid writing to temporary expressions 2014-05-31 19:41:39 +02:00
Nikita Popov
c53a7ea4e5 Property handle calls on [] and '' consts/tmps 2014-05-31 17:37:30 +02:00
Nikita Popov
8a65c3b234 Remove now unnecessary code in begin_method_call 2014-05-31 16:08:38 +02:00
Nikita Popov
fcf42d817d Remove object_stack (mostly) 2014-05-31 15:59:54 +02:00
Nikita Popov
87f8e758c8 Cleanup old grammar rules 2014-05-30 23:51:54 +02:00
Nikita Popov
a8c1595012 LTR static member access 2014-05-30 22:33:03 +02:00
Nikita Popov
95a3a12657 Change precedence of $ operator
$$foo['bar'] is now interpreted as ${$foo}['bar'] rather than
${$foo['bar']}.
2014-05-30 16:31:10 +02:00
Xinchen Hui
9f70b2f6fa typo 2014-05-30 14:56:50 +08:00
Dmitry Stogov
b3b616cf7e Introduced immutable arrays. They don't need to be copyed and may be used directly from SHM. 2014-05-29 18:21:56 +04:00
Dmitry Stogov
05d0df4706 Use new zend_hash API 2014-05-26 21:29:35 +04:00
Xinchen Hui
922285ec55 Don't use cast (compiler friendly) 2014-05-26 11:05:04 +08:00
Xinchen Hui
bc357eaf3f Fixed apply_func_args_t 2014-05-25 20:04:35 +08:00
Xinchen Hui
0175d994c0 Fixed apply_func_arg_t, and it's better not using cast (compiler friendly) 2014-05-25 19:56:51 +08:00
Dmitry Stogov
9eb89dddb1 Use optimized zend_array_dup() function. convert zend_hash_num_elements() and zend_hash_next_free_element() into macros. 2014-05-23 20:37:53 +04: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
Bob Weinand
f3c1881f1d Re-added fix for bug #66015 and adapted for phpng branch 2014-05-06 14:59:03 +02:00
Hannes Magnusson
0ebf0c02a0 Fix argument, cur_method_ref->class_name is a zend_string 2014-05-05 21:45:33 -07:00
Nikita Popov
e0247de147 zend_stack_top() now returns pointer directly 2014-05-01 09:08:30 +02:00
Nikita Popov
5a03efe279 Don't allocate zend_stack elements individually
Instead allocate a vector of elements. Size must now be specified
on initialization rather than on push.
2014-05-01 09:08:29 +02:00
Dmitry Stogov
17d027ed47 Split IS_BOOL into IS_FALSE and IS_TRUE 2014-04-30 18:32:42 +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
7e424f5a95 Use symbolic names instead of magic constants + optimization 2014-04-23 02:47:41 +04:00
Nikita Popov
9c70603f4a Initialize hash as unpacked if it contains string keys 2014-04-22 21:33:49 +02:00