summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c4
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc14
2 files changed, 10 insertions, 8 deletions
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index 38294d5c27..11f9fe0f12 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -1118,11 +1118,11 @@ static zval* ZEND_FASTCALL zend_jit_fetch_global_helper(zend_execute_data *execu
if (UNEXPECTED(value == NULL)) {
value = zend_hash_add_new(&EG(symbol_table), Z_STR_P(varname), &EG(uninitialized_zval));
- idx = ((char*)value - (char*)EG(symbol_table).arData) / sizeof(Bucket);
+ idx = (char*)value - (char*)EG(symbol_table).arData;
/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
CACHE_PTR(cache_slot, (void*)(uintptr_t)(idx + 1));
} else {
- idx = ((char*)value - (char*)EG(symbol_table).arData) / sizeof(Bucket);
+ idx = (char*)value - (char*)EG(symbol_table).arData;
/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
CACHE_PTR(cache_slot, (void*)(uintptr_t)(idx + 1));
/* GLOBAL variable may be an INDIRECT pointer to CV */
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index b8e91f3846..a748bb2599 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -8462,15 +8462,17 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, const z
| mov r0, EX->run_time_cache
| mov r0, aword [r0 + opline->extended_value]
| sub r0, 1
- //if (EXPECTED(idx < EG(symbol_table).nNumUsed))
- | MEM_OP2_2_ZTS cmp, eax, dword, executor_globals, symbol_table.nNumUsed, r1
- | jae >9
- //Bucket *p = EG(symbol_table).arData + idx;
+ //if (EXPECTED(idx < EG(symbol_table).nNumUsed * sizeof(Bucket)))
|.if X64
- | shl r0, 5
+ | MEM_OP2_2_ZTS movsxd, r1, dword, executor_globals, symbol_table.nNumUsed, r1
+ | shl r1, 5
|.else
- | imul r0, sizeof(Bucket)
+ | MEM_OP2_2_ZTS mov, r1, dword, executor_globals, symbol_table.nNumUsed, r1
+ | imul r1, sizeof(Bucket)
|.endif
+ | cmp r0, r1
+ | jae >9
+ //Bucket *p = (Bucket*)((char*)EG(symbol_table).arData + idx);
| MEM_OP2_2_ZTS add, r0, aword, executor_globals, symbol_table.arData, r1
| IF_Z_TYPE r0, IS_UNDEF, >9
// (EXPECTED(p->key == Z_STR_P(varname))