com php-src: Help C compilet to do the better job optimizing target code: Zend/zend_execute.h
| From: | Dmitry Stogov | Date: | Fri, 27 Jun 2014 11:48:25 +0000 |
| Subject: | com php-src: Help C compilet to do the better job optimizing target code: Zend/zend_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79284@lists.php.net to get a copy of this message | ||
Commit: 6b0c5ddcbc7a7347bf1f5a4b1f2b68205477eef4
Author: Dmitry Stogov <dmitry@zend.com> Fri, 27 Jun 2014 15:48:25 +0400
Parents: d6bd21eab2ad5beaab248851e3a5cef9cdb24b5c
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6b0c5ddcbc7a7347bf1f5a4b1f2b68205477eef4
Log:
Help C compilet to do the better job optimizing target code
Changed paths:
M Zend/zend_execute.h
Diff:
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index b1e2166..9202262 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -164,12 +164,13 @@ struct _zend_vm_stack {
#define ZEND_VM_STACK_ELEMETS(stack) \
(((zval*)(stack)) + ZEND_VM_STACK_HEADER_SLOT)
-#define ZEND_VM_STACK_GROW_IF_NEEDED(count) \
- do { \
- if (UNEXPECTED((count) > \
- EG(argument_stack)->end - EG(argument_stack)->top)) { \
- zend_vm_stack_extend((count) TSRMLS_CC); \
- } \
+#define ZEND_VM_STACK_GROW_IF_NEEDED(count) \
+ do { \
+ if (UNEXPECTED(((count) * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) > \
+ ((char*)EG(argument_stack)->end) - \
+ ((char*)EG(argument_stack)->top))) { \
+ zend_vm_stack_extend((count) TSRMLS_CC); \
+ } \
} while (0)
static zend_always_inline zend_vm_stack zend_vm_stack_new_page(int count) {
@@ -200,10 +201,12 @@ static zend_always_inline void zend_vm_stack_destroy(TSRMLS_D)
static zend_always_inline void zend_vm_stack_extend(int count TSRMLS_DC)
{
+ int size = count * ZEND_MM_ALIGNED_SIZE(sizeof(zval));
zend_vm_stack p = zend_vm_stack_new_page(
- (count >= ZEND_VM_STACK_PAGE_SIZE - ZEND_VM_STACK_HEADER_SLOT) ?
- ((count + ZEND_VM_STACK_HEADER_SLOT + ZEND_VM_STACK_PAGE_SIZE - 1) &
~(ZEND_VM_STACK_PAGE_SIZE-1)) :
- ZEND_VM_STACK_PAGE_SIZE);
+ (size >= (ZEND_VM_STACK_PAGE_SIZE - ZEND_VM_STACK_HEADER_SLOT) *
ZEND_MM_ALIGNED_SIZE(sizeof(zval))) ?
+ (size + ((ZEND_VM_STACK_HEADER_SLOT + ZEND_VM_STACK_PAGE_SIZE) *
ZEND_MM_ALIGNED_SIZE(sizeof(zval))) - 1) &
+ ~((ZEND_VM_STACK_PAGE_SIZE * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) - 1) :
+ ZEND_VM_STACK_PAGE_SIZE);
p->prev = EG(argument_stack);
EG(argument_stack) = p;
}
@@ -218,13 +221,13 @@ static zend_always_inline zend_execute_data
*zend_vm_stack_push_call_frame(zend_
}
ZEND_VM_STACK_GROW_IF_NEEDED(used_stack);
call = (zend_execute_data*)EG(argument_stack)->top;
+ EG(argument_stack)->top += used_stack;
call->func = func;
call->num_args = 0; //??? num_args;
call->flags = flags;
call->called_scope = called_scope;
call->object = object;
call->prev_nested_call = prev;
- EG(argument_stack)->top += used_stack;
return call;
}