Commit Graph

272 Commits

Author SHA1 Message Date
Nikita Popov
4c05bec536 Remove some unused compiler globals 2014-07-28 15:52:18 +02:00
Nikita Popov
d46f67a3a7 Use arena allocator (currently leaky!) 2014-07-26 17:45:45 +02:00
Nikita Popov
689891c2b2 Expose ast via CG(ast) 2014-07-24 20:51:01 +02: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
43b2973ee7 Remove declare_stack 2014-07-22 16:18:13 +02:00
Dmitry Stogov
6bf24f4dd0 Removed EG(active_symbol_table) and use corresponding value from EG(current_execute_data) 2014-07-04 18:03:45 +04:00
Dmitry Stogov
c4d99ec982 Removed EG(called_scope) and use corresponding value from EG(current_execute_data) 2014-07-03 02:34:43 +04: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
63c057e331 Removed EG(opline_ptr) and use corresponding value from EG(current_execute_data) 2014-07-02 23:29:53 +04:00
Dmitry Stogov
4b09dd69e6 Removed EG(active_op_array) and use corresponding value from EG(current_execute_data) 2014-07-02 22:03:21 +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
Nikita Popov
fcf42d817d Remove object_stack (mostly) 2014-05-31 15:59:54 +02:00
Nikita Popov
20f2e5986e Fix ZTS build
This only makes it compile, it doesn't actually work, presumably
because interned strings are assumed in some places.
2014-04-09 23:41:16 +02:00
Dmitry Stogov
8dedaf8512 Use interned strings for one character strings 2014-04-01 18:06:50 +04:00
Dmitry Stogov
aa5f55306b Refactored EG(active_symbol_table) to be zend_array* instead of HashTable* 2014-03-17 23:15:22 +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
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Dmitry Stogov
03a37de9b3 Improved empty string handling. Now ZE uses an interned string instead of allocation new empty string each time. (Some extensions might need to be fixed using str_efree() instead of efree() to support interned strings). 2013-12-26 14:47:13 +04:00
Adam Harvey
95675dfba9 Remove now unused function_filenames struct. 2013-11-08 21:32:09 -05:00
Igor Wiedler
85d4cfb00d Disallow using functions/consts defined in the same file
* Keep track of defined function and const filenames
* Prohibit use function foo if function foo exists
* Prohibit use const foo if const foo exists
2013-08-25 00:02:46 +02:00
Igor Wiedler
4adf49eeaf Import namespaced constants via new 'use const' sequence 2013-08-22 15:51:26 +02:00
Igor Wiedler
5dd41627be Add new 'use function' sequence for importing namespaced functions
This is specified as the use_function RFC:

* https://wiki.php.net/rfc/use_function
2013-08-22 15:51:25 +02:00
Stanislav Malyshev
c793a65690 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  non living code related typo fixes

Conflicts:
	Zend/zend_compile.c
2013-08-04 16:06:24 -07:00
Veres Lajos
8d86597d73 non living code related typo fixes 2013-08-04 16:05:36 -07: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
Dmitry Stogov
70f83f35d0 . The VM stacks for passing function arguments and syntaticaly nested calls were merged into a single stack. The stack size needed for op_array execution is calculated at compile time and preallocated at once. As result all the stack push operatins don't require checks for stack overflow any more.
. Generators implementation was improved using the new VM stack. Now it's a bit more clear and faster.
2012-11-30 13:39:23 +04:00
Nikita Popov
4cf90e06c9 Fix lexing of nested heredoc strings in token_get_all()
This fixes bug #60097.

Before two global variables CG(heredoc) and CG(heredoc_len) were used to
track the current heredoc label. In order to support nested heredoc
strings the *previous* heredoc label was assigned as the token value of
T_START_HEREDOC and the language_parser.y assigned that to CG(heredoc).

This created a dependency of the lexer on the parser. Thus the
token_get_all() function, which accesses the lexer directly without
also running the parser, was not able to tokenize nested heredoc strings
(and leaked memory). Same applies for the source-code highlighting
functions.

