Skip to content

Draft: JIT code cleanup #10206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a08efa7
ext/opcache/jit/zend_jit: use true/false for bool variables
MaxKellermann Dec 21, 2022
5e0affc
ext/opcache/jit/zend_jit: make zend_jit_check_funcs() static
MaxKellermann Dec 21, 2022
71db101
ext/opcache/jit/zend_jit_trace: make zend_jit_trace_hot_side() static
MaxKellermann Dec 21, 2022
e7eb6bb
ext/opcache/jit/zend_jit_trace: make zend_jit_trace_exit() static
MaxKellermann Dec 21, 2022
a9e57ce
ext/opcache/jit/zend_jit: make zend_jit_hot_counters static
MaxKellermann Dec 21, 2022
d8bcac7
ext/opcache/jit/zend_jit: make the "ssa" parameter of zend_may_overfl…
MaxKellermann Dec 21, 2022
e1812fc
ext/opcache/jit/zend_jit: move redundant code to zend_jit_new_op_arra…
MaxKellermann Dec 21, 2022
d7bb24e
ext/opcache/jit/zend_jit_trace: use true/false instead of 1/0
MaxKellermann Dec 21, 2022
fc291bc
ext/opcache/jit: add some API documentation
MaxKellermann Dec 21, 2022
4046678
ext/opcache/jit/zend_jit_internal: remove unused macro zend_jit_oplin…
MaxKellermann Dec 21, 2022
8fea73f
ext/opcache/jit/zend_jit_internal: zend_jit_hash() returns unsigned
MaxKellermann Dec 21, 2022
4ac322e
ext/opcache/jit/zend_jit_internal: convert zend_jit_op_array_hash() t…
MaxKellermann Dec 21, 2022
7f2ca1e
ext/opcache/jit/zend_jit: use modulo instead of bitwise and
MaxKellermann Dec 21, 2022
74ca778
ext/opcache/jit/zend_jit_trace: cache ZEND_OP_TRACE_INFO() in variable
MaxKellermann Dec 21, 2022
5ff06c7
ext/opcache/jit/zend_jit_trace: move redundant code to zend_jit_hot_c…
MaxKellermann Dec 21, 2022
ac8047d
ext/opcache/jit: move redundant code to zend_find_function_entry()
MaxKellermann Dec 22, 2022
e8a9f7c
ext/opcache/jit: eliminate duplicate ZEND_FUNC_INFO() call
MaxKellermann Dec 22, 2022
865ff49
ext/opcache/jit/zend_jit_internal: convert ZEND_OP_TRACE_INFO() to fu…
MaxKellermann Dec 22, 2022
2211034
ext/opcache/jit/zend_jit_trace: remove pointless variable assignments
MaxKellermann Dec 22, 2022
e96f55f
ext/opcache/jit/zend_jit_internal: add ZEND_OP_TRACE_INFO_OFFSET()
MaxKellermann Dec 22, 2022
0a59bdc
ext/opcache/jit/zend_jit_trace: copy offset to local variable
MaxKellermann Dec 22, 2022
39b092b
ext/opcache/jit/zend_jit_internal: add ZEND_OP_TRACE_INFO2()
MaxKellermann Dec 22, 2022
ff74acc
ext/opcache/jit/zend_jit_trace: do not reset stack_map of unallocated…
MaxKellermann Dec 22, 2022
6eb0745
ext/opcache/jit/zend_jit_trace: fix memory leak in _compile_root_trace()
MaxKellermann Dec 21, 2022
b83ab47
ext/opcache/zend_shared_alloc: add zend_shared_alloc_copy()
MaxKellermann Dec 21, 2022
4dd445c
ext/opcache/jit/zend_jit_trace: move code to _zend_jit_compile_root_t…
MaxKellermann Dec 22, 2022
9b6b07e
ext/opcache/jit/zend_jit_trace: move code to _zend_jit_compile_side_t…
MaxKellermann Dec 22, 2022
751cd30
ext/opcache/jit/zend_jit: declare variables where they are used (C99)
MaxKellermann Dec 23, 2022
3b265fb
Zend/Optimizer: make pointers const
MaxKellermann Jan 2, 2023
94af4da
ext/opcache/jit/zend_jit_trace: declare variables where they are used…
MaxKellermann Dec 23, 2022
5a5ba9d
ext/opcache/jit/zend_jit_vm_helpers: declare variables where they are…
MaxKellermann Jan 2, 2023
afa8f84
ext/opcache/jit/zend_jit_{x86,arm64}: declare variables where they ar…
MaxKellermann Jan 2, 2023
3f28de6
ext/opcache/jit/trace: split zend_jit_trace_frame_size()
MaxKellermann Jan 2, 2023
3333ab9
ext/opcache/jit/internal: add zend_jit_op_array_trace_ssa()
MaxKellermann Jan 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
845 changes: 397 additions & 448 deletions ext/opcache/jit/zend_jit.c

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions ext/opcache/jit/zend_jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ typedef struct _zend_jit_globals {

zend_sym_node *symbols; /* symbols for disassembler */

/**
* True while zend_jit_trace_execute() runs, to avoid
* recursively calling it twice.
*/
bool tracing;

zend_jit_trace_rec *current_trace;
Expand All @@ -140,10 +144,36 @@ extern int jit_globals_id;
extern zend_jit_globals jit_globals;
#endif

/**
* Activate the JIT on the given #zend_op_array.
*
* @return SUCCESS or FAILURE
*/
ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script);

/**
* Activate the JIT on the given #zend_script.
*
* @return SUCCESS or FAILURE
*/
ZEND_EXT_API int zend_jit_script(zend_script *script);

/**
* Make the JIT machine code area (i.e. #dasm_buf) writable (but not
* executable). Call this before generating new machine code. Call
* zend_jit_protect() when done.
*
* (These write/execute permissions affect only the current process.)
*/
ZEND_EXT_API void zend_jit_unprotect(void);

/**
* Make the JIT machine code area (i.e. #dasm_buf) executable (but not
* writable). Call this after generating new machine code to undo the
* effect of zend_jit_unprotect().
*/
ZEND_EXT_API void zend_jit_protect(void);

ZEND_EXT_API void zend_jit_init(void);
ZEND_EXT_API int zend_jit_config(zend_string *jit_options, int stage);
ZEND_EXT_API int zend_jit_debug_config(zend_long old_val, zend_long new_val, int stage);
Expand Down
Loading