Commit:    5ced3db9714c02d2fd40370f632f23d047f51987
Author:    Anatol Belski <a...@php.net>         Thu, 28 Nov 2013 17:27:59 +0100
Parents:   a7862de2db615f351fd746bd2fb87564b9631e73 
0d65cd50ddd409d37b208ae3fc5adbb7b22d1379
Branches:  str_size_and_int64

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=5ced3db9714c02d2fd40370f632f23d047f51987

Log:
Merge branch 'master' into str_size_and_int64

Conflicts:
        Zend/zend.h
        Zend/zend_hash.c
        Zend/zend_hash.h
        Zend/zend_language_parser.y
        Zend/zend_vm_def.h
        Zend/zend_vm_execute.h

Changed paths:
  MM  Zend/Zend.dsp
  MM  Zend/ZendTS.dsp
  MM  Zend/zend.h
  MM  Zend/zend_API.c
  MM  Zend/zend_builtin_functions.c
  MM  Zend/zend_compile.c
  MM  Zend/zend_compile.h
  MM  Zend/zend_execute_API.c
  MM  Zend/zend_hash.c
  MM  Zend/zend_hash.h
  MM  Zend/zend_language_parser.y
  MM  Zend/zend_operators.h
  MM  Zend/zend_ts_hash.c
  MM  Zend/zend_ts_hash.h
  MM  Zend/zend_vm_def.h
  MM  Zend/zend_vm_execute.h
  MM  configure.in
  MM  ext/date/lib/timelib.h
  MM  ext/date/php_date.c
  MM  ext/reflection/php_reflection.c
  MM  win32/build/config.w32

diff --cc Zend/zend.h
index 01db626,1c86d57..9e3fc06
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@@ -317,9 -317,10 +317,10 @@@ typedef struct _zend_object 
  } zend_object;
  
  #include "zend_object_handlers.h"
+ #include "zend_ast.h"
  
  typedef union _zvalue_value {
 -      long lval;                                      /* long value */
 +      zend_int_t lval;                                        /* long value */
        double dval;                            /* double value */
        struct {
                char *val;
@@@ -587,8 -589,8 +589,9 @@@ typedef int (*zend_write_func_t)(const 
  #define IS_RESOURCE   7
  #define IS_CONSTANT   8
  #define IS_CONSTANT_ARRAY     9
- #define IS_CALLABLE   10
+ #define IS_CONSTANT_AST               10
+ #define IS_CALLABLE   11
 +#define IS_LONG IS_INT
  
  /* Ugly hack to support constants as static array indices */
  #define IS_CONSTANT_TYPE_MASK         0x00f
diff --cc Zend/zend_compile.c
index 3cc95b5,8f870c6..8f964fb
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@@ -1908,14 -1908,14 +1908,14 @@@ void zend_do_receive_param(zend_uchar o
                                }
                        } else {
                                cur_arg_info->type_hint = IS_OBJECT;
 -                              if (ZEND_FETCH_CLASS_DEFAULT == 
zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), 
Z_STRLEN(class_type->u.constant))) {
 +                              if (ZEND_FETCH_CLASS_DEFAULT == 
zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), 
Z_STRSIZE(class_type->u.constant))) {
                                        zend_resolve_class_name(class_type 
TSRMLS_CC);
                                }
 -                              Z_STRVAL(class_type->u.constant) = 
(char*)zend_new_interned_string(Z_STRVAL(class_type->u.constant), 
Z_STRLEN(class_type->u.constant) + 1, 1 TSRMLS_CC);
 +                              Z_STRVAL(class_type->u.constant) = 
(char*)zend_new_interned_string(Z_STRVAL(class_type->u.constant), 
Z_STRSIZE(class_type->u.constant) + 1, 1 TSRMLS_CC);
                                cur_arg_info->class_name = 
Z_STRVAL(class_type->u.constant);
 -                              cur_arg_info->class_name_len = 
Z_STRLEN(class_type->u.constant);
 +                              cur_arg_info->class_name_len = 