The new approach is to maintain a heredoc_label_stack in the lexer, which
contains all active heredoc labels.

As it is no longer required, T_START_HEREDOC and T_END_HEREDOC now don't
carry a token value anymore.

In order to make the work with zend_ptr_stack in this context more
convenient I added a new function zend_ptr_stack_top(), which retrieves the
top element of the stack (similar to zend_stack_top()).
2012-03-31 21:53:30 +02: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
72f7be3df0 - Improved parse error messages 2011-06-23 23:00:53 +00:00
Felipe Pena
0372e6ad80 - Improved parse error messages 2011-06-23 23:00:53 +00:00
Felipe Pena
0203cc3d44 - Year++ 2011-01-01 02:17:06 +00:00
Moriyoshi Koizumi
bbf3d43c1e * Refactor zend_multibyte facility.
Now mbstring.script_encoding is superseded by zend.script_encoding.
2010-12-19 16:36:37 +00:00
Dmitry Stogov
755c2cd0d8 Removed compile time dependency from ext/mbstring 2010-12-08 11:27:34 +00:00
Dmitry Stogov
ab93d8c621 Added multibyte suppport by default. Previosly php had to be compiled with --enable-zend-multibyte. Now it can be enabled or disabled throug zend.multibyte directive in php.ini 2010-11-24 05:41:23 +00:00
Dmitry Stogov
f2df6a4a3e - Improved memory usage
. zend_function.pass_rest_by_reference is replaced by
    ZEND_ACC_PASS_REST_BY_REFERENCE in zend_function.fn_flags
  . zend_function.return_reference is replaced by ZEND_ACC_RETURN_REFERENCE
    in zend_function.fn_flags
  . zend_arg_info.required_num_args removed. it was needed only for internal
    functions. Now the first arg_info for internal function (which has special
    meaning) is represented by zend_internal_function_info structure.
  . zend_op_array.size, size_var, size_literal, current_brk_cont,
    backpatch_count moved into CG(context), because they are used only during
    compilation.
  . zend_op_array.start_op is moved into EG(start_op), because it's used
    only for 'interactive' execution of single top-level op-array.
  . zend_op_array.done_pass_two is replaced by ZEND_ACC_DONE_PASS_TWO in
    zend_op_array.fn_flags.
  . op_array.vars array is trimmed (reallocated) during pass_two.
  . zend_class_entry.constants_updated is replaced by
     ZEND_ACC_CONSTANTS_UPDATED in zend_class_entry.ce_flags
  . the size of zend_class_entry is reduced by sharing the same memory space
    by different information for internal and user classes.
    See zend_class_inttry.info union.
