Skip to content

Restructure argument passing onto stack - #1679

Closed
bwoebi wants to merge 7 commits into
php:masterfrom
bwoebi:vm_stack_restructuring
Closed

Restructure argument passing onto stack#1679
bwoebi wants to merge 7 commits into
php:masterfrom
bwoebi:vm_stack_restructuring

Conversation

@bwoebi

Copy link
Copy Markdown
Member

Arguments now are prepended to the execute_data, inside the (last!) temporaries of the previous stack frame. Every stack frame has place for sent arguments plus five optional args (RECV_INIT...) and the execute_data.
This allows EG(vm_stack_top) and EX(call) to be removed and saves us from expensive comparisons to push a call frame completely in some cases (every ICALL).
The only downside is that arguments now are in reverse order causing variadics to be in reverse order on the stack; extensions might need some update ...
Also, freeing of args and execute_data is now completely handled by liveness.
Finally, the patch gives 0.5%-3% improvement on applications.

There likely is still some room for optimization (e.g. eliminating ZEND_SEND_VAL with TMPs or speeding up the unpacking, removing INIT_FCALL for UCALLs, ...).

Comment threadZend/zend_API.c

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should remove deprecated API by separate commit: zend_get_parameters(), zend_get_parameters_ex(), zend_copy_parameters_array().

@dstogov

Copy link
Copy Markdown
Member

The patch is too big for github. zend_vm_def.h changes don't fit :(

@bwoebi
bwoebiforce-pushed the vm_stack_restructuring branch from ea9ee86 to 8210746CompareDecember 16, 2015 20:31
Arguments now are prepended to the execute_data, inside the (last!) temporaries of the previous stack frame. Every stack frame has place for sent arguments plus five optional args (RECV_INIT...) and the execute_data.
This allows EG(vm_stack_top) and EX(call) to be removed and saves us from expensive comparisons to push a call frame completely in some cases (every ICALL).
The only downside is that arguments now are in reverse order causing variadics to be in reverse order on the stack; extensions might need some update ...
Also, freeing of args and execute_data is now completely handled by liveness.
Finally, the patch gives 0.5%-3% improvement on applications.
There likely is still some room for optimization (e.g. eliminating ZEND_SEND_VAL with TMPs or speeding up the unpacking, removing INIT_FCALL for UCALLs, ...).
@bwoebi
bwoebiforce-pushed the vm_stack_restructuring branch from 8210746 to 89c2585CompareDecember 16, 2015 20:56
dstogovand others added 4 commits December 17, 2015 14:17
* master:
Fixed incorrect exception handling
Align NEWS entry format
Align NEWS entry format
Align news entry format: Implement FR -> Implemented FR
Align news entry format: Implement FR -> Implemented FR
Update NEWs
Fixed bug #71127 (Define in auto_prepend_file is overwrite)
Fix proto and arg info
Implemented FR #48532 (Allow pg_fetch_all() to index numerically).
Implemented FR #31021 (pg_result_notice() is needed to get all notice messages).
Remove sqlite extension leftover references (was removed in PHP 5.4)
Fix ZTS build
Fix naming
@bwoebi
bwoebiforce-pushed the vm_stack_restructuring branch from c9f6738 to 98d9614CompareDecember 22, 2015 20:56
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@bwoebi@dstogov@nikic@jpauli