svn: /php/php-src/trunk/ NEWS Zend/zend_ptr_stack.c Zend/zend_ptr_stack.h

From: Date: Fri, 09 Jul 2010 07:31:18 +0000
Subject: svn: /php/php-src/trunk/ NEWS Zend/zend_ptr_stack.c Zend/zend_ptr_stack.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-63066@lists.php.net to get a copy of this message
dmitry Fri, 09 Jul 2010 07:31:18 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=301106 Log: zend_ptr_stack allocation is delayed before the actual usage Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/Zend/zend_ptr_stack.c U php/php-src/trunk/Zend/zend_ptr_stack.h Modified: php/php-src/trunk/NEWS =================================================================== --- php/php-src/trunk/NEWS 2010-07-09 05:33:03 UTC (rev 301105) +++ php/php-src/trunk/NEWS 2010-07-09 07:31:18 UTC (rev 301106) @@ -18,7 +18,7 @@ A constant class name may be used as a direct operand of ZEND_FETCH_* instruction without previous ZEND_FETCH_CLASS. . eliminated unnecessary iterations during request startup/shutdown - . zend_stack initialization is delayed before the actual usage + . zend_stack and zend_ptr_stack allocation is delayed before the actual usage . $GLOBALS became a JIT autoglobal, so it's initialized only if used (this may affect opcode caches) - Added concept of interned strings. All strings constants known at compile Modified: php/php-src/trunk/Zend/zend_ptr_stack.c =================================================================== --- php/php-src/trunk/Zend/zend_ptr_stack.c 2010-07-09 05:33:03 UTC (rev 301105) +++ php/php-src/trunk/Zend/zend_ptr_stack.c 2010-07-09 07:31:18 UTC (rev 301106) @@ -27,9 +27,8 @@ ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, zend_bool persistent) { - stack->top_element = stack->elements = (void **) pemalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE, persistent); - stack->max = PTR_STACK_BLOCK_SIZE; - stack->top = 0; + stack->top_element = stack->elements = NULL; + stack->top = stack->max = 0; stack->persistent = persistent; } Modified: php/php-src/trunk/Zend/zend_ptr_stack.h =================================================================== --- php/php-src/trunk/Zend/zend_ptr_stack.h 2010-07-09 05:33:03 UTC (rev 301105) +++ php/php-src/trunk/Zend/zend_ptr_stack.h 2010-07-09 07:31:18 UTC (rev 301106) @@ -46,8 +46,9 @@ #define ZEND_PTR_STACK_RESIZE_IF_NEEDED(stack, count) \ if (stack->top+count > stack->max) { \ /* we need to allocate more memory */ \ - stack->max *= 2; \ - stack->max += count; \ + do { \ + stack->max += PTR_STACK_BLOCK_SIZE; \ + } while (stack->top+count > stack->max); \ stack->elements = (void **) perealloc(stack->elements, (sizeof(void *) * (stack->max)), stack->persistent); \ stack->top_element = stack->elements+stack->top; \ }

« previous php.cvs (#63066) next »