Commit Graph

117 Commits

Author SHA1 Message Date
Christoph M. Becker
79f64e5e67 Fix #70173: ZVAL_COPY_VALUE_EX broken for 32bit Solaris Sparc
On 32bit big endian architectures the high word of a zend_value is copied
twice, instead of copying both words. Let's fix it.
2015-08-09 15:01:37 +02:00
Anatol Belski
859507c9af add one more thread storage specifier to allow external link 2015-07-29 17:26:52 +02:00
Anatol Belski
5c98b9972f improve ZEND_TLS declaration even more and move it to the better place 2015-07-28 16:59:53 +02:00
Xinchen Hui
95ff2852ee Micro optimization 2015-07-10 16:39:21 +08:00
Dmitry Stogov
4bd22cf1c1 Improved zend_string API (Francois Laupretre)
Squashed commit of the following:

commit d96eab8d79
Author: Francois Laupretre <francois@tekwire.net>
Date:   Fri Jun 26 01:23:31 2015 +0200

    Use the new 'ZSTR' macros in the rest of the code.

    Does not change anything to the generated code (thanks to compat macros) but cleaner.

commit b352643910
Author: Francois Laupretre <francois@tekwire.net>
Date:   Thu Jun 25 13:45:06 2015 +0200

    Improve zend_string API

    Add missing methods
2015-06-29 16:44:54 +03:00
Xinchen Hui
dc329cd5dc Make the tail slash algined 2015-06-16 11:33:44 +08:00
Dreamsxin
73031d92ce Fix invalid conversion about emalloc 2015-06-16 11:12:37 +08:00
Dmitry Stogov
8a089e7e71 Call zend_array_dup() instead of zval_copy_ctor(). 2015-06-02 12:03:34 +03:00
Dmitry Stogov
1654442ac3 Fixed integer overflow during HashTable size calculation 2015-06-01 10:51:06 +03:00
Nikita Popov
f3dde29394 Fixes for x32 ABI
I'm assuming that we want to have 64bit zend_longs on x32 here.

This fixes two typos in __x86_64__ macros and adds sign-extension
when assigning STREAM_COPY_ALL to zend_long.
2015-05-23 21:18:33 +02:00
Dmitry Stogov
d72a94468e Merged FE_FETCH_R[W] with the following ASSIGN[_REF] when assigne to CV. 2015-05-13 12:55:42 +03:00
Dmitry Stogov
6718b56e45 Change the GC approach to inner-loops handling. Switch to less efficient but more robust algorithm. Destructors handling is still not completely accurate. 2015-04-17 18:35:57 +03:00
Dmitry Stogov
276080ec3a Added GC checks and improvements 2015-04-17 03:55:37 +03:00
Dmitry Stogov
9806a62545 GC improved to support inner-cycles. 2015-04-14 00:16:27 +03:00
Dmitry Stogov
dcaa79546b Don't relay on reference-counter when parameter expected to be a reference, but value given. 2015-04-03 16:35:06 +03:00
Xinchen Hui
d7835ee224 Using int32_t opposite of uint32_t 2015-03-31 12:40:29 +08:00
Anthony Ferrara
d22bfb8aa6 Merge in master, fix merge conflicts and update patch to support exceptions everywhere 2015-03-18 10:50:11 -04:00
Dmitry Stogov
4e11095438 Reimplemented special constant handling. Now __HALT_COMPILER_OFFSET__ is resolved at compile-time. __CLASS__ retrived using separate ZEND_FETCH_CLASS_NAME opcode. 2015-03-18 15:33:56 +03:00
Dmitry Stogov
55da1fb008 Fixed zend_hash_del() 2015-03-17 23:13:39 +03:00
Dmitry Stogov
2b42d71908 Changed HashTable layout:
Removed HashTable->arHash (reduced memory consumption). Now hash slots may be accessed using HT_HASH() macro.
Hash slotas are allocated together with Buckets (before them) and lay in reverse order from HashTable->arData base address (see comments in Zend/zend_types.h)
Indexes in hash table and conflict resolution chains (Z_NEXT) may be stored as indeces or offsets in bytes, depending on system (32 or 64-bit).
HashTable data filelds are reordered to keep the most useful for zend_hash_find() data in the same CPU cache line.
2015-03-13 17:13:19 +03:00
Anthony Ferrara
dc35868a77 Merge branch 'master' into scalar_type_hints_v5 2015-02-20 13:33:35 -05:00
Dmitry Stogov
d85113702c Lazy duplication of op_array->static_variables 2015-02-20 13:28:26 +03:00
Anthony Ferrara
9109e48749 Merge in master 2015-02-18 10:35:39 -05:00
Dmitry Stogov
e10e151e9b Merged zend_array and HashTable into the single data structure.
Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write
zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
2015-02-13 22:20:39 +03:00
Dmitry Stogov
12abac8bb7 Limit HashTable size to avoid integer overflow checks 2015-02-13 02:12:42 +03:00
Dmitry Stogov
97fe15db43 Fix "forech" statemt behaviour according to https://wiki.php.net/rfc/php7_foreach
Squashed commit of the following:

commit 1e41295097
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Sat Jan 31 07:28:58 2015 +0300

    Generalize HashTableIterator API to allows its usage without involvement of HashTable.nInternalPonter

commit 5406f21b11
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:43 2015 +0300

    Reduced alghorithms complexity

commit b37f1d58d2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:30 2015 +0300

    Fixed test name

commit fb2d079645
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:05 2015 +0300

    API cleanup

