Commit ddde35ce8b3 for php
commit ddde35ce8b3f36adefbb31ac14509378f22d01b6
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date: Mon Oct 26 21:10:13 2026 +0100
IR: Backport code buffer rollback fix
Cherry-picks https://github.com/dstogov/ir/pull/258.
Prepared via GH-24756.
diff --git a/ext/opcache/jit/ir/ir_aarch64.dasc b/ext/opcache/jit/ir/ir_aarch64.dasc
index fc4bb84f1e0..dae5837403d 100644
--- a/ext/opcache/jit/ir/ir_aarch64.dasc
+++ b/ext/opcache/jit/ir/ir_aarch64.dasc
@@ -6945,7 +6945,7 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
if (ctx->code_buffer) {
if (ctx->code_buffer->pos == (char*)entry + size) {
/* rollback */
- ctx->code_buffer->pos = (char*)entry - size;
+ ctx->code_buffer->pos = (char*)entry;
}
} else {
ir_mem_unmap(entry, size);
@@ -7068,7 +7068,7 @@ const void *ir_emit_exitgroup(uint32_t first_exit_point, uint32_t exit_points_pe
dasm_free(&dasm_state);
if (code_buffer->pos == (char*)entry + size) {
/* rollback */
- code_buffer->pos = (char*)entry - size;
+ code_buffer->pos = (char*)entry;
}
return NULL;
}
diff --git a/ext/opcache/jit/ir/ir_x86.dasc b/ext/opcache/jit/ir/ir_x86.dasc
index f5efb66698d..a62e49fc40e 100644
--- a/ext/opcache/jit/ir/ir_x86.dasc
+++ b/ext/opcache/jit/ir/ir_x86.dasc
@@ -12267,7 +12267,7 @@ next_block:;
if (ctx->code_buffer) {
if (ctx->code_buffer->pos == (char*)entry + size) {
/* rollback */
- ctx->code_buffer->pos = (char*)entry - size;
+ ctx->code_buffer->pos = (char*)entry;
}
} else {
ir_mem_unmap(entry, size);
@@ -12393,7 +12393,7 @@ const void *ir_emit_exitgroup(uint32_t first_exit_point, uint32_t exit_points_pe
dasm_free(&dasm_state);
if (code_buffer->pos == (char*)entry + size) {
/* rollback */
- code_buffer->pos = (char*)entry - size;
+ code_buffer->pos = (char*)entry;
}
return NULL;
}