Skip to content

Instantly share code, notes, and snippets.

diff --git a/Zend/zend.c b/Zend/zend.c
index aae1d13..dc0cab8 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -742,9 +742,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
extern zend_php_scanner_globals language_scanner_globals;
#endif
-#ifndef HAVE_FUNC_ATTRIBUTE_IFUNC
zend_cpu_startup();
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 1c870e9..1c2c41f 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1358,10 +1358,10 @@ static zend_persistent_script *store_script_in_file_cache(zend_persistent_script
memory_used = zend_accel_script_persist_calc(new_persistent_script, NULL, 0, 0);
/* Allocate memory block */
-#ifdef __SSE2__
+#if defined(__AVX__) || defined(__SSE2__)
#include <stdio.h>
#include <string.h>
#include <nmmintrin.h>
static unsigned long zend_inline_hash_func(const char *str, long len)
{
unsigned long hash = 5381;
/* variant with the hash unrolled eight times */
for (; len >= 8; len -= 8) {
#include <stdio.h>
#include <string.h>
#include <nmmintrin.h>
static unsigned long zend_inline_hash_func(const char *str, long len)
{
unsigned long hash = 5381;
/* variant with the hash unrolled eight times */
for (; len >= 8; len -= 8) {
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index a8af4bf..c761db2 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -32,6 +32,10 @@
#include "zend_exceptions.h"
#include "zend_closures.h"
+#ifdef __SSE4_2__
+#include <nmmintrin.h>
<?php
$retry = 10;
$start = microtime(true);
while (--$retry) {
$length = (int)(300/$retry);
$str = file_get_contents("/dev/urandom", false, NULL, 0, $length);
//echo "String lenght: ", $length, "\n";
$time = microtime(true);
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 97a20fb..d6b039f 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -34,6 +34,12 @@
#ifdef HAVE_MONETARY_H
# include <monetary.h>
#endif
+
+#ifdef __SSE4_2__
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 25b51b6..14daac2 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -329,6 +329,25 @@ static zend_bool try_replace_op2(
if (zend_optimizer_update_op2_const(ctx->scdf.op_array, opline, &zv)) {
return 1;
} else {
+ switch (opline->opcode) {
+ case ZEND_FETCH_CLASS:
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index ef82135..688d6a9 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -2928,7 +2928,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
break;
case ZEND_FE_FETCH_R:
case ZEND_FE_FETCH_RW:
- tmp = (t2 & MAY_BE_REF);
+ tmp = t2;
<?php
class ReactionRatingService
{
public function calculateBoostPoints()
{
while ($reaction = $reactions) {
$reactionRatings = $this->validFunction();
$totalWeight = 0;
$runningScore = 0;