com php-src: Inference: $a[]= results in long k eys: ext/opcache/Optimizer/zend_inference.c

From: Date: Sat, 14 May 2016 15:16:32 +0000
Subject: com php-src: Inference: $a[]= results in long k eys: ext/opcache/Optimizer/zend_inference.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92127@lists.php.net to get a copy of this message
Commit: dd8379e0464322c9b0e06aabc03bdbb3eb2b3361 Author: Nikita Popov <nikic@php.net> Sat, 14 May 2016 16:49:52 +0200 Parents: 6079ba4b0ccad0ba4d781ff027fde096da0f8687 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dd8379e0464322c9b0e06aabc03bdbb3eb2b3361 Log: Inference: $a[]= results in long keys Changed paths: M ext/opcache/Optimizer/zend_inference.c Diff: diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 06f3cdc..fd39baf 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2215,18 +2215,22 @@ static uint32_t assign_dim_result_type( if (value_type & MAY_BE_UNDEF) { tmp |= MAY_BE_ARRAY_OF_NULL; } - if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) { + if (dim_op_type == IS_UNUSED) { tmp |= MAY_BE_ARRAY_KEY_LONG; - } - if (dim_type & MAY_BE_STRING) { - tmp |= MAY_BE_ARRAY_KEY_STRING; - if (dim_op_type != IS_CONST) { - // FIXME: numeric string + } else { + if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) { tmp |= MAY_BE_ARRAY_KEY_LONG; } - } - if (dim_type & (MAY_BE_UNDEF|MAY_BE_NULL)) { - tmp |= MAY_BE_ARRAY_KEY_STRING; + if (dim_type & MAY_BE_STRING) { + tmp |= MAY_BE_ARRAY_KEY_STRING; + if (dim_op_type != IS_CONST) { + // FIXME: numeric string + tmp |= MAY_BE_ARRAY_KEY_LONG; + } + } + if (dim_type & (MAY_BE_UNDEF|MAY_BE_NULL)) { + tmp |= MAY_BE_ARRAY_KEY_STRING; + } } } return tmp; @@ -2474,7 +2478,7 @@ static void zend_update_type_info(const zend_op_array *op_array, if (t1 & MAY_BE_OBJECT) { tmp |= MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; } else { - tmp |= (t1 & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT; + tmp |= ((t1 & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT) | MAY_BE_ARRAY_KEY_LONG; } } UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);

« previous php.cvs (#92127) next »