Skip to content

Commit 0c61a86

Browse files
committed
Remove the ZEND_HIGH_HALF_KERNEL alternative
1 parent 36f6b15 commit 0c61a86

File tree

5 files changed

+8
-52
lines changed

5 files changed

+8
-52
lines changed

Zend/zend_portability.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -865,21 +865,4 @@ static zend_always_inline uint64_t ZEND_BYTES_SWAP64(uint64_t u)
865865
# define ZEND_OPCACHE_SHM_REATTACHMENT 1
866866
#endif
867867

868-
#ifndef CHAR_BITS
869-
# define CHAR_BITS 8
870-
#endif
871-
872-
#ifndef UINTPTR_WIDTH
873-
# define UINTPTR_WIDTH (CHAR_BITS * sizeof(uintptr_t))
874-
#endif
875-
876-
#if ((defined(__linux__) && defined(__x86_64__)) \
877-
|| (defined(ZEND_WIN32) && defined(_M_AMD64))) \
878-
&& !defined(NO_ZEND_HIGH_HALF_KERNEL)
879-
/* The kernel reserves the higher part of the address space for itself.
880-
* Therefore, we can assume that the higher bit of user space addresses is
881-
* never set. */
882-
# define ZEND_HIGH_HALF_KERNEL
883-
#endif
884-
885868
#endif /* ZEND_PORTABILITY_H */

Zend/zend_vm_gen.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,11 +1905,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
19051905
out($f,"# define ZEND_OPCODE_HANDLER_RET const zend_op *\n");
19061906
out($f,"# define ZEND_VM_TAIL_CALL(call) return call\n");
19071907
out($f,"# define ZEND_VM_CONTINUE() return opline\n");
1908-
out($f,"# ifdef ZEND_HIGH_HALF_KERNEL\n");
1909-
out($f,"# define ZEND_VM_RETURN() return NULL\n");
1910-
out($f,"# else\n");
1911-
out($f,"# define ZEND_VM_RETURN() return (const zend_op*)ZEND_VM_ENTER_BIT\n");
1912-
out($f,"# endif\n");
1908+
out($f,"# define ZEND_VM_RETURN() return (const zend_op*)ZEND_VM_ENTER_BIT\n");
19131909
if ($kind == ZEND_VM_KIND_HYBRID) {
19141910
out($f,"# define ZEND_VM_HOT\n");
19151911
}
@@ -1948,11 +1944,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
19481944
out($f,"# define ZEND_VM_ENTER() opline = EG(current_execute_data)->opline; ZEND_VM_ENTER_EX()\n");
19491945
out($f,"# define ZEND_VM_LEAVE() return 2\n");
19501946
out($f,"#else\n");
1951-
out($f,"# ifdef ZEND_HIGH_HALF_KERNEL\n");
1952-
out($f,"# define ZEND_VM_ENTER_BIT (1ULL<<(UINTPTR_WIDTH-1))\n");
1953-
out($f,"# else\n");
1954-
out($f,"# define ZEND_VM_ENTER_BIT 1ULL\n");
1955-
out($f,"# endif\n");
1947+
out($f,"# define ZEND_VM_ENTER_BIT 1ULL\n");
19561948
out($f,"# define ZEND_VM_ENTER_EX() return (zend_op*)((uintptr_t)opline | ZEND_VM_ENTER_BIT)\n");
19571949
out($f,"# define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_ENTER_EX()\n");
19581950
out($f,"# define ZEND_VM_LEAVE() return (zend_op*)((uintptr_t)opline | ZEND_VM_ENTER_BIT)\n");
@@ -2155,11 +2147,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
21552147
out($f, $m[1]."if (UNEXPECTED(!OPLINE))".$m[3]."\n");
21562148
out($f,"#else\n");
21572149
out($f, $m[1]."opline = ((opcode_handler_t)opline->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
2158-
out($f, "# ifdef ZEND_HIGH_HALF_KERNEL\n");
2159-
out($f, $m[1]."if (UNEXPECTED((intptr_t)opline <= 0))".$m[3]."\n");
2160-
out($f, "# else\n");
21612150
out($f, $m[1]."if (UNEXPECTED(((uintptr_t)opline & ZEND_VM_ENTER_BIT)))".$m[3]."\n");
2162-
out($f, "# endif\n");
21632151
out($f,"#endif\n");
21642152
if ($kind == ZEND_VM_KIND_HYBRID) {
21652153
out($f,"#endif /* ZEND_VM_KIND != ZEND_VM_KIND_HYBRID */\n");
@@ -3017,11 +3005,7 @@ function gen_vm($def, $skel) {
30173005
out($f, "#else\n");
30183006
out($f, "\topline = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
30193007

3020-
out($f, "# ifdef ZEND_HIGH_HALF_KERNEL\n");
3021-
out($f, "\tif (UNEXPECTED((intptr_t)opline <= 0)) {\n");
3022-
out($f, "# else\n");
3023-
out($f, "\tif (UNEXPECTED(((uintptr_t)opline & ZEND_VM_ENTER_BIT))) {\n");
3024-
out($f, "# endif\n");
3008+
out($f, "if (UNEXPECTED(((uintptr_t)opline & ZEND_VM_ENTER_BIT))) {\n");
30253009
out($f, "\t\topline = (const zend_op*)((uintptr_t)opline & ~ZEND_VM_ENTER_BIT);\n");
30263010
out($f, "\t\tif (EXPECTED(opline)) {\n");
30273011
out($f, "\t\t\t/* ZEND_VM_ENTER() or ZEND_VM_LEAVE() */\n");

ext/opcache/jit/zend_jit_internal.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ extern const zend_op *zend_jit_halt_op;
201201
return; \
202202
} while(0)
203203
# define ZEND_VM_ENTER_BIT 0
204-
# define ZEND_VM_RETURN_VAL 0
205204
#else
206205
# define EXECUTE_DATA_D zend_execute_data* execute_data
207206
# define EXECUTE_DATA_C execute_data
@@ -223,13 +222,7 @@ extern const zend_op *zend_jit_halt_op;
223222
# define ZEND_OPCODE_TAIL_CALL_EX(handler, arg) do { \
224223
return handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_EX arg); \
225224
} while(0)
226-
# ifdef ZEND_HIGH_HALF_KERNEL
227-
# define ZEND_VM_ENTER_BIT (1ULL<<(UINTPTR_WIDTH-1))
228-
# define ZEND_VM_RETURN_VAL 0
229-
# else
230-
# define ZEND_VM_ENTER_BIT 1ULL
231-
# define ZEND_VM_RETURN_VAL ZEND_VM_ENTER_BIT
232-
# endif
225+
# define ZEND_VM_ENTER_BIT 1ULL
233226
#endif
234227

235228
/* VM handlers */

ext/opcache/jit/zend_jit_ir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ static int zend_jit_trace_halt_stub(zend_jit_ctx *jit)
23912391
jit_STORE_IP(jit, IR_NULL);
23922392
ir_RETURN(IR_VOID);
23932393
} else {
2394-
ir_RETURN(ir_CONST_ADDR(ZEND_VM_RETURN_VAL)); // ZEND_VM_RETURN
2394+
ir_RETURN(ir_CONST_ADDR(ZEND_VM_ENTER_BIT)); // ZEND_VM_RETURN
23952395
}
23962396
return 1;
23972397
}
@@ -11099,7 +11099,7 @@ static int zend_jit_leave_func(zend_jit_ctx *jit,
1109911099
} else if (GCC_GLOBAL_REGS) {
1110011100
ir_GUARD(jit_IP(jit), jit_STUB_ADDR(jit, jit_stub_trace_halt));
1110111101
} else {
11102-
ir_GUARD(ir_NE(ref, ir_CONST_ADDR(ZEND_VM_RETURN_VAL)), jit_STUB_ADDR(jit, jit_stub_trace_halt));
11102+
ir_GUARD(ir_NE(ref, ir_CONST_ADDR(ZEND_VM_ENTER_BIT)), jit_STUB_ADDR(jit, jit_stub_trace_halt));
1110311103
jit_STORE_IP(jit, ref);
1110411104
}
1110511105
}

