Skip to content
Open
Changes from all commits
Commits
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
48 changes: 33 additions & 15 deletions ext/opcache/jit/zend_jit_vm_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,20 +613,38 @@ static int zend_jit_trace_subtrace(zend_jit_trace_rec *trace_buffer, int start,
* Trace Linking Rules
* ===================
*
* flags
* +----------+----------+----------++----------+----------+----------+
* | || JIT |
* +----------+----------+----------++----------+----------+----------+
* start | LOOP | ENTER | RETURN || LOOP | ENTER | RETURN |
* +========+==========+==========+==========++==========+==========+==========+
* | LOOP | loop | | loop-ret || COMPILED | LINK | LINK |
* +--------+----------+----------+----------++----------+----------+----------+
* | ENTER |INNER_LOOP| rec-call | return || LINK | LINK | LINK |
* +--------+----------+----------+----------++----------+----------+----------+
* | RETURN |INNER_LOOP| | rec-ret || LINK | | LINK |
* +--------+----------+----------+----------++----------+----------+----------+
* | SIDE | unroll | | side-ret || LINK | LINK | LINK |
* +--------+----------+----------+----------++----------+----------+----------+
* We consider the start flags of the current trace, as well as the trace flags
* of the opline to be recorded.
*
* opline trace flags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this more of an event, rather than flags? E.g. we check execute_data->prev_execute_data == prev_execute_data to see whether we have entered a function.

* +----------+----------+----------+
* | LOOP | ENTER | RETURN |
* +========+==========+==========+==========+
* | LOOP | loop | | loop-ret |
* +--------+----------+----------+----------+
* | ENTER |INNER_LOOP| rec-call | return |
* start +--------+----------+----------+----------+
* flags | RETURN |INNER_LOOP| | rec-ret |
* +--------+----------+----------+----------+
* | SIDE | unroll | | side-ret |
* +--------+----------+----------+----------+
*
* When opline to be recorded is JIT'ed:
*
* opline trace flags
* +----------+----------+----------+
* | LOOP | ENTER | RETURN |
* +========+==========+==========+==========+
* | LOOP | COMPILED | LINK | LINK |
* +--------+----------+----------+----------+
* | ENTER | LINK | LINK | LINK |
* start +--------+----------+----------+----------+
* flags | RETURN | LINK | | LINK |
* +--------+----------+----------+----------+
* | SIDE | LINK | LINK | LINK |
* +--------+----------+----------+----------+
*
*
*
* loop: LOOP if "cycle" and level == 0, otherwise INNER_LOOP
* INNER_LOOP: abort recording and start new one (wait for loop)
Expand All @@ -637,7 +655,7 @@ static int zend_jit_trace_subtrace(zend_jit_trace_rec *trace_buffer, int start,
* return: RETURN if level == 0
* rec_ret: RECURSIVE_RET if "cycle" and ret_level > N, otherwise continue
* side_ret: RETURN if level == 0 && ret_level == ret_depth, otherwise continue
*
* LINK: stop recording. End of new trace jumps to the other one.
*/

zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
Expand Down