Z_STRSIZE(class_type->u.constant);
                                if (op == ZEND_RECV_INIT) {
-                                       if (Z_TYPE(initialization->u.constant) 
== IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && 
!strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
+                                       if (Z_TYPE(initialization->u.constant) 
== IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && 
!strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || 
Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
                                                cur_arg_info->allow_null = 1;
                                        } else {
                                                
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with a class 
type hint can only be NULL");
@@@ -5778,14 -5777,28 +5777,28 @@@ void zend_do_add_static_array_element(z
                        case IS_CONSTANT:
                                /* Ugly hack to denote that this value has a 
constant index */
                                Z_TYPE_P(element) |= IS_CONSTANT_INDEX;
 -                              Z_STRVAL(offset->u.constant) = 
erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3);
 -                              
Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = 
Z_TYPE(offset->u.constant);
 -                              
Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0;
 -                              
zend_symtable_update(Z_ARRVAL(result->u.constant), 
Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, 
sizeof(zval *), NULL);
 +                              Z_STRVAL(offset->u.constant) = 
erealloc(Z_STRVAL(offset->u.constant), Z_STRSIZE(offset->u.constant)+3);
 +                              
Z_STRVAL(offset->u.constant)[Z_STRSIZE(offset->u.constant)+1] = 
Z_TYPE(offset->u.constant);
 +                              
Z_STRVAL(offset->u.constant)[Z_STRSIZE(offset->u.constant)+2] = 0;
 +                              
zend_symtable_update(Z_ARRVAL(result->u.constant), 
Z_STRVAL(offset->u.constant), Z_STRSIZE(offset->u.constant)+3, &element, 
sizeof(zval *), NULL);
                                zval_dtor(&offset->u.constant);
                                break;
+                       case IS_CONSTANT_AST: {
+                               /* Another ugly hack to store the data about 
the AST in the array */
+                               char* key;
+                               int len = sizeof(zend_ast *);
+                               Z_TYPE_P(element) |= IS_CONSTANT_INDEX;
+ 
+                               key = emalloc(len + 2);
+                               *(zend_ast **)key = Z_AST(offset->u.constant);
+                               key[len] = Z_TYPE(offset->u.constant);
+                               key[len + 1] = 0;
+                               
zend_symtable_update(Z_ARRVAL(result->u.constant), key, len + 2, &element, 
sizeof(zval *), NULL);
+                               efree(key);
+                               break;
+                       }
                        case IS_STRING:
 -                              
zend_symtable_update(Z_ARRVAL(result->u.constant), 
Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+1, &element, 
sizeof(zval *), NULL);
 +                              
zend_symtable_update(Z_ARRVAL(result->u.constant), 
Z_STRVAL(offset->u.constant), Z_STRSIZE(offset->u.constant)+1, &element, 
sizeof(zval *), NULL);
                                zval_dtor(&offset->u.constant);
                                break;
                        case IS_NULL:
diff --cc Zend/zend_hash.h
index 0f556f5,c97412b..0e4a4c6
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@@ -97,15 -97,15 +97,15 @@@ typedef Bucket* HashPosition
  BEGIN_EXTERN_C()
  
  /* startup/shutdown */
- ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t 
pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
- ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t 
pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool 
bApplyProtection ZEND_FILE_LINE_DC);
+ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t 
pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
+ ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t 
pDestructor, zend_bool persistent, zend_bool bApplyProtection 
ZEND_FILE_LINE_DC);
  ZEND_API void zend_hash_destroy(HashTable *ht);
  ZEND_API void zend_hash_clean(HashTable *ht);
- #define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)     
                                        _zend_hash_init((ht), (nSize), 
(pHashFunction), (pDestructor), (persistent) ZEND_FILE_LINE_CC)
- #define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, 
bApplyProtection)                _zend_hash_init_ex((ht), (nSize), 
(pHashFunction), (pDestructor), (persistent), (bApplyProtection) 
ZEND_FILE_LINE_CC)
+ #define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)     
                                        _zend_hash_init((ht), (nSize), 
(pDestructor), (persistent) ZEND_FILE_LINE_CC)
+ #define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, 
bApplyProtection)                _zend_hash_init_ex((ht), (nSize), 
(pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC)
  
  /* additions/updates/changes */
 -ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint 
nKeyLength, void *pData, uint nDataSize, void **pDest, int flag 
ZEND_FILE_LINE_DC);
 +ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, 
zend_str_size_uint nKeyLength, void *pData, uint nDataSize, void **pDest, int 
flag ZEND_FILE_LINE_DC);
  #define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
                _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, 
nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
  #define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
@@@ -157,19 -157,19 +157,19 @@@ ZEND_API int zend_hash_del_key_or_index
                zend_hash_del_key_or_index(ht, arKey, nKeyLength, h, 
HASH_DEL_KEY_QUICK)
  #define zend_hash_index_del(ht, h) \
                zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
- 
- ZEND_API zend_uint_t zend_get_hash_value(const char *arKey, 
zend_str_size_uint nKeyLength);
+ #define zend_get_hash_value \
+               zend_hash_func
  
  /* Data retreival */
 -ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint 
nKeyLength, void **pData);
 -ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, 
uint nKeyLength, ulong h, void **pData);
 -ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData);
 +ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, 
zend_str_size_uint nKeyLength, void **pData);
 +ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, 
zend_str_size_uint nKeyLength, zend_uint_t h, void **pData);
 +ZEND_API int zend_hash_index_find(const HashTable *ht, zend_uint_t h, void 
**pData);
  
  /* Misc */
 -ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint 
nKeyLength);
 -ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, 
uint nKeyLength, ulong h);
 -ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h);
 -ZEND_API ulong zend_hash_next_free_element(const HashTable *ht);
 +ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, 
zend_str_size_uint nKeyLength);
 +ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, 
