43
43
|.define FCARG1w, w0
44
44
|.define FCARG2x, x1
45
45
|.define FCARG2w, w1
46
- |.define SPAD, # 0x20 // padding for CPU stack alignment
47
- |.define NR_SPAD, # 0x30 // padding for CPU stack alignment
46
+ |.define SPAD, 0x20 // padding for CPU stack alignment
47
+ |.define NR_SPAD, 0x30 // padding for CPU stack alignment
48
48
|.define T3, [sp, #0x28] // Used to store old value of IP (CALL VM only)
49
49
|.define T2, [sp, #0x20] // Used to store old value of FP (CALL VM only)
50
50
|.define T1, [sp, #0x10]
88
88
89
89
|.define HYBRID_SPAD, #32 // padding for stack alignment
90
90
91
- #define SPAD 0x20
92
- #define NR_SPAD 0x30
93
91
#define TMP_ZVAL_OFFSET 16
94
92
#define DASM_ALIGNMENT 16
95
93
@@ -1724,11 +1722,11 @@ static int zend_jit_interrupt_handler_stub(dasm_State **Dst)
1724
1722
| ADD_HYBRID_SPAD
1725
1723
| JMP_IP TMP1
1726
1724
} else if (GCC_GLOBAL_REGS) {
1727
- | ldp x29, x30, [sp], #SPAD // stack alignment
1725
+ | ldp x29, x30, [sp], # SPAD // stack alignment
1728
1726
| JMP_IP TMP1
1729
1727
} else {
1730
- | ldp FP, RX, T2 // retore FP and IP
1731
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
1728
+ | ldp FP, RX, T2 // retore FP and IP
1729
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
1732
1730
| mov RETVALx, #1 // ZEND_VM_ENTER
1733
1731
| ret
1734
1732
}
@@ -1749,22 +1747,22 @@ static int zend_jit_exception_handler_stub(dasm_State **Dst)
1749
1747
const void *handler = EG(exception_op)->handler;
1750
1748
1751
1749
if (GCC_GLOBAL_REGS) {
1752
- | ldp x29, x30, [sp], #SPAD // stack alignment
1750
+ | ldp x29, x30, [sp], # SPAD // stack alignment
1753
1751
| EXT_JMP handler, REG0
1754
1752
} else if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
1755
1753
| mov FCARG1x, FP
1756
1754
| EXT_CALL handler, REG0
1757
- | ldp FP, RX, T2 // retore FP and IP
1758
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
1755
+ | ldp FP, RX, T2 // retore FP and IP
1756
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
1759
1757
| tst RETVALw, RETVALw
1760
1758
| blt >1
1761
1759
| mov RETVALw, #1 // ZEND_VM_ENTER
1762
1760
|1:
1763
1761
| ret
1764
1762
} else {
1765
1763
| mov FCARG1x, FP
1766
- | ldp FP, RX, T2 // retore FP and IP
1767
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
1764
+ | ldp FP, RX, T2 // retore FP and IP
1765
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
1768
1766
| EXT_JMP handler, REG0
1769
1767
}
1770
1768
}
@@ -1803,11 +1801,11 @@ static int zend_jit_leave_function_stub(dasm_State **Dst)
1803
1801
| JMP_IP TMP1
1804
1802
} else {
1805
1803
if (GCC_GLOBAL_REGS) {
1806
- | ldp x29, x30, [sp], #SPAD // stack alignment
1804
+ | ldp x29, x30, [sp], # SPAD // stack alignment
1807
1805
} else {
1808
1806
| mov FCARG2x, FP
1809
- | ldp FP, RX, T2 // retore FP and IP
1810
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
1807
+ | ldp FP, RX, T2 // retore FP and IP
1808
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
1811
1809
}
1812
1810
| TST_32_WITH_CONST FCARG1w, ZEND_CALL_TOP, TMP1w
1813
1811
| bne >1
@@ -1844,8 +1842,8 @@ static int zend_jit_leave_throw_stub(dasm_State **Dst)
1844
1842
|5:
1845
1843
| // opline = EG(exception_op);
1846
1844
| LOAD_IP_ADDR_ZTS executor_globals, exception_op, TMP2
1847
- | ldp FP, RX, T2 // retore FP and IP
1848
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
1845
+ | ldp FP, RX, T2 // retore FP and IP
1846
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
1849
1847
| mov RETVALx, #2 // ZEND_VM_LEAVE
1850
1848
| ret
1851
1849
}
@@ -2286,12 +2284,12 @@ static int zend_jit_trace_halt_stub(dasm_State **Dst)
2286
2284
| ADD_HYBRID_SPAD
2287
2285
| EXT_JMP zend_jit_halt_op->handler, REG0
2288
2286
} else if (GCC_GLOBAL_REGS) {
2289
- | ldp x29, x30, [sp], #SPAD // stack alignment
2287
+ | ldp x29, x30, [sp], # SPAD // stack alignment
2290
2288
| ret // PC must be zero
2291
2289
} else {
2292
- | ldp FP, RX, T2 // retore FP and IP
2293
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
2294
- | sub RETVALx, xzr, #1 // ZEND_VM_RETURN (-1)
2290
+ | ldp FP, RX, T2 // retore FP and IP
2291
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
2292
+ | movn RETVALx, #0 // ZEND_VM_RETURN (-1)
2295
2293
| ret
2296
2294
}
2297
2295
return 1;
@@ -2360,11 +2358,11 @@ static int zend_jit_trace_exit_stub(dasm_State **Dst)
2360
2358
| ADD_HYBRID_SPAD
2361
2359
| JMP_IP TMP1
2362
2360
} else if (GCC_GLOBAL_REGS) {
2363
- | ldp x29, x30, [sp], #SPAD // stack alignment
2361
+ | ldp x29, x30, [sp], # SPAD // stack alignment
2364
2362
| JMP_IP TMP1
2365
2363
} else {
2366
- | ldp FP, RX, T2 // retore FP and IP
2367
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
2364
+ | ldp FP, RX, T2 // retore FP and IP
2365
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
2368
2366
| mov RETVALx, #1 // ZEND_VM_ENTER
2369
2367
| ret
2370
2368
}
@@ -2390,7 +2388,7 @@ static int zend_jit_trace_exit_stub(dasm_State **Dst)
2390
2388
| ldr REG0, [REG0]
2391
2389
| br REG0
2392
2390
} else if (GCC_GLOBAL_REGS) {
2393
- | ldp x29, x30, [sp], #SPAD // stack alignment
2391
+ | ldp x29, x30, [sp], # SPAD // stack alignment
2394
2392
| ldr REG0, EX->func
2395
2393
| ldr REG0, [REG0, #offsetof(zend_op_array, reserved[zend_func_info_rid])]
2396
2394
| ldr REG0, [REG0, #offsetof(zend_jit_op_array_trace_extension, offset)]
@@ -2410,9 +2408,9 @@ static int zend_jit_trace_exit_stub(dasm_State **Dst)
2410
2408
| tst RETVALw, RETVALw
2411
2409
| blt ->trace_halt
2412
2410
|
2413
- | ldp FP, RX, T2 // retore FP and IP
2414
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
2415
- | mov RETVALx, #1 // ZEND_VM_ENTER
2411
+ | ldp FP, RX, T2 // retore FP and IP
2412
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
2413
+ | mov RETVALx, #1 // ZEND_VM_ENTER
2416
2414
| ret
2417
2415
}
2418
2416
@@ -2427,11 +2425,11 @@ static int zend_jit_trace_escape_stub(dasm_State **Dst)
2427
2425
| ADD_HYBRID_SPAD
2428
2426
| JMP_IP, TMP1
2429
2427
} else if (GCC_GLOBAL_REGS) {
2430
- | ldp x29, x30, [sp], #SPAD // stack alignment
2428
+ | ldp x29, x30, [sp], # SPAD // stack alignment
2431
2429
| JMP_IP, TMP1
2432
2430
} else {
2433
- | ldp FP, RX, T2 // retore FP and IP
2434
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
2431
+ | ldp FP, RX, T2 // retore FP and IP
2432
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
2435
2433
| mov RETVALx, #1 // ZEND_VM_ENTER
2436
2434
| ret
2437
2435
}
@@ -2777,12 +2775,10 @@ static int zend_jit_prologue(dasm_State **Dst)
2777
2775
if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
2778
2776
| SUB_HYBRID_SPAD
2779
2777
} else if (GCC_GLOBAL_REGS) {
2780
- | sub sp, sp, SPAD // TODO: stp x29, x30, [sp, #-SPAD]! can't be compiled
2781
- | stp x29, x30, [sp] // stack alignment
2778
+ | stp x29, x30, [sp, # -SPAD]! // stack alignment
2782
2779
} else {
2783
- | sub sp, sp, NR_SPAD // TODO: stp x29, x30, [sp, #-NR_SPAD]! can't be compiled
2784
- | stp x29, x30, [sp] // stack alignment
2785
- | stp FP, RX, T2 // save FP and IP
2780
+ | stp x29, x30, [sp, # -NR_SPAD]! // stack alignment
2781
+ | stp FP, RX, T2 // save FP and IP
2786
2782
| mov FP, FCARG1x
2787
2783
}
2788
2784
return 1;
@@ -3034,15 +3030,13 @@ static int zend_jit_trace_link_to_root(dasm_State **Dst, zend_jit_trace_info *t,
3034
3030
prologue_size = 4;
3035
3031
#endif
3036
3032
} else if (GCC_GLOBAL_REGS) {
3037
- // sub sp, sp, #0x20
3038
- // stp x29, x30, [sp]
3039
- prologue_size = 8;
3033
+ // stp x29, x30, [sp, # -SPAD]!
3034
+ prologue_size = 4;
3040
3035
} else {
3041
- // sub sp, sp, NR_SPAD
3042
- // stp x29, x30, [sp]
3036
+ // stp x29, x30, [sp, # -NR_SPAD]! // stack alignment
3043
3037
// stp FP, RX, T2
3044
3038
// mov FP, FCARG1x
3045
- prologue_size = 16 ;
3039
+ prologue_size = 12 ;
3046
3040
}
3047
3041
link_addr = (const void*)((const char*)t->code_start + prologue_size);
3048
3042
@@ -3072,7 +3066,7 @@ static int zend_jit_trace_return(dasm_State **Dst, bool original_handler)
3072
3066
| br REG0
3073
3067
}
3074
3068
} else if (GCC_GLOBAL_REGS) {
3075
- | ldp x29, x30, [sp], #SPAD // stack alignment
3069
+ | ldp x29, x30, [sp], # SPAD // stack alignment
3076
3070
if (!original_handler) {
3077
3071
| JMP_IP TMP1
3078
3072
} else {
@@ -3093,9 +3087,9 @@ static int zend_jit_trace_return(dasm_State **Dst, bool original_handler)
3093
3087
| ldr REG0, [REG0]
3094
3088
| blr REG0
3095
3089
}
3096
- | ldp FP, RX, T2 // retore FP and IP
3097
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
3098
- | mov RETVALx, #2 // ZEND_VM_LEAVE
3090
+ | ldp FP, RX, T2 // retore FP and IP
3091
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
3092
+ | mov RETVALx, #2 // ZEND_VM_LEAVE
3099
3093
| ret
3100
3094
}
3101
3095
return 1;
@@ -3351,11 +3345,11 @@ static int zend_jit_tail_handler(dasm_State **Dst, const zend_op *opline)
3351
3345
const void *handler = opline->handler;
3352
3346
3353
3347
if (GCC_GLOBAL_REGS) {
3354
- | ldp x29, x30, [sp], #SPAD // stack alignment
3348
+ | ldp x29, x30, [sp], # SPAD // stack alignment
3355
3349
} else {
3356
3350
| mov FCARG1x, FP
3357
- | ldp FP, RX, T2 // retore FP and IP
3358
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
3351
+ | ldp FP, RX, T2 // retore FP and IP
3352
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
3359
3353
}
3360
3354
| EXT_JMP handler, REG0
3361
3355
}
@@ -9518,11 +9512,11 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
9518
9512
| ADD_HYBRID_SPAD
9519
9513
| JMP_IP TMP1
9520
9514
} else if (GCC_GLOBAL_REGS) {
9521
- | ldp x29, x30, [sp], #SPAD // stack alignment
9515
+ | ldp x29, x30, [sp], # SPAD // stack alignment
9522
9516
| JMP_IP TMP1
9523
9517
} else {
9524
- | ldp FP, RX, T2 // retore FP and IP
9525
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
9518
+ | ldp FP, RX, T2 // retore FP and IP
9519
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
9526
9520
| mov RETVALx, #1 // ZEND_VM_ENTER
9527
9521
| ret
9528
9522
}
@@ -10864,7 +10858,7 @@ static int zend_jit_leave_func(dasm_State **Dst,
10864
10858
| JMP_IP TMP1
10865
10859
#endif
10866
10860
} else if (GCC_GLOBAL_REGS) {
10867
- | ldp x29, x30, [sp], #SPAD // stack alignment
10861
+ | ldp x29, x30, [sp], # SPAD // stack alignment
10868
10862
#ifdef CONTEXT_THREADED_JIT
10869
10863
| NIY // TODO
10870
10864
#else
@@ -10877,9 +10871,9 @@ static int zend_jit_leave_func(dasm_State **Dst,
10877
10871
// the value of execute_data in execute_ex()
10878
10872
| NIY // TODO
10879
10873
#else
10880
- | ldp FP, RX, T2 // retore FP and IP
10881
- | ldp x29, x30, [sp], #NR_SPAD // stack alignment
10882
- | mov RETVALx, #2 // ZEND_VM_LEAVE ????
10874
+ | ldp FP, RX, T2 // retore FP and IP
10875
+ | ldp x29, x30, [sp], # NR_SPAD // stack alignment
10876
+ | mov RETVALx, #2 // ZEND_VM_LEAVE ????
10883
10877
| ret
10884
10878
#endif
10885
10879
}
0 commit comments