summaryrefslogtreecommitdiff
path: root/ext/opcache/ZendAccelerator.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-02-20 16:08:57 +0300
committerDmitry Stogov <dmitry@zend.com>2015-02-20 16:08:57 +0300
commit623810eff40d82e6d7c9f17aeaacec43d741d4c6 (patch)
tree8f13cb587d34aef72f950a527e868ee90f0195da /ext/opcache/ZendAccelerator.c
parent5100afb7dd06b2515a3c524b4be02c8d3a80a091 (diff)
downloadphp-git-623810eff40d82e6d7c9f17aeaacec43d741d4c6.tar.gz
Use fast SSE2 memcpy() for copying block of data from SHM to process memory
Diffstat (limited to 'ext/opcache/ZendAccelerator.c')
-rw-r--r--ext/opcache/ZendAccelerator.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 62e62e1821..cdcbfeda56 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1163,7 +1163,13 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
memory_used = zend_accel_script_persist_calc(new_persistent_script, key, key_length);
/* Allocate shared memory */
+#ifdef __SSE2__
+ /* Align to 64-byte boundary */
+ ZCG(mem) = zend_shared_alloc(memory_used + 64);
+ ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L);
+#else
ZCG(mem) = zend_shared_alloc(memory_used);
+#endif
if (!ZCG(mem)) {
zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM);
zend_shared_alloc_unlock();