ext/opcache/jit/zend_jit_vm_helpers.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_top_func_helper(ZEND_OPCODE
105105
#ifdef HAVE_GCC_GLOBAL_REGS
106106
opline = zend_jit_halt_op;
107107
#else
108-
return (const zend_op*)ZEND_VM_RETURN_VAL; // ZEND_VM_RETURN
108+
return (const zend_op*)ZEND_VM_ENTER_BIT; // ZEND_VM_RETURN
109109
#endif
110110
}
111111

@@ -412,7 +412,7 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_trace_c
412412
opline = NULL;
413413
return;
414414
#else
415-
return (const zend_op*)ZEND_VM_RETURN_VAL; // ZEND_VM_RETURN()
415+
return (const zend_op*)ZEND_VM_ENTER_BIT; // ZEND_VM_RETURN()
416416
#endif
417417
}
418418
execute_data = EG(current_execute_data);
@@ -984,11 +984,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
984984
if (UNEXPECTED(opline == zend_jit_halt_op)) {
985985
#else
986986
opline = handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
987-
# ifdef ZEND_HIGH_HALF_KERNEL
988-
if (UNEXPECTED((intptr_t)opline == 0)) {
989-
# else
990987
if (UNEXPECTED(((uintptr_t)opline & ~ZEND_VM_ENTER_BIT) == 0)) {
991-
# endif
992988
#endif
993989
stop = ZEND_JIT_TRACE_STOP_RETURN;
994990
opline = NULL;

0 commit comments

Comments
 (0)