zend_str_size_uint nKeyLength, zend_uint_t h);
 +ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h);
 +ZEND_API zend_uint_t zend_hash_next_free_element(const HashTable *ht);
  
  /* traversing */
  #define zend_hash_has_more_elements_ex(ht, pos) \
diff --cc Zend/zend_operators.h
index 7b11445,0152e03..2187581
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@@ -445,15 -441,9 +445,16 @@@ END_EXTERN_C(
  #define Z_BVAL(zval)                  ((zend_bool)(zval).value.lval)
  #define Z_DVAL(zval)                  (zval).value.dval
  #define Z_STRVAL(zval)                        (zval).value.str.val
 +
 +#ifdef ZEND_USE_LEGACY_STRING_TYPES
  #define Z_STRLEN(zval)                        (zval).value.str.len
 +#define Z_STRLEN_P(zval_p)            Z_STRLEN(*zval_p)
 +#define Z_STRLEN_PP(zval_pp)          Z_STRLEN(**zval_pp)
 +#endif
 +
 +#define Z_STRSIZE(zval)                       (zval).value.str.len
  #define Z_ARRVAL(zval)                        (zval).value.ht
+ #define Z_AST(zval)                   (zval).value.ast
  #define Z_OBJVAL(zval)                        (zval).value.obj
  #define Z_OBJ_HANDLE(zval)            Z_OBJVAL(zval).handle
  #define Z_OBJ_HT(zval)                        Z_OBJVAL(zval).handlers
@@@ -467,8 -457,9 +468,9 @@@
  #define Z_BVAL_P(zval_p)              Z_BVAL(*zval_p)
  #define Z_DVAL_P(zval_p)              Z_DVAL(*zval_p)
  #define Z_STRVAL_P(zval_p)            Z_STRVAL(*zval_p)
 -#define Z_STRLEN_P(zval_p)            Z_STRLEN(*zval_p)
 +#define Z_STRSIZE_P(zval_p)           Z_STRSIZE(*zval_p)
  #define Z_ARRVAL_P(zval_p)            Z_ARRVAL(*zval_p)
+ #define Z_AST_P(zval_p)                       Z_AST(*zval_p)
  #define Z_OBJPROP_P(zval_p)           Z_OBJPROP(*zval_p)
  #define Z_OBJCE_P(zval_p)             Z_OBJCE(*zval_p)
  #define Z_RESVAL_P(zval_p)            Z_RESVAL(*zval_p)
@@@ -482,8 -473,9 +484,9 @@@
  #define Z_BVAL_PP(zval_pp)            Z_BVAL(**zval_pp)
  #define Z_DVAL_PP(zval_pp)            Z_DVAL(**zval_pp)
  #define Z_STRVAL_PP(zval_pp)  Z_STRVAL(**zval_pp)
 -#define Z_STRLEN_PP(zval_pp)  Z_STRLEN(**zval_pp)
 +#define Z_STRSIZE_PP(zval_pp) Z_STRSIZE(**zval_pp)
  #define Z_ARRVAL_PP(zval_pp)  Z_ARRVAL(**zval_pp)
+ #define Z_AST_PP(zval_p)              Z_AST(**zval_p)
  #define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp)
  #define Z_OBJCE_PP(zval_pp)           Z_OBJCE(**zval_pp)
  #define Z_RESVAL_PP(zval_pp)  Z_RESVAL(**zval_pp)
diff --cc Zend/zend_vm_def.h
index 3821374,f5da051..b479914
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@@ -3569,9 -3568,8 +3568,8 @@@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT
                        }
                }
  
 -              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
 +              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
-                       if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY ||
-                           (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == 
IS_CONSTANT) {
+                       if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
                                zend_class_entry *old_scope = EG(scope);
  
                                EG(scope) = ce;
diff --cc Zend/zend_vm_execute.h
index 0e38bb7,c6333ed..91875a8
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@@ -3782,9 -3781,8 +3781,8 @@@ static int ZEND_FASTCALL  ZEND_FETCH_CO
                        }
                }
  
 -              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
 +              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
-                       if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY ||
-                           (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == 
IS_CONSTANT) {
+                       if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
                                zend_class_entry *old_scope = EG(scope);
  
                                EG(scope) = ce;
@@@ -15551,9 -15549,8 +15549,8 @@@ static int ZEND_FASTCALL  ZEND_FETCH_CO
                        }
                }
  
 -              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
 +              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
-                       if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY ||
-                           (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == 
IS_CONSTANT) {
+                       if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
                                zend_class_entry *old_scope = EG(scope);
  
                                EG(scope) = ce;
@@@ -25048,9 -25045,8 +25045,8 @@@ static int ZEND_FASTCALL  ZEND_FETCH_CO
                        }
                }
  
 -              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
 +              if (EXPECTED(zend_hash_quick_find(&ce->constants_table, 
Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, 
Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
-                       if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY ||
-                           (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == 
IS_CONSTANT) {
+                       if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
                                zend_class_entry *old_scope = EG(scope);
  
                                EG(scope) = ce;
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to