@@ -2729,6 +2729,7 @@ static int zend_jit_free_ctx(zend_jit_ctx *jit)
2729
2729
static void *zend_jit_ir_compile(ir_ctx *ctx, size_t *size, const char *name)
2730
2730
{
2731
2731
void *entry;
2732
+ ir_code_buffer code_buffer;
2732
2733
2733
2734
if (JIT_G(debug) & ZEND_JIT_DEBUG_IR_SRC) {
2734
2735
if (name) fprintf(stderr, "%s: ; after folding\n", name);
@@ -2817,10 +2818,15 @@ static void *zend_jit_ir_compile(ir_ctx *ctx, size_t *size, const char *name)
2817
2818
ir_check(ctx);
2818
2819
#endif
2819
2820
2820
- ctx->code_buffer = *dasm_ptr;
2821
- ctx->code_buffer_size = (char*)dasm_end - (char*)*dasm_ptr;
2821
+ code_buffer.start = dasm_buf;
2822
+ code_buffer.end = dasm_end;
2823
+ code_buffer.pos = *dasm_ptr;
2824
+ ctx->code_buffer = &code_buffer;
2822
2825
2823
2826
entry = ir_emit_code(ctx, size);
2827
+
2828
+ *dasm_ptr = code_buffer.pos;
2829
+
2824
2830
if (entry) {
2825
2831
*dasm_ptr = (char*)entry + ZEND_MM_ALIGNED_SIZE_EX(*size, 16);
2826
2832
}
@@ -15791,9 +15797,16 @@ static const void *zend_jit_trace_allocate_exit_group(uint32_t n)
15791
15797
{
15792
15798
const void *entry;
15793
15799
size_t size;
15800
+ ir_code_buffer code_buffer;
15801
+
15802
+ code_buffer.start = dasm_buf;
15803
+ code_buffer.end = dasm_end;
15804
+ code_buffer.pos = *dasm_ptr;
15794
15805
15795
15806
entry = ir_emit_exitgroup(n, ZEND_JIT_EXIT_POINTS_PER_GROUP, zend_jit_stub_handlers[jit_stub_trace_exit],
15796
- *dasm_ptr, (char*)dasm_end - (char*)*dasm_ptr, &size);
15807
+ &code_buffer, &size);
15808
+
15809
+ *dasm_ptr = code_buffer.pos;
15797
15810
15798
15811
if (entry) {
15799
15812
*dasm_ptr = (char*)entry + ZEND_MM_ALIGNED_SIZE_EX(size, 16);
0 commit comments