Commit Graph

276 Commits

Author SHA1 Message Date
Dmitry Stogov
fa3f0bb63f Fixed bug #51008 (Zend/tests/bug45877.phpt fails) 2010-10-05 11:28:56 +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
2188f26c45 Fixed bug #52614 (Memory leak when writing on uninitialized variable returned from method call) 2010-08-25 09:14:36 +00:00
Dmitry Stogov
8a6d73b084 improved performance of @ (silence) operator 2010-08-18 13:58:13 +00:00
Dmitry Stogov
f48999ca3b Optimization of ASSIGN instruction 2010-08-11 15:34:06 +00:00
Dmitry Stogov
e0b728597b Optimization (IS_TMP_VARs don't need reference counting) 2010-08-10 15:24:19 +00:00
Dmitry Stogov
39b4a5eea7 Additional specialization 2010-07-27 09:50:35 +00:00
Dmitry Stogov
d30073a2dc Removed deprecated check 2010-07-26 12:40:32 +00:00
Dmitry Stogov
5a2ee8ecea Use proper fetch types 2010-07-19 15:04:51 +00:00
Dmitry Stogov
c1336009c2 Removed invalid checks 2010-07-19 14:34:34 +00:00
Dmitry Stogov
ca4de03eed ZEND_FETCH_*_R operations simplified and can't be used with EXT_TYPE_UNUSED flag any more. Thit is very rare and useless case. ZEND_FREE might be required after them instead. 2010-07-16 13:38:09 +00:00
Dmitry Stogov
8aad91d14a Simplified string offset reading 2010-07-16 11:44:30 +00:00
Dmitry Stogov
ab67865d21 Fixed bug #52237 (Crash when passing the reference of the property of a non-object) 2010-07-05 09:08:35 +00:00
Dmitry Stogov
09943e56cd Removed redundant code 2010-06-22 14:15:08 +00:00
Dmitry Stogov
d868733cc3 Fixed bug #52041 (Memory leak when writing on uninitialized variable returned from function) 2010-06-15 08:22:51 +00:00
Dmitry Stogov
04dd48ceca Fixed exception handling in GOTO VM 2010-05-24 14:46:31 +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
Felipe Pena
5d701938a3 - Added check for constant creation on Traits
- Simplified trait flag check
- Test++ :)
2010-05-07 11:09:35 +00:00
Dmitry Stogov
277f271a83 Added compiler hints 2010-05-06 12:52:27 +00:00
Dmitry Stogov
d5800f881c Optimized access to static properties using executor specialization. A constant class name may be used as a direct operand of ZEND_FETCH_* instruction without previous ZEND_FETCH_CLASS. 2010-05-06 10:27:35 +00:00
Felipe Pena
e431cec023 - Fix trait flag identification 2010-05-04 18:31:40 +00:00
Felipe Pena
45a536fc7c - Added check for abstract class
abstract class foo { }
  class T { use foo; } // T cannot use foo - it is not a trait

- Added check for trait on NEW 

  trait a { }
  new a; // Cannot instantiate trait a

# Tests for errors comming soon :)
2010-05-04 18:21:00 +00:00
Dmitry Stogov
4ff3000850 ws 2010-04-27 12:23:29 +00:00
Dmitry Stogov
c58b131e29 - Reimplemented ZEND_INIT_FCALL_BY_NAME and ZEND_INIT_NS_FCALL_BY_NAME to use literals instead of additional operands
- Optimized access to global constants
2010-04-27 12:09:13 +00:00
David Soria Parra
08b9fdc8a3 Add DTrace probes 2010-04-24 13:32:30 +00:00
Dmitry Stogov
f06d839e59 Use fast class fetch function 2010-04-23 08:56:03 +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
e87d72002b Optimized access to global constants using values with pre-calculated hash_values from litersls table 2010-04-22 15:03:17 +00:00
Felipe Pena
ac181e07ef - Removed unused variables 2010-04-22 13:28:53 +00:00
Dmitry Stogov
fb9d95e5a4 ZEND_RETURN is splitted into two new instructions ZEND_RETURN and ZEND_RETURN_BY_REF 2010-04-22 11:56:45 +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
Dmitry Stogov
6ab5f53d52 Fixed bug #49866 (Making reference on string offsets crashes PHP) 2009-12-07 08:47:18 +00:00
Dmitry Stogov
7a96fdff4c Fixed bug #50351 (performance regression handling objects, ten times slower in 5.3 than in 5.2. foreach statement should not initiate GC) 2009-12-07 08:14:48 +00:00
Felipe Pena
bb179ad150 - Fixed bug #50255 (isset() and empty() silently casts array to object) 2009-11-24 21:54:12 +00:00
Felipe Pena
779ce8fd00 - Fixed bug #49908 (throwing exception in __autoload crashes when interface is not defined) 2009-11-01 21:26:03 +00:00
Dmitry Stogov
c36b27db63 Fixed memleak in tests/lang/engine_assignExecutionOrder_001.phpt 2009-09-21 13:01:17 +00:00
Dmitry Stogov
4016bfcd71 Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30) 2009-09-03 14:33:11 +00:00
Stanislav Malyshev
d6ba6c69fb fix crash when unexpectedly passed by-ref parameter is modified 2009-08-18 20:51:49 +00:00
Dmitry Stogov
f1ab855cfe Fixed ability to call user functions from user opcodes without recursion 2009-08-18 10:12:32 +00:00
Dmitry Stogov
f694c09a35 Fixed bug #49269 (Ternary operator fails on Iterator object when used inside foreach declaration). (Etienne, Dmitry) 2009-08-17 07:40:43 +00:00
Dmitry Stogov
ff766c1de2 Fixed bug #48912 (Namespace causes unexpected strict behaviour with extract()) 2009-07-28 12:35:27 +00:00
Matt Wilmas
2462fce244 MFH: Changed error messages to use "cannot" instead of "can not" (meaning "also can") 2009-06-07 15:46:54 +00:00
Arnaud Le Blanc
85b9327836 MFH: better fix for #48409 , #48428 , #48228 2009-06-05 11:21:31 +00:00
Matt Wilmas
b907aa4331 MFH:
Restored double->long conversion behavior to that of PHP 5.2 (on most platforms) and prior:
 * Out-of-range numbers overflow/preserve least significant bits (no LONG_MAX/MIN limit)
 * See bug #42868 (presumably-rare platform with different results in 5.2)
 * On 32-bit platforms with 64-bit long type, a zend_long64 cast has been added,
    otherwise it's the same as 5.2
 * Use this conversion method everywhere instead of some plain (long) casts

Added 'L' parameter parsing specifier to ensure a LONG_MAX/MIN limit:
 * Essentially what 5.3's new conversion was doing in most cases
 * Functions with "limit" or "length" type params could be updated to use this,
    and prevent confusing overflow behavior with huge numbers (*also* in 5.2)
  - See bug #47854, for example; or even #42868 again

# Test updates coming
2009-06-04 18:20:45 +00:00
Arnaud Le Blanc
2403a58011 MFH: better fix for #48409 , #48428 , #48228 2009-06-01 15:07:42 +00:00
Arnaud Le Blanc
bed00e15d1 MFH: Fix aliasing issue (fixes #48409 , #48428 , #48228) 2009-05-30 16:31:12 +00:00