@@ -9240,19 +9240,11 @@ static int zend_jit_init_fcall_guard(dasm_State **Dst, uint32_t level, const zen
9240
9240
int32_t exit_point;
9241
9241
const void *exit_addr;
9242
9242
9243
- if (func->type == ZEND_INTERNAL_FUNCTION) {
9244
- #ifdef ZEND_WIN32
9245
- // TODO: ASLR may cause different addresses in different workers ???
9246
- return 0;
9247
- #endif
9248
- } else if (func->type == ZEND_USER_FUNCTION) {
9243
+ if (func->type == ZEND_USER_FUNCTION) {
9249
9244
if (!zend_accel_in_shm(func->op_array.opcodes)) {
9250
9245
/* op_array and op_array->opcodes are not persistent. We can't link. */
9251
9246
return 0;
9252
9247
}
9253
- } else {
9254
- ZEND_UNREACHABLE();
9255
- return 0;
9256
9248
}
9257
9249
9258
9250
exit_point = zend_jit_trace_get_exit_point(to_opline, ZEND_JIT_EXIT_POLYMORPHISM);
@@ -9286,6 +9278,22 @@ static int zend_jit_init_fcall_guard(dasm_State **Dst, uint32_t level, const zen
9286
9278
| cmp aword [r1 + offsetof(zend_op_array, opcodes)], opcodes
9287
9279
| .endif
9288
9280
| jne &exit_addr
9281
+ #ifdef _WIN32
9282
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
9283
+ const zif_handler *handler = func->internal_function.handler;
9284
+
9285
+ | .if X64
9286
+ || if (!IS_SIGNED_32BIT(handler)) {
9287
+ | mov64 r2, ((ptrdiff_t)handler)
9288
+ | cmp aword [r1 + offsetof(zend_internal_function, handler)], r2
9289
+ || } else {
9290
+ | cmp aword [r1 + offsetof(zend_internal_function, handler)], handler
9291
+ || }
9292
+ | .else
9293
+ | cmp aword [r1 + offsetof(zend_internal_function, handler)], handler
9294
+ | .endif
9295
+ | jne &exit_addr
9296
+ #endif
9289
9297
} else {
9290
9298
| .if X64
9291
9299
|| if (!IS_SIGNED_32BIT(func)) {
@@ -9432,6 +9440,22 @@ static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t
9432
9440
| cmp aword [r0 + offsetof(zend_op_array, opcodes)], opcodes
9433
9441
| .endif
9434
9442
| jz >3
9443
+ #ifdef _WIN32
9444
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
9445
+ const zif_handler *handler = func->internal_function.handler;
9446
+
9447
+ | .if X64
9448
+ || if (!IS_SIGNED_32BIT(handler)) {
9449
+ | mov64 r1, ((ptrdiff_t)handler)
9450
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], r1
9451
+ || } else {
9452
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9453
+ || }
9454
+ | .else
9455
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9456
+ | .endif
9457
+ | jz >3
9458
+ #endif
9435
9459
} else {
9436
9460
| .if X64
9437
9461
|| if (!IS_SIGNED_32BIT(func)) {
@@ -9618,11 +9642,7 @@ static int zend_jit_init_method_call(dasm_State **Dst,
9618
9642
if ((!func || zend_jit_may_be_modified(func, op_array))
9619
9643
&& trace
9620
9644
&& trace->op == ZEND_JIT_TRACE_INIT_CALL
9621
- && trace->func
9622
- #ifdef _WIN32
9623
- && trace->func->type != ZEND_INTERNAL_FUNCTION
9624
- #endif
9625
- ) {
9645
+ && trace->func) {
9626
9646
int32_t exit_point;
9627
9647
const void *exit_addr;
9628
9648
@@ -9651,6 +9671,22 @@ static int zend_jit_init_method_call(dasm_State **Dst,
9651
9671
| cmp aword [r0 + offsetof(zend_op_array, opcodes)], opcodes
9652
9672
| .endif
9653
9673
| jne &exit_addr
9674
+ #ifdef _WIN32
9675
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
9676
+ const zif_handler *handler = func->internal_function.handler;
9677
+
9678
+ | .if X64
9679
+ || if (!IS_SIGNED_32BIT(handler)) {
9680
+ | mov64 r1, ((ptrdiff_t)handler)
9681
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], r1
9682
+ || } else {
9683
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9684
+ || }
9685
+ | .else
9686
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9687
+ | .endif
9688
+ | jne &exit_addr
9689
+ #endif
9654
9690
} else {
9655
9691
| .if X64
9656
9692
|| if (!IS_SIGNED_32BIT(func)) {
0 commit comments