commit 08302c0d6d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 14:20:46 2015 +0300

    Make array_splice() to preserve foreach hash position

commit cc4b7be41e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 12:24:31 2015 +0300

    Make internal function, operation on array passed by reference, to preserve foreach hash position

commit 5aa9712b0a
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 09:49:35 2015 +0300

    Implement consistent behavior for foreach by value over plain object

commit 4c5b385ff5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 07:56:37 2015 +0300

    More careful iterators update.

commit 721fc9e80d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:43:28 2015 +0300

    Added new test

commit 15a23b1218
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:05:02 2015 +0300

    Reimplement iteration magic with HashTableIterators (see https://wiki.php.net/rfc/php7_foreach#implementation_details)

commit 10a3260b1f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:04:44 2015 +0300

    New test

commit eef80c5837
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 16:52:21 2015 +0300

    Fixed foreach by reference iteration over constant array

commit 61e7391873
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 14:59:54 2015 +0300

    Fixed temporary variable re-allocation pass

commit 92e90c09f0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 12:44:57 2015 +0300

    Fixed operand destruction in case of exceptions in iterator

commit dd2a36a207
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 10:02:34 2015 +0300

    Use GET_OP1_ZVAL_PTR_DEREF() (IS_TMP_VAR and IS_CONST can't be IS_REFERENCE)

commit 4638f7b914
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 07:43:28 2015 +0300

    Change "foreach" statement behavior (this is just a PoC yet)

    - "foreach by value" don't relay on internal array/object pointer and doesnt perform array duplication. It just locks it incrementing reference counter. If the original array is modified by some code, the copy on write is performed and "foreach" still work with the old copy.

    - it makes no difference if array given to "foreach by value" is reference itself

    - "foreach by reference" still use internal array/object pointer and should work similar to PHP-5. (This id not completely implemented)
2015-02-12 13:57:12 +03:00
Andrea Faulds
cc01e37e54 It Begins 2015-02-10 15:48:06 +00:00
Dmitry Stogov
9e70d7672d Move zend_object->guards into additional slot of zend_object->properties_table[]. As result size of objects without __get/__set/__unset/__isset magic methods is reduced. 2015-02-04 15:24:13 +03:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
2193de0d18 Faster sorting algo 2015-01-14 18:02:41 +08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Dmitry Stogov
37466b0368 Use special flag (HASH_FLAG_INITIALIZED) instead of (nTableMask == 0) to indicate that HashTable is allocated.
Make nTableMask to be 0 for packed arrays.
Remove checks fo HASH_FLAG_PACKED in zend_hash_find/zend_hash_del and family (string keys are resolved through uninitialized_bucket).
Change HashTable layout for better locality.
2014-12-27 11:07:12 +03:00
Dmitry Stogov
ab0b15b8ff Optimized destruction of extra arguments passed to user functions.
If no refcounted arguments are passed, then destruction code is not triggered at all.
(Full rebuild required)
2014-12-26 22:34:44 +03:00
Anatol Belski
61f90fbe0b Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  Save 8 bytes on 64 bits

Conflicts:
	Zend/zend_API.c
2014-12-15 07:13:09 +01:00
Xinchen Hui
8f177fde90 Save 8 bytes on 64 bits 2014-12-15 00:43:28 -05:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Dmitry Stogov
2f3c79b4bf Improved basic zval copying primitives: ZVAL_COPY_VALUE(), ZVAL_COPY(), ZVAL_DUP() 2014-12-09 18:07:39 +03:00
Xinchen Hui
2d89574b58 Make it const as Levi asked for 2014-12-05 12:11:13 +08:00
Dmitry Stogov
1da14c9f81 Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" into "call_kind" and VM_FRAME_... into ZEND_CALL_... 2014-11-28 10:33:03 +03:00
Dmitry Stogov
11384ba77b Pack EX(num_args) into EX(This).u2.num_args 2014-11-28 10:28:49 +03:00
Dmitry Stogov
76019b86c0 Reorder fields for most often access pattern 2014-11-17 14:06:50 +03:00
Nikita Popov
876965d20a Use intptr_t for zend_intptr_t typedef
Current code doesn't work for 64bit zend_long with 32bit pointers.

If intptr_t isn't defined on some platform, we should add it to
our php_stdint.h header.
2014-10-16 12:42:23 +02:00
Nikita Popov
2a9daf2e15 Drop zend_long64 in favor of int64_t
Also drop ZEND_HAVE_LONG64, because we already require the
presence of a int64_t type.
2014-10-16 12:42:22 +02:00
Nikita Popov
e5e9d8346f Remove zend_get_class_entry function 2014-10-09 14:17:30 +02:00
Nikita Popov
43f1c94dda Review a few more SEPARATE_ZVAL_IF_NOT_REF usages 2014-10-09 12:51:05 +02:00
Dmitry Stogov
67be34ec95 Remove useless parts of EX(old_error_reporting) 2014-10-07 17:54:24 +04:00
Dmitry Stogov
bd9a234645 Replaced EG(This) and EX(object) with EX(This).
Internal functions now recieves zend_execute_data as the first argument.
2014-10-03 19:32:46 +04:00
Dmitry Stogov
bccc653185 Avoid double IS_INTERNED() check 2014-09-19 17:32:50 +04:00
Dmitry Stogov
5185baab3e Changed "inline" into "zend_always_inline" 2014-09-18 04:59:01 +04:00
Dmitry Stogov
61d37e059f Moved some definitions from zend.h into more suitable header files 2014-09-18 04:58:04 +04:00