Commit Graph

502 Commits

Author SHA1 Message Date
Felipe Pena
62e4cfc2d0 - Added zend_is_auto_global_quick function 2011-07-10 15:03:38 +00:00
Felipe Pena
0fe6fd9e89 - Changed zend_resolve_class_name() prototype
# No needed to pass fetch_type as pointer here
2011-07-09 17:27:59 +00:00
Felipe Pena
70cacfd3a8 - Changed zend_resolve_class_name() prototype
# No needed to pass fetch_type as pointer here
2011-07-09 17:27:59 +00:00
Felipe Pena
c6b73c85ba - Fix broken code in 64bit 2011-06-20 22:59:55 +00:00
Felipe Pena
dcccfc2267 - Fix broken code in 64bit 2011-06-20 22:59:55 +00:00
Felipe Pena
d6f5f3782b - Minor optimization (avoid to re-hash already computed var name hash) 2011-06-19 21:56:09 +00:00
Felipe Pena
142ce5c949 - Minor optimization (avoid to re-hash already computed var name hash) 2011-06-19 21:56:09 +00:00
Felipe Pena
80d432ca62 - Avoid zend_do_ticks() call for each statement in parsing 2011-06-12 01:43:10 +00:00
Felipe Pena
e613aae620 - Avoid zend_do_ticks() call for each statement in parsing 2011-06-12 01:43:10 +00:00
Felipe Pena
0203cc3d44 - Year++ 2011-01-01 02:17:06 +00:00
Stefan Marr
d88515e1b8 Fixed naming of parameters, was inconsistent with implementation. 2010-12-19 22:13:41 +00:00
Stefan Marr
d0c144d732 Removed old commented function prototypes.
# Was referring to old trait-related code that is long gone
2010-12-01 15:20:11 +00:00
David Soria Parra
76a8811c5d C comments instead of C++ comments 2010-11-30 12:51:57 +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
f0c8366a9e - use interned strings for auto globals
- $GLOBALS became a JIT autoglobal, so it's initialized only if used (this may affect opcode caches)
2010-07-08 14:05:11 +00:00
Felipe Pena
3ea3bbaca3 - Fix ZTS build 2010-07-06 15:52:39 +00:00
Dmitry Stogov
1a1178a685 eliminated unnecessary iterations during request startup/shutdown 2010-07-06 11:40:17 +00:00
Dmitry Stogov
a09b7138a9 Used more sutable type. Reduced memory usage. 2010-07-01 08:58:14 +00:00
Dmitry Stogov
c5237d82bf Added caches to eliminate repeatable run-time bindings of functions, classes, constants, methods and properties 2010-05-24 14:11:39 +00:00
Derick Rethans
1bc9247651 - Added scalar typehinting. 2010-05-20 19:18:35 +00:00
Stefan Marr
cd6415f1a9 Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
# 
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
# 
# Internals of the Traits Patch
# -----------------------------
# 
# Open TODOs
# """"""""""
# 
# - Reflection API
# - support for traits for internal classes
#   - currently destroy_zend_class does not handle that case 
# 
# Introduced Structures
# """""""""""""""""""""
# 
# Data structures to encode the composition information specified in the
# source:
#  - zend_trait_method_reference
#  - zend_trait_precedence
#  - zend_trait_alias
# 
# Changes
# """""""
# 
# zend_class_entry
#  - uses NULL terminated lists of pointers for
#    - trait_aliases
#    - trait_precedences
#    - do you prefer an explicit counter?
#    - the information is only necessary during class composition
#      but might be interesting for reflection
#    - did not want to blow up class further with not really necessary length counters
# 
# added keywords
#   - trait
#   - insteadof
# 
# Added opcodes
#  ZEND_ADD_TRAIT
#    - similar to ZEND_ADD_INTERFACE
#    - adds the trait to the list of traits of a class, no actual composition done
#  ZEND_BIND_TRAITS
#    - emitted in zend_do_end_class_declaration
#    - concludes the class definition and will initiate the trait composition
#      when the class definition is encountered during runtime
# 
# Added Flags
#   ZEND_ACC_TRAIT = 0x120
#   ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
#   ZEND_FETCH_CLASS_TRAIT = 14
# 
# zend_vm_execute.h
#  - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
#    ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
# 
# zend_compile.c
#  - refactored do_inherit_method_check
#    split into do_inherit_method_check and do_inheritance_check_on_method
#  - added helper functions use a '_' as prefix and are not mentioned in the
#    headers
#  - _copy_functions
#    prepare hash-maps of functions which should be merged into a class
#    here the aliases are handled
#  - _merge_functions
#    builds a hash-table of the methods which need to be added to a class
#    does the conflict detection
#  - reused php_runkit_function_copy_ctor
#    - it is not identical with the original code anymore, needed to update it
#      think I fixed some bugs, not sure whether all have been reported back to runkit
#    - has to be renamed, left the name for the moment, to make its origin obvious
#    - here might be optimization potential
#    - not sure whether everything needs to be copied
#      - copying the literals might be broken
#        - added it since the literals array is freed by efree and gave problems
#          with doubled frees
#      - all immutable parts of the zend_op array should not be copied
#        - am not sure which parts are immutable
#        - and not sure how to avoid doubled frees on the same arrays on shutdown
#  - _merge_functions_to_class
#    does the final merging with the target class to handle inherited
#    and overridden methods
#  - small helper for NULL terminated lists
#    zend_init_list, zend_add_to_list
# 
# zend_language_parser.y
#  - reused class definition for traits
#    - there should be something with regard to properties
#      - if they get explicitly defined, it might be worthwhile to
#        check that there are no collisions with other traits in a composition
#        (however, I would not introduce elaborate language features to control that
#         but a notice for such conflicts might be nice to the developers)
2010-04-22 22:05:56 +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
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
Dmitry Stogov
94dd83722b Changed the structure of op_array.opcodes. The constant values are moved from opcode operands into a separate literal table 2010-04-20 10:57:45 +00:00
Stanislav Malyshev
c93a4f192b restore $this support for closures to its former glory 2010-04-19 19:45:03 +00:00
Sebastian Bergmann
d2281d1dff sed -i "s#1998-2009#1998-2010#g" **/*.c **/*.h **/*.php 2010-01-05 20:46:53 +00:00
Brian Shire
cb7a21a42b MFH: Make pass_two visible to extensions with ZEND_API (required for optimizer). 2009-06-05 23:20:59 +00:00
Christian Seiler
c6d89bd4a8 [DOC] Remove $this support in closures for PHP 5.3 beta 1
- Implementation notes here:
  http://wiki.php.net/rfc/closures/removal-of-this
2009-01-26 22:54:34 +00:00
Dmitry Stogov
666bf10d1a Removed wrong warning message 2009-01-20 13:21:52 +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
Stanislav Malyshev
1b4134c07b Namespace resolution streamlining patch
[DOC] new resolution rules should be documented soon
2008-11-11 19:45:29 +00:00
Marcus Boerger
7126de4912 - Next step in namespaces, using / as namespace separator. 2008-11-04 15:58:55 +00:00
Matt Wilmas
22a5aea161 MFH: - Updated unary_op_type typedef with TSRMLS_DC
- Added binary_op_type typedef
- Added missing ZEND_BOOL_XOR to get_binary_op()
2008-08-29 18:12:47 +00:00
Felipe Pena
cf7384aa40 - MFH: Constness (Added const qualifier to several function parameters) 2008-08-12 17:20:25 +00:00
Moriyoshi Koizumi
a28497d6e5 - Fix __halt_compiler() weirdness with zend-mulibyte enabled 2008-07-28 05:59:17 +00:00
Dmitry Stogov
478acfd8b4 . Added support for using static HEREDOCs to initialize static variables and class members or constants. (Matt)
. Improved syntax highlighting and consistency for variables in double-quoted strings and literal text in HEREDOCs and backticks. (Matt)
. Optimized interpolated strings to use one less opcode. (Matt)
2008-07-26 15:30:28 +00:00
Dmitry Stogov
af05ce0af6 Fixed is_callable/call_user_func mess that had done different things for very similar arguments e.g. array("A","B") and "A::B" 2008-07-26 13:14:04 +00:00
Dmitry Stogov
ed2d3e4c7e Substitute persistent constants by their values at compile time. (Matt) 2008-07-25 04:54:08 +00:00
Dmitry Stogov
44325e6473 Fixed bug #45178 (memory corruption on assignment result of "new" by reference) 2008-07-24 11:47:51 +00:00
Dmitry Stogov
d5ef2f466c Added support for lambda functions and closures 2008-07-14 09:49:03 +00:00
Dmitry Stogov
76a9a42ee2 - Removed direct executor recursion.
- Use fastcall calling convention in executor on x86.
2008-06-11 13:18:41 +00:00
Dmitry Stogov
af1ed80274 Fixed bug #44952 (isset() does not checks correctly variable variable) 2008-05-12 09:09:05 +00:00
Dmitry Stogov
5521912b15 Use IS_CV for dirrent access to $this variable 2008-05-07 12:04:39 +00:00
Dmitry Stogov
1b317f1526 - Use ZEND_FREE() opcode instead of ZEND_SWITCH_FREE(IS_TMP_VAR)
- Fixed bug #44913 (Segfault when using return in combination with nested loops
and continue 2)
2008-05-05 11:03:35 +00:00
Felipe Pena
f8f26de7d5 Fix for segfault on 64bit platform 2008-03-29 11:52:10 +00:00
Felipe Pena
f66f55edc5 MFH: Implemented "jump label" operator (limited "goto")
[DOC]
2008-03-28 14:35:01 +00:00
Felipe Pena
9e2894f5ff MFH:
- Renamed zend_do_fetch_class_name() to zend_do_build_full_name() (It is not used only for classes)
- Moved zend_resolve_class_name prototype to zend_compile.h
2008-03-25 18:08:37 +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
00e236aa80 - Fix build 2008-03-16 21:42:42 +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
Dmitry Stogov
0f2247ae94 Fixed bug #44414 (Incomplete reporting about abstract methods) 2008-03-12 09:46:42 +00:00
Stanislav Malyshev
fd597dce1b [DOC] Add compile-time __DIR__ constant which implements dirname(__FILE__) 2008-02-12 00:21:15 +00:00
Dmitry Stogov
0b6825102d Changed EG(argument_stack) implementation. 2008-01-24 09:41:39 +00:00
Sebastian Bergmann
d1dded8751 MFH: Bump copyright year, 2 of 2. 2007-12-31 07:17:19 +00:00
Dmitry Stogov
64e8f22355 Allowed import of global classes "use ::GlobalClassName;" 2007-12-13 10:02:03 +00:00
Dmitry Stogov
648fbe9d58 Fixed bug #43128 (Very long class name causes segfault) 2007-11-22 13:27:13 +00:00
Johannes Schlüter
45f6b4ce2f - MFH Improved version of ternary shortcut (Marcus) 2007-11-21 09:41:35 +00:00
Dmitry Stogov
9f230a0d79 Added support for "namespace::" prefix that is resolved to current namespace name. 2007-11-20 08:53:02 +00:00
Dmitry Stogov
b7d87bebc9 T_IMPORT -> T_USE 2007-11-07 09:13:50 +00:00
Dmitry Stogov
1530fe99c8 Fixed variations of bug #35163 2007-10-23 12:52:40 +00:00
Dmitry Stogov
eb0c56ada1 Fixed bug #42820 (defined() on constant with namespace prefixes tries to load class). 2007-10-03 10:33:02 +00:00
Dmitry Stogov
b20ed0d2e0 Added support for __callstatic() magic method. (Sara) 2007-09-29 08:52:40 +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
Dmitry Stogov
6c810b0d4c Improved memory usage by movig constants to read only memory. (Dmitry, Pierre) 2007-09-27 18:00:48 +00:00
Dmitry Stogov
80d2409fd8 Improved compilation of heredocs and interpolated strings. (Matt, Dmitry) 2007-05-18 13:12:05 +00:00
Ilia Alshanetsky
17c0c49a54 Addres limitation of __HALT_COMPILER() that allowed only one instance
per request.

# Patch by Greg Beaver
2007-04-04 00:42:42 +00:00
Dmitry Stogov
0291ad5fa6 Fixed bug #40236 (php -a function allocation eats memory) 2007-02-15 10:38:28 +00:00
Dmitry Stogov
e470e22e20 - Fixed bug #35106 (nested foreach fails when array variable has a reference).
- Fixed bug #36214 (__get method works properly only when conditional operator is used).
- Fixed bug #39449 (Overloaded array properties do not work correctly).
- Fixed bug #39990 (Cannot "foreach" over overloaded properties).
2007-01-10 15:58:08 +00:00
Sebastian Bergmann
4223aa4d5e MFH: Bump year. 2007-01-01 09:36:18 +00:00
Dmitry Stogov
c3272ab020 Fixed bug #38808 ("maybe ref" issue for current() and others) 2006-09-26 10:30:51 +00:00
Dmitry Stogov
cd6537ed6d Fixed bugs #34065 and #38623 (throw in foreach/switch causes memory leaks) 2006-09-19 21:36:54 +00:00
Marcus Boerger
519ed8e13b - Better fix for #34505 and related, drop zend_unmangle_property_name_ex() 2006-07-24 17:58:32 +00:00
Stefan Esser
7bbf35320d MFH: Added hook for compile_string() 2006-06-13 12:57:48 +00:00
Marcus Boerger
493f39da2d - MFH: Fix bug #37212 (Access to protected property of common base class)
By adding "zend_class_entry *ce" to struct zend_property_info;
2006-05-27 18:39:53 +00:00
Marcus Boerger
7a5240e846 - MFH missing bits and pieces of the partial sync with head
# This time i added:
# ZEND_FE_RESET_VARIABLE
# ZEND_FE_RESET_REFERENCE
# and dapted parser,compiler,executor,interfaces to handle these flags
# their purpose is to be able to pass whetehr foreach is done by ref to
# the current() handler so that it can error out in case it is not capable
# to comply to the requested return signature/protocol/semantics (weyp).
2006-05-11 21:07:39 +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
Dmitry Stogov
ad10a538ee Optimized cleanup loops on request shutdown 2006-03-13 11:13:42 +00:00
Marcus Boerger
941b0651dc - MFH: Function deprecation flag 2006-02-25 18:25:45 +00:00
Andi Gutmans
61e93ccfe8 - Update copyright notices to 2006 2006-01-04 23:53:05 +00:00
Dmitry Stogov
d32c6512e1 Fixed bug #31177 (menory leaks and corruption because of incorrect refcounting). 2005-10-20 07:30:42 +00:00
Antony Dovgal
f8e8c5534b MFH: fix #33771 (error_reporting falls to 0 when @ was used inside try/catch block) 2005-09-22 19:03:18 +00:00
Antony Dovgal
f43767b249 fix #34505 (possible memory corruption when unmangling properties with empty names)
1st part
2005-09-16 17:05:09 +00:00
Dmitry Stogov
9305339d94 Changed "instanceof" and "catch" operators, is_a() and is_subclass_of() functions to not call __autoload(). 2005-09-09 06:48:49 +00:00
Dmitry Stogov
ebd4ab4d78 Fixed bug #25359 (array_multisort() doesn't work in a function if array is global or reference) 2005-08-10 12:02:52 +00:00
foobar
916815b779 Bump up the year 2005-08-03 13:30:58 +00:00
Dmitry Stogov
345e0255b5 Fixed bug #33512 (Add missing support for isset()/unset() overloading to complement the property get/set methods) 2005-07-07 16:07:09 +00:00
Dmitry Stogov
343af548a6 Fixed SIGSEGV on 'global ${"{$blah}_ID"};' 2005-07-04 13:24:46 +00:00
Dmitry Stogov
12b66c262a Fixed bug #30519 (Interface not existing says Class not found) 2005-06-24 08:45:17 +00:00
Dmitry Stogov
21e071be06 Fixed bug #33257 (array_splice() inconsistent when passed function instead of variable) 2005-06-22 08:33:00 +00:00
Dmitry Stogov
2a314dbc47 Removed EX(fbc_constructor) (it is no longer needed) 2005-06-17 15:06:28 +00:00
Dmitry Stogov
aedbdb087d Allowed return by refrence from internal functions 2005-06-16 14:56:13 +00:00
Dmitry Stogov
c3e6a90808 ZEND_UNSET_DIM_OBJ is splitted to ZEND_UNSET_DIM and ZEND_UNSET_OBJ. 2005-06-16 12:17:39 +00:00
Stanislav Malyshev
2cb52151ac MF50: fix #29689 and more private property problems 2005-06-09 17:20:44 +00:00
Dmitry Stogov
58a0ee09c3 Fixed bug #26456 (Wrong results from Reflection-API getDocComment() when called via STDIN) 2005-06-07 18:11:56 +00:00
Zeev Suraski
d33500ee20 Thought I committed it ages ago... Anyway, without further delays, the final
__halt_compiler() patch
2005-06-04 16:16:19 +00:00
Marcus Boerger
4918b67ac5 - Make zend_do_inheritance ZEND_API 2005-05-28 10:24:56 +00:00
Dmitry Stogov
1a72341328 Added array type hinting. (This patch requires full re-make) 2005-05-26 13:46:17 +00:00
Marcus Boerger
67a226d910 - Add ReflectionProperty::getDocComment() 2005-04-19 22:04:59 +00:00
Marcus Boerger
a29f5391db - Cleanup foreach handling 2005-02-11 22:26:45 +00:00
Dmitry Stogov
fc96c7f7fa foreash($a as $key => $val) optimization
Removed temorary array creation on each iteration.
2005-02-07 16:09:54 +00:00
Marcus Boerger
2d13dd0ef0 - Remove part of the cleanup which causes a problem with unnormal code
like tests/lang/040.phpt
# However there is a memleak introduced somewhen after august 04 for such
# code now, 5.0 and 4.3 are fine though.
2005-02-07 15:22:38 +00:00
Marcus Boerger
662cd8262e - Cleanup foreach statement 2005-02-05 14:01:59 +00:00
Andi Gutmans
8838c0f860 - Two new API calls for Derick (retreive CV name and value) by Dmitry 2005-01-22 02:29:18 +00:00
Andi Gutmans
a904c1dabc - Improve comments, docs, code... 2004-10-27 17:58:46 +00:00
Marcus Boerger
f71644b480 - Revert automatic pass arg_info
# We need to find a better solutions to prevent havy extension writer probs
2004-10-08 22:17:32 +00:00
Marcus Boerger
f916d603ef - Add arginfo ZEND_ARG_SEND_AUTOMATIC which lets the compiler automatically
determine whether pass by ref is possible or pass by value is needed.
# This is usefull when functions take array or string parameters as
# expressions. In such a case force by ref is not applicable and the
# executor would copy the variable unnecessarily as soon as it is at least
# once referenced.
2004-10-05 18:36:46 +00:00
Andi Gutmans
db507dd153 - Commit the variable fetch optimization.
- Extensions which delete global variables need to use new special function
- delete_global_variable() (I'm about to rename it) to remove them.
- Will post to internals@ or via commit messages if there's anything else.
2004-10-04 19:54:35 +00:00
Andi Gutmans
f82ed13625 - Commit new VM architecture. This one allows people (aka Derick) to
- ask the engine to use function handler mode. Will update the README
- about that.
2004-09-23 21:43:32 +00:00
Andi Gutmans
d8efe626b5 - Fix bug #27669 (Dmitry).
Fixes:
<?
        class A
        {
                function hello()
                {
                        echo "Hello World\n";
                }
        }
        $y[0] = 'hello';
        A::$y[0]();
?>
2004-09-16 00:40:38 +00:00
Andi Gutmans
96ab56e146 - Roll back VM commit 2004-09-09 16:47:22 +00:00
Andi Gutmans
8eb8850c90 - Some architectural changes:
a) We specialize opcodes according to op_type fields. Each opcode has to
    be marked with which op_type's it uses.
 b) We support different execution methods. Function handlers, switch()
    and goto dispatching. goto seems to be the fastest but it really
    depends on the compiler and how well it optimizes. I suggest playing
    around with optimization flags.

- Warning: Things might break so keep us posted on how things are going.
  (Dmitry, Andi)
2004-09-08 22:14:12 +00:00
Andi Gutmans
edb7c7d4f5 - Stop using garbage. Please let me know if you find any bugs resulting
- of this patch (very likely). (Dmitry, Andi)
2004-08-19 20:03:06 +00:00
Andi Gutmans
993f70c1d2 - Don't use magic numbers 2004-08-12 05:54:11 +00:00
Marcus Boerger
5f0433db83 MFB: Enforce protocol on magic methods/functions 2004-08-02 08:27:57 +00:00
Sara Golemon
d96e7a170c Revert goto opcode 2004-07-29 17:45:31 +00:00
Sara Golemon
5865b3680a Add goto operator by popular request. 2004-07-29 15:23:47 +00:00
Stefan Esser
fb5cb59035 Fixed Zend Function Destructor to use correct TSRM handle. 2004-06-06 08:37:12 +00:00
Zeev Suraski
e2a5ebf597 Add ability to disable JIT for a particular auto global 2004-03-16 19:46:04 +00:00
Marcus Boerger
50ee116f08 Clearify the different method/class flags (as discussed with Andi). 2004-03-09 16:38:37 +00:00
Andi Gutmans
0fc9d5861d - Nuke unused code. 2004-03-09 15:27:39 +00:00
Derick Rethans
afc35efcf6 - Typo fix (by Jan) 2004-03-01 12:25:03 +00:00
Stanislav Malyshev
edb21137de add ZEND_API there too for opcode handlers 2004-02-29 16:01:21 +00:00
Marcus Boerger
7fdd68af8b Add some comments 2004-02-27 18:20:53 +00:00
Zeev Suraski
7086634a0b - Improve ARG_INFO() macros to support supplying required_num_args
- Initial fix for foreach($o->mthd()->arr) crash (now leaks)
2004-02-25 14:56:45 +00:00
Zeev Suraski
36a751840d - Abstract methods cannot have defaults for arguments
- Make function foo($a, $b=null) satisfy both foo($a) and foo($a, $b)
  prototypes
2004-02-25 09:25:37 +00:00
Zeev Suraski
e7e0f7d4b4 - Check return-by-reference bit when implementing interface prototypes
- Add infrastructure for built-in functions to hint whether they
  return by reference or not.  It is NOT currently used for anything,
  except for interface prototypes (you can use it to request that the
  function that implements your prototype returns by reference or
  doesn't return by reference).
  For downwards compatibility - by default, interface prototypes are
  agnostic as to whether the function that implements them returns
  by reference or not.  Use ZEND_BEGIN_ARG_INFO_EX() with
  ZEND_RETURN_VALUE/ZEND_RETURN_REFERENCE to change that.
- Fix ArrayAccess::getOffset() to conduct additional checks.
  If your getOffset() should work with multidimensional arrays - it
  must return by reference.
2004-02-12 13:49:55 +00:00
Zeev Suraski
c5d842279c Reinstate early-binding for classes.
Note that this is available for downwards compatibility only - and it doesn't
work if you use new features (namely, interfaces).  Generally, people should
declare their classes before using them, but we just didn't want hell to break
loose (c)
2004-02-04 16:30:15 +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
8e30d96ad8 Redesign the clone() feature to fix some fundamental flaws in the previous
implementation.

Using clone directly is now done using
$replica = clone $src;

Clone methods must now be declared as follows:
function __clone($that)
{
}

Clone methods in derived classes can call the __clone method of their parent
classes using parent::__clone($that)
2004-02-02 12:28:19 +00:00
Zeev Suraski
2adaa11f2f Prevent classes from implementing interfaces that have the same function 2004-01-28 10:25:45 +00:00
Marcus Boerger
3ca44539a1 Switch from ZEND_ACC_DYNAMIC to ZEND_ACC_ALLOW_STATIC and disallow calling
internal non-static methods statically.
# As discussed with Zeev:
# - For BC standard userspace methods allow this with an E_STRICT message.
# - If you want to implement an internal method taht can be called both
#   statically and non-statically then use flag ZEND_ACC_ALLOW_STATIC.
# - Magic user space methods __*() cannot and __construct, __destruct,
# __clone can never be called statically.
2004-01-24 16:59:24 +00:00
Marcus Boerger
6020ffd007 Simplify detection of methods that must be called dynamic (with object) 2004-01-23 22:04:42 +00:00
Marcus Boerger
7c2e02d380 Disallow static declaration of clone 2004-01-23 20:52:39 +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
Derick Rethans
6923a16c26 - Fixed var_export() to show public, protected and private modifiers properly.
- Exported (un)mangle_property_name.
2004-01-03 13:51:02 +00:00
Sebastian Bergmann
9c909f41fd Sync: Export externally used functions. 2003-12-16 11:44:19 +00:00
Zeev Suraski
3a42babad6 Fix behavior of return-by-reference functions. Remove erroneous warnings,
add E_STRICT warnings in case you return something by reference that you're
not supposed to (anything that's not a variable, or a return-value of a
function that returned by reference).
2003-12-14 16:09:07 +00:00
Andi Gutmans
d344648b07 - Fix __autoload() to preserve class case.
- Heads up, this patch might break stuff so please let me know if you
- bump into any problems.
2003-11-24 18:13:29 +00:00
Marcus Boerger
296529b886 Split isset/isempty for object property and object dimension hooking. 2003-11-10 16:14:44 +00:00
Marcus Boerger
3c62b3b5ac Expand Interface C API.
In short: zend_class_entry->interface_gets_implemented()  allows to modify
the class entry of a class when an interface gets implemented.
2003-10-22 19:59:58 +00:00
Marcus Boerger
cec053f707 Don't identify alias'ed functions 2003-08-24 16:35:58 +00:00
Marcus Boerger
1c2512ddea - Add fn_flag ZEND_ACC_ALIAS
- Unify way of function_entry generation by new macro ZEND_FENTRY
2003-08-24 11:09:45 +00:00
Marcus Boerger
baaa4c903d Internal classes can now have default properties. 2003-08-23 19:37:39 +00:00
Marcus Boerger
fbda310a41 - Flag ctor/dtor methods
- Use this to prevent memleaks when an exception gets thrown in ctors.
# I added the dtor flags for consistency, atm a compareable check in
# isn't necessary for destruction. But anyway i'll use this for the
# Relection API too.
2003-08-23 15:38:58 +00:00
Zeev Suraski
49c4866a47 - Improve tracking
- Fix several overloading issues
2003-08-18 22:31:11 +00:00
Zeev Suraski
f8bbafd604 ntroduce infrastructure for supplying information about arguments,
including:

- Whether or not to pass by ref (replaces the old arg_types, with arg_info)
- Argument name (for future use, maybe introspection)
- Class/Interface name (for type hints)
- If a class/interface name is available, whether to allow a null instance

Both user and builtin functions share the same data structures.

To declare a builtin function that expects its first arg to be an instance
of class 'Person', its second argument as a regular arg, and its third by
reference, use:

ZEND_BEGIN_ARG_INFO(my_func_arg_info, 0)
    ZEND_ARG_OBJ_INFO(0, someone, Person, 1)
    ZEND_ARG_PASS_INFO(0)
    ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();

and use my_func_arg_info as the arg_info parameter to the ZEND_FE() family
of macros.

The first arg to each ZEND_ARG_*() macro is whether or not to pass by ref.

The boolean arg to ZEND_BEGIN_ARG_INFO() tells the engine whether to treat
the arguments for which there's no explicit information as pass by reference
or not.
The boolean argument to ZEND_ARG_OBJ_INFO() (4th arg) is whether or not to allownull values.
2003-08-03 17:40:44 +00:00
Zeev Suraski
9d7122fb53 Generalize fetch_class 2003-08-03 08:21:08 +00:00
Zeev Suraski
68fa4e50f8 Get rid of an opcode 2003-07-30 17:49:27 +00:00