-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Pass opline as argument to opcode handlers in CALL VM #17952
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
Closed
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
89f0186
Pass opline via op handler args
arnaud-lb 4c40e69
Move extra vm helper parameters after standard ones
arnaud-lb 5f188dc
Improve reproducibility
arnaud-lb 11e34f6
Update JIT for new op handler signature (wip)
arnaud-lb de98f4c
Return -1 to signal execute_data reloading
arnaud-lb de5d147
Revert "Return -1 to signal execute_data reloading"
arnaud-lb 9b79cd0
Use indempotent operation to signal execute_data reloading
arnaud-lb edfe12b
Save registers in generated code
arnaud-lb a1198d3
Force reload execute_data when returning from exception
arnaud-lb 249daf8
Cleanup
arnaud-lb 01e9fab
ZEND_VM_ENTER_BIT
arnaud-lb b26c402
GCC build fix
arnaud-lb bd41680
Generated file
arnaud-lb aad09ec
Build fix
arnaud-lb a79c90e
Define CHAR_BITS
arnaud-lb da98b66
Support platforms in which user space addresses may have the higher b…
arnaud-lb 2499f1a
Update zend_vm_call_opcode_handler()
arnaud-lb b1894a3
Fix zend_runtime_jit(): Return the original opline
arnaud-lb a741f06
run-tests.php: Save stdin section to a file
arnaud-lb 66e912d
Rename ZEND_OPCODE_HANDLER_ARGS_DC / ZEND_OPCODE_HANDLER_ARGS_PASSTHR…
arnaud-lb f63cefc
Fix build
arnaud-lb 135b40f
Fix windows build
arnaud-lb 96e8203
Fix after rebase
arnaud-lb 70fb7cd
Fix zend_jit_leave_func
arnaud-lb 43bcb3a
Remove zend_jit_set_ip_ex
arnaud-lb a9a1625
Re-add/update comments
arnaud-lb a4b8ffa
Update zend_jit_trace_handler
arnaud-lb 8c610df
Update zend_jit_trace_execute
arnaud-lb 5a2031b
Fix Zend/tests/bug70689.phpt
arnaud-lb e63cd0d
Fix x32
arnaud-lb 978a379
Allow to disable ZEND_HIGH_HALF_KERNEL
arnaud-lb 520bb05
Remove jit_LOAD_IP()
arnaud-lb 36f6b15
Update zend_jit_copy_extra_args_helper_ex
arnaud-lb 0c61a86
Remove the ZEND_HIGH_HALF_KERNEL alternative
arnaud-lb c4a0d57
Truly revert change
arnaud-lb 12c4ff5
Revert run-tests.php changes
arnaud-lb 4ce43ed
Unnecessary change
arnaud-lb b85a4a3
Fix comment
arnaud-lb f0a9003
Generated file
arnaud-lb b83b50b
Mark test xfail
arnaud-lb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ static const void *zend_jit_func_trace_counter_handler = NULL; | |
static const void *zend_jit_ret_trace_counter_handler = NULL; | ||
static const void *zend_jit_loop_trace_counter_handler = NULL; | ||
|
||
static int ZEND_FASTCALL zend_runtime_jit(void); | ||
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_runtime_jit(ZEND_OPCODE_HANDLER_ARGS); | ||
|
||
static int zend_jit_trace_op_len(const zend_op *opline); | ||
static int zend_jit_trace_may_exit(const zend_op_array *op_array, const zend_op *opline); | ||
|
@@ -2871,7 +2871,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op | |
if (GCC_GLOBAL_REGS) { | ||
ir_TAILCALL(IR_VOID, ir_LOAD_A(jit_IP(jit))); | ||
} else { | ||
ir_RETURN(ir_CONST_I32(1)); /* ZEND_VM_ENTER */ | ||
zend_jit_vm_enter(jit, jit_IP(jit)); | ||
} | ||
ir_IF_TRUE(if_hook_enter); | ||
} | ||
|
@@ -3074,11 +3074,18 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons | |
} | ||
|
||
/* Run-time JIT handler */ | ||
static int ZEND_FASTCALL zend_runtime_jit(void) | ||
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_runtime_jit(ZEND_OPCODE_HANDLER_ARGS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ops. It looks like the previous prototype was wrong. |
||
{ | ||
zend_execute_data *execute_data = EG(current_execute_data); | ||
#if GCC_GLOBAL_REGS | ||
zend_execute_data *execute_data; | ||
zend_op *opline; | ||
#else | ||
const zend_op *orig_opline = opline; | ||
#endif | ||
|
||
execute_data = EG(current_execute_data); | ||
zend_op_array *op_array = &EX(func)->op_array; | ||
zend_op *opline = op_array->opcodes; | ||
opline = op_array->opcodes; | ||
zend_jit_op_array_extension *jit_extension; | ||
bool do_bailout = 0; | ||
|
||
|
@@ -3097,7 +3104,7 @@ static int ZEND_FASTCALL zend_runtime_jit(void) | |
} | ||
} | ||
jit_extension = (zend_jit_op_array_extension*)ZEND_FUNC_INFO(op_array); | ||
opline->handler = jit_extension->orig_handler; | ||
((zend_op*)opline)->handler = jit_extension->orig_handler; | ||
|
||
/* perform real JIT for this function */ | ||
zend_real_jit_func(op_array, NULL, NULL, ZEND_JIT_ON_FIRST_EXEC); | ||
|
@@ -3116,7 +3123,11 @@ static int ZEND_FASTCALL zend_runtime_jit(void) | |
} | ||
|
||
/* JIT-ed code is going to be called by VM */ | ||
return 0; | ||
#if GCC_GLOBAL_REGS | ||
return; // ZEND_VM_CONTINUE | ||
#else | ||
return orig_opline; // ZEND_VM_CONTINUE | ||
#endif | ||
} | ||
|
||
void zend_jit_check_funcs(HashTable *function_table, bool is_method) { | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes
EX(opline) = opline
whenZEND_VM_IP_GLOBAL_REG
is defined.This may cause output of incorrect line number in error message.
May be I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's correct.
This causes
opline
to be saved toEX(opline)
in the CALL VM (and in the HYBRID VM, as before). Saving used to be unnecessary asEX(opline)
was always up to date in the CALL VM. I believe that the#ifdef
is redundant asSAVE_OPLINE()
was a no-op on the CALL VM.