Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
424f0b6
Partial named params implementation
nikic Apr 6, 2020
4afe5b4
Check for duplicate parameter names in internal functions
nikic Jul 24, 2020
a8e7462
Add AST export support
nikic Jul 27, 2020
8b14583
Fix test name
nikic Jul 27, 2020
75964c0
Add tests for Attribut(flags: )
nikic Jul 27, 2020
e550f4a
Only check for undef in RECV(_INIT)
nikic Jul 27, 2020
d346bbd
Check for undef in recv jit
nikic Jul 27, 2020
8bdd1a9
Add flag to distinguish named fcalls
nikic Jul 27, 2020
883c0a5
SEND may throw for named params
nikic Jul 27, 2020
3683f0e
For unpacks, we should also assume there may be named args
nikic Jul 27, 2020
368500b
Free extra named args in jit
nikic Jul 27, 2020
d0492b1
Initialize icall undef args in jit
nikic Jul 27, 2020
bb79eed
Always emit type check in RECV_INIT
nikic Jul 28, 2020
268b69c
Fix attribtue tests for new syntax
nikic Jul 28, 2020
fc37bc0
WIP
nikic Jul 30, 2020
5fddc6f
Fixes
nikic Jul 30, 2020
06a4ab7
Cleanup
nikic Jul 30, 2020
a46694c
jit
nikic Jul 30, 2020
1aec287
Fix windows?
nikic Jul 30, 2020
a164e5d
Rename opcode to be more precise
nikic Jul 30, 2020
90dac08
Make flag meaning more precise
nikic Jul 31, 2020
a9a0252
Make compiler code a bit smarter
nikic Jul 31, 2020
2700037
Move function back to where it was
nikic Jul 31, 2020
0f9131e
Rename function to match opcode name
nikic Jul 31, 2020
141ded0
jit cleanup
nikic Jul 31, 2020
077886d
Support extra named params in backtraces
nikic Jul 31, 2020
3e45549
Prepare for extra named params reuse
nikic Jul 31, 2020
e77c2b6
Reuse extra_named_params if possible
nikic Jul 31, 2020
e31838a
Combine check for extra named params and allocated call
nikic Jul 31, 2020
ed108d4
Drop one of the free extra named params helpers
nikic Jul 31, 2020
a6b566d
Revert an incorrect change
nikic Jul 31, 2020
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
Prev Previous commit
Next Next commit
Initialize icall undef args in jit
  • Loading branch information
nikic committed Jul 31, 2020
commit d0492b18061ebc210a3cd8051b15a4cd3bd5b15c
2 changes: 1 addition & 1 deletion Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -4439,7 +4439,7 @@ zval * ZEND_FASTCALL zend_handle_named_arg(
return arg;
}

static int zend_handle_icall_undef_args(zend_execute_data *call) {
ZEND_API int ZEND_FASTCALL zend_handle_icall_undef_args(zend_execute_data *call) {
zend_function *fbc = call->func;
if (fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO) {
/* Magic function, let it deal with it. */
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data,
zval * ZEND_FASTCALL zend_handle_named_arg(
zend_execute_data **call_ptr, zend_string *arg_name,
uint32_t *arg_num_ptr, void **cache_slot);
ZEND_API int ZEND_FASTCALL zend_handle_icall_undef_args(zend_execute_data *call);

#define CACHE_ADDR(num) \
((void**)((char*)EX(run_time_cache) + (num)))
Expand Down
22 changes: 18 additions & 4 deletions ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -8995,6 +8995,23 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
}
}

| // EG(current_execute_data) = execute_data;
| MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1

if (may_have_named_args) {
Copy link
Member

Choose a reason for hiding this comment

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

we should also check if ZEND_CALL_MAY_HAVE_UNDEF may be set.
If all arguments are passed, we don't have to emit the following code.

| test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 3], (ZEND_CALL_MAY_HAVE_UNDEF >> 24)
| jnz >1
|.cold_code
|1:
| mov FCARG1a, RX
| EXT_CALL zend_handle_icall_undef_args, r0
| jnz ->exception_handler
| mov r0, EX:RX->func // reload
| jmp >2
|.code
|2:
}

if (!RETURN_VALUE_USED(opline)) {
|.if not(X64WIN)
| sub r4, 16 /* alloca() */
Expand All @@ -9005,9 +9022,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
| LOAD_ZVAL_ADDR FCARG2a, res_addr
| SET_Z_TYPE_INFO FCARG2a, IS_NULL

| // EG(current_execute_data) = execute_data;
| MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1

zend_jit_reset_opline(Dst, NULL);

| // fbc->internal_function.handler(call, ret);
Expand All @@ -9034,8 +9048,8 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
if (may_have_named_args) {
| test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 3], (ZEND_CALL_HAS_EXTRA_NAMED_PARAMS >> 24)
| jnz >1
|1:
|.cold_code
|1:
| mov FCARG1a, aword [RX + offsetof(zend_execute_data, extra_named_params)]
| EXT_CALL zend_array_destroy, r0
| jmp >2
Expand Down