-
Notifications
You must be signed in to change notification settings - Fork 964
Description
[reporter="j.bachorik", created="Mon, 21 Jul 2014 13:05:21 +0200"]
When a method is instrumented with multiple overlapping Kind.CALL handlers the injected code is far from optimal. For each handler all the values currently on the stack will be backed up to local variables before calling the actual handler code and restored afterwards.
Eg. in a situation when 2 handlers are matching a certain method call we would get:
backup_stack(1) -> stores the values from stack in local variables
reload_required_vals(1) -> reloads the values accessed from the handler
call_handler(1)
restore_stack(1) -> copies the values from the new local variables on to stack
backup_stack(2) -> stores the values from stack in local variables again
reload_required_vals(2) -> reloads the values accessed from the handler
call_handler(2)
restore_stack(2) -> copies the values from the new local variables on to stack
Ideally, this situation should be recognized and only one backup set of the stack values should be used