2010-09-15 07:38:52 +00:00
Dmitry Stogov
8a6d73b084 improved performance of @ (silence) operator 2010-08-18 13:58:13 +00:00
Dmitry Stogov
5438a9d23c Eliminated useless allocation of FPU control word on each request startup 2010-07-09 09:02:14 +00:00
Felipe Pena
f2419953d9 - MF5.3: Reverted fix for bug #48930 (due binary compatibility breakage)
# To commit a new common fix
2010-06-30 02:30:14 +00:00
Felipe Pena
3396a6d185 - Fixed bug #48930 (__COMPILER_HALT_OFFSET__ incorrect in PHP >= 5.3) 2010-06-27 21:46:16 +00:00
Dmitry Stogov
f7ce69585c - Interned string related callbacks moved turned from compiler_globals into real globals
- Updated API version number
2010-05-25 09:00:20 +00:00
Dmitry Stogov
f23e857676 Fixed ZTS build 2010-05-24 17:07:52 +00:00
Felipe Pena
0a6bcd44a7 - Removed allow_call_time_pass_reference (Pierrick) 2010-04-26 00:13:34 +00:00
Dmitry Stogov
dd5c478be6 Added concept of interned strings. All strings constants known at compile time are allocated in a single copy and never changed. 2010-04-20 11:05:54 +00:00
Sebastian Bergmann
d2281d1dff sed -i "s#1998-2009#1998-2010#g" **/*.c **/*.h **/*.php 2010-01-05 20:46:53 +00:00
Dmitry Stogov
bcd9099b28 Fixed bug #47038 (Memory leak in include) 2009-03-25 15:23:58 +00:00
Dmitry Stogov
31c0af245e Fixed floating point mathematic speed degradation (Christian) 2009-03-18 10:18:10 +00:00
Pierre Joye
f704a50732 - add EG(windows_version_info), set at init time once per instance
contains a OSVERSIONINFOEX struct. It lets us determine easily on which windows version is used (for example)
2009-01-16 00:57:43 +00:00
Sebastian Bergmann
08659c2dcd MFH: Bump copyright year, 3 of 3. 2008-12-31 11:15:49 +00:00
Dmitry Stogov
ea45b713c8 Added support for namespaces with brackets. (Greg) 2008-11-25 09:56:32 +00:00
Marcus Boerger
32f9d0e180 - MFH Improve exception linking 2008-08-14 10:24:52 +00:00
Marcus Boerger
106864bcbb - MFH Fix memleak with new error handling stack'ing 2008-08-11 17:19:20 +00:00
Moriyoshi Koizumi
4f42ed39c0 - Revived zend multibyte 2008-07-24 22:21:41 +00:00
Rui Hirokawa
c3286f32ef implemented again zend-multibyte for PHP 5.3 2008-06-29 08:21:35 +00:00
Scott MacVicar
6f20cea6d8 Fixes to heredoc and cleanup of new re2c scanner. (Patch by Matt Wilmas) 2008-04-09 20:50:58 +00:00
Felipe Pena
f66f55edc5 MFH: Implemented "jump label" operator (limited "goto")
[DOC]
2008-03-28 14:35:01 +00:00
Rasmus Lerdorf
10afe5d96b Make the sigsetjmp change more robust. On systems that don't have
sigsetjmp use setjmp.  Windows is of course weird in that it seems to
have sigsetjmp but not sigjmp_buf (??) so force it to use setjmp in
config.w32.h.in
2008-03-18 21:14:28 +00:00
Rasmus Lerdorf
c9e0781d2a Use sigsetjmp and siglongjmp instead of setjmp/longjmp in order to be
consistent in how we deal with the signal mask.  POSIX doesn't specify
what to do with the signal mask in setjmp/longjmp which has resulted in
the signal mask getting saved on *BSD and not getting saved on Linux.
Making the behaviour explicit via sigsetjmp/siglongjmp gives us
consistency and saves expensive sigprocmask() syscalls on *BSD.
2008-03-18 18:34:11 +00:00
Felipe Pena
2b10c53ae1 MFH: Dropped zend.ze1_compatibility_mode
[DOC]
2008-03-18 14:10:45 +00:00
Dmitry Stogov
8c885b8913 Implemented concept of "delayed early binding" that allows opcode caches to perform class declaration (early and/or run-time binding) in exactly the same order as vanila php.
The following pseudo-code explains how it should be used in opcode cache.

function cache_compile_file($filename) {
        if (!is_cached($filename)) {
                ...
                orig_compiler_options = CG(compiler_optins);
                CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES |
                                        ZEND_COMPILE_DELAYED_BINDING;
                $op_array = orig_compile_file($filename);
                CG(compiler_options) = orig_copiler_options;
                ...
        } else {
                $op_array = restore_from_cache($filename);
        }
        zend_do_delayed_early_binding($op_array);
}
2008-03-18 08:36:30 +00:00
Marcus Boerger
af316021e8 - Rewrite scanner to be based on re2c instead of flex
The full patch is available as:
  http://php.net/~helly/php-re2c-5.3-20080316.diff.txt
  This is against php-re2c repository version 98
  An older patch against version 97 is available under:
  http://php.net/~helly/php-re2c-97-20080316.diff.txt
2008-03-16 21:06:55 +00:00
Felipe Pena
fd0d44f0a7 User error handlers no longer catch supressed errors (patch by Etienne Kneuss) 2008-03-08 21:54:03 +00:00
Dmitry Stogov
0b6825102d Changed EG(argument_stack) implementation. 2008-01-24 09:41:39 +00:00
Dmitry Stogov
fa47e900e2 Changed exception handling. Now each op_array doesn't contain ZEND_HANDLE_EXCEPTION opcode in the end 2008-01-21 19:39:55 +00:00
Sebastian Bergmann
d1dded8751 MFH: Bump copyright year, 2 of 2. 2007-12-31 07:17:19 +00:00
Dmitry Stogov
c3ab6bd091 Fixed bug #43136 (possible crash on script execution timeout. The EG(function_state_ptr) is completely removed, EG(current_execute_data)->function_state must be used instead) 2007-11-20 09:51:12 +00:00
Dmitry Stogov
166266df68 Added support for Late Static Binding. (Dmitry, Etienne Kneuss) 2007-09-29 07:28:34 +00:00
Dmitry Stogov
f32ffe9b43 Namespaces 2007-09-28 19:52:53 +00:00
Jani Taskinen
09b6f37f20 MFH:
- Added ".htaccess" style user-defined php.ini files support for
  CGI/FastCGI.
- Added support for special [PATH=/opt/httpd/www.example.com/] sections
  in php.ini. All directives set in these sections will not be able to be
  overridden in user-defined ini-files or during runtime in the specified
  path.

- Improved php.ini handling:
  . Added better error reporting for syntax errors in php.ini files
  . Allowed "ini-variables" to be used almost everywhere ini php.ini files
  . Allowed using alphanumeric/variable indexes in "array" ini options
  . Fixed get_cfg_var() to be able to return "array" ini options

- Fixed bug #27372 (parse error loading browscap.ini at apache startup)
- Fixed bug #42069 (parse_ini_file() allows using some non-alpha numeric
  characters)
2007-09-28 02:05:10 +00:00
Sebastian Bergmann
4223aa4d5e MFH: Bump year. 2007-01-01 09:36:18 +00:00
Antony Dovgal
d6ee9d4810 MFH: fix #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper) 2006-09-11 14:30:08 +00:00
Dmitry Stogov
29ed52ffa4 New memory manager 2006-07-18 09:06:33 +00:00
Zeev Suraski
51d495850a Restore ZE1 compatibility mode (Zend Engine part - the modules patches
will follow later today)
2006-06-05 13:58:52 +00:00
Dmitry Stogov
14f6b9149d Optimized zend_try/zend_catch macroses (eliminated memcpy()) 2006-05-19 06:09:15 +00:00
Dmitry Stogov
14cad8fdc3 Optimized shutdown sequence to iterate only over modified ini directives 2006-05-15 14:52:35 +00:00
Marcus Boerger
637a40423c - MFH as discussed
. zend_exception_get_default() -> zend_exception_get_default(TSRMLS_D)
  . zend_get_error_exception()   -> zend_get_error_exception(TSRMLS_D)
  . added E_RECOVERABLE_ERROR
  . added ZEND_TOSTRING_FUNC_NAME
  . added __tostring function cache to zend_class_entry
  . added ZEND_NAMED_ME
  . modified ZEND_ME_MAPPING to support method flags
  . added ZEND_MN
  . method entries now use prefix "zim_" instead of "zif_"
  . drop EG(ze1_compatibility_mode)
  . changed cast handler, now without (int should_free):
    typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_DC);
  . changed get_iterator, now receives whether value is by ref:
    zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
  . added zend_objects_store_add_ref_by_handle
  . added zend_objects_store_del_ref_by_handle
  . convert_to_explicit_type(pzv, type)
2006-05-09 23:53:23 +00:00
Andi Gutmans
61e93ccfe8 - Update copyright notices to 2006 2006-01-04 23:53:05 +00:00
Dmitry Stogov
8768ab94b3 Fixed bug #34729 (Crash in ZTS mode under Apache) 2005-12-01 11:48:17 +00:00
Dmitry Stogov
a8c6b992b8 Fixed bug #35147 (__HALT_COMPILER() breaks with --enable-zend-multibyte) 2005-11-15 13:29:39 +00:00
foobar
916815b779 Bump up the year 2005-08-03 13:30:58 +00:00
Derick Rethans
e612284ea4 - Fixed bug #30630: Added a BSD based strtod function that is
locale-independent.
2004-11-03 23:13:32 +00:00
Anantha Kesari H Y
b04db9d9e0 Reverted the NetWare Specific Stack limit related patches as asked by Andi 2004-09-23 06:23:36 +00:00
Anantha Kesari H Y
b66e7aec62 NetWare specific stack limit checks 2004-09-22 15:51:56 +00:00
Marcus Boerger
b7a8297bc1 - Boost up __autoload() calls by caching the lookup 2004-08-23 20:57:40 +00:00
Andi Gutmans
57ba9b8ccf - Second wave of garbage removal. 2004-08-19 20:29:04 +00:00
Marcus Boerger
5230321731 - Fix Reflection class names
- Add ability to get the extension an internal class was defined in
# This is the patch Andi and me used to search for underscrores...
2004-03-30 18:36:53 +00:00
Dmitry Stogov
55cf45abf5 New autoload protection schema was implemented (Using HashTable instead of boolean flag) 2004-03-24 14:30:59 +00:00
Zeev Suraski
eb6fd52e21 - Rename compatiblity mode to zend.ze2_compatibility_mode (it doesn't only affect auto-clone).
- Perform implementation checks even with simple inheritance (off when
  compatibility mode is enabled).
- Restore default arguments in interfaces and handle it correctly.
- Move registration of internal classes later in the startup sequence
  in order to have INI options available.
2004-02-25 10:57:10 +00:00
Zeev Suraski
9e60cb553f Rewrote exception support. Fixes a few limitations and bugs in the old
implementation, and allows exceptions to 'fire' much earlier than before.

Instructions on how to use the new mechanism will follow on internals@
shortly...

Note - this (most probably) breaks the current implementation of
set_exception_handler()
2004-02-03 12:17:09 +00:00
Zeev Suraski
a72c1ab93b Added error mask to set_error_handler()
Patch by Christian Schneider <cschneid@cschneid.com>
2004-01-10 11:43:42 +00:00
foobar
ccfc46b0aa - Happy new year and PHP 5 for rest of the files too..
# Should the LICENSE and Zend/LICENSE dates be updated too?
2004-01-08 17:33:29 +00:00
Marcus Boerger
c6cb00fe59 Fixed bug #26697 (calling class_exists on a nonexistent class in __autoload
results in segfault).
2003-12-23 10:45:10 +00:00
Masaki Fujimoto
ab9dcec292 - added script encoding support to Zend Engine 2.
this enables ZE2 to gracefully parse scripts written in UTF-8 (with BOM),
  UTF-16, UTF-32, Shift_JIS, ISO-2022-JP etc... (when configured with
  '--enable-zend-multibyte' and '--enable-mbstring')
2003-08-11 05:24:42 +00:00
Stanislav Malyshev
237116aa27 Remove namespace leftovers 2003-07-23 08:58:46 +00:00
Andi Gutmans
02c7aacf83 - Nuke CG(in_clone_method) 2003-07-02 16:52:07 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Stanislav Malyshev
f7f5a5ea6b MEGA-patch: namespaces are R.I.P. 2003-06-02 12:13:11 +00:00
Andrei Zmievski
bdd3b6042c Implement a different way to catch documentation comments. 2003-04-02 16:51:49 +00:00