]> granicus.if.org Git - php/commit
Optimize ZEND_CAST to avoid zval copies
authorNikita Popov <nikic@php.net>
Fri, 25 Apr 2014 13:21:26 +0000 (15:21 +0200)
committerNikita Popov <nikic@php.net>
Fri, 25 Apr 2014 21:21:05 +0000 (23:21 +0200)
commit9263d18bd9655a5f64f1956d9536e76e9ec22144
treea1e406a11060db8cced3aeb6b550ec290fcf5ae5
parentdd419d24ca01db3e3be66b4414c4d7926c6fdc69
Optimize ZEND_CAST to avoid zval copies

The scalar type casts IS_NULL, IS_BOOL, IS_LONG, IS_DOUBLE and
IS_STRING will no longer require a copy when casting.

A copy is now only made when casting to IS_ARRAY and IS_OBJECT, if
the type doesn't already match.

I tweaked the reference handling for the type-already-correct case
to DEREF the zval after that check. References require a copy anyway,
so they can go through the slow codepath.
Zend/zend_vm_def.h
Zend/zend_vm_execute.h