@@ -9274,19 +9274,11 @@ static int zend_jit_init_fcall_guard(dasm_State **Dst, uint32_t level, const zen
9274
9274
int32_t exit_point;
9275
9275
const void *exit_addr;
9276
9276
9277
- if (func->type == ZEND_INTERNAL_FUNCTION) {
9278
- #ifdef ZEND_WIN32
9279
- // TODO: ASLR may cause different addresses in different workers ???
9280
- return 0;
9281
- #endif
9282
- } else if (func->type == ZEND_USER_FUNCTION) {
9277
+ if (func->type == ZEND_USER_FUNCTION) {
9283
9278
if (!zend_accel_in_shm(func->op_array.opcodes)) {
9284
9279
/* op_array and op_array->opcodes are not persistent. We can't link. */
9285
9280
return 0;
9286
9281
}
9287
- } else {
9288
- ZEND_UNREACHABLE();
9289
- return 0;
9290
9282
}
9291
9283
9292
9284
exit_point = zend_jit_trace_get_exit_point(to_opline, ZEND_JIT_EXIT_POLYMORPHISM);
@@ -9320,6 +9312,22 @@ static int zend_jit_init_fcall_guard(dasm_State **Dst, uint32_t level, const zen
9320
9312
| cmp aword [r1 + offsetof(zend_op_array, opcodes)], opcodes
9321
9313
| .endif
9322
9314
| jne &exit_addr
9315
+ #ifdef _WIN32
9316
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
9317
+ const zif_handler handler = func->internal_function.handler;
9318
+
9319
+ | .if X64
9320
+ || if (!IS_SIGNED_32BIT(handler)) {
9321
+ | mov64 r2, ((ptrdiff_t)handler)
9322
+ | cmp aword [r1 + offsetof(zend_internal_function, handler)], r2
9323
+ || } else {
9324
+ | cmp aword [r1 + offsetof(zend_internal_function, handler)], handler
9325
+ || }
9326
+ | .else
9327
+ | cmp aword [r1 + offsetof(zend_internal_function, handler)], handler
9328
+ | .endif
9329
+ | jne &exit_addr
9330
+ #endif
9323
9331
} else {
9324
9332
| .if X64
9325
9333
|| if (!IS_SIGNED_32BIT(func)) {
@@ -9466,6 +9474,22 @@ static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t
9466
9474
| cmp aword [r0 + offsetof(zend_op_array, opcodes)], opcodes
9467
9475
| .endif
9468
9476
| jz >3
9477
+ #ifdef _WIN32
9478
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
9479
+ const zif_handler handler = func->internal_function.handler;
9480
+
9481
+ | .if X64
9482
+ || if (!IS_SIGNED_32BIT(handler)) {
9483
+ | mov64 r1, ((ptrdiff_t)handler)
9484
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], r1
9485
+ || } else {
9486
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9487
+ || }
9488
+ | .else
9489
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9490
+ | .endif
9491
+ | jz >3
9492
+ #endif
9469
9493
} else {
9470
9494
| .if X64
9471
9495
|| if (!IS_SIGNED_32BIT(func)) {
@@ -9652,11 +9676,7 @@ static int zend_jit_init_method_call(dasm_State **Dst,
9652
9676
if ((!func || zend_jit_may_be_modified(func, op_array))
9653
9677
&& trace
9654
9678
&& trace->op == ZEND_JIT_TRACE_INIT_CALL
9655
- && trace->func
9656
- #ifdef _WIN32
9657
- && trace->func->type != ZEND_INTERNAL_FUNCTION
9658
- #endif
9659
- ) {
9679
+ && trace->func) {
9660
9680
int32_t exit_point;
9661
9681
const void *exit_addr;
9662
9682
@@ -9685,6 +9705,22 @@ static int zend_jit_init_method_call(dasm_State **Dst,
9685
9705
| cmp aword [r0 + offsetof(zend_op_array, opcodes)], opcodes
9686
9706
| .endif
9687
9707
| jne &exit_addr
9708
+ #ifdef _WIN32
9709
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
9710
+ const zif_handler handler = func->internal_function.handler;
9711
+
9712
+ | .if X64
9713
+ || if (!IS_SIGNED_32BIT(handler)) {
9714
+ | mov64 r1, ((ptrdiff_t)handler)
9715
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], r1
9716
+ || } else {
9717
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9718
+ || }
9719
+ | .else
9720
+ | cmp aword [r0 + offsetof(zend_internal_function, handler)], handler
9721
+ | .endif
9722
+ | jne &exit_addr
9723
+ #endif
9688
9724
} else {
9689
9725
| .if X64
9690
9726
|| if (!IS_SIGNED_32BIT(func)) {
0 commit comments