brazdil / dexter

1 stars 1 forks source link

MONITOR_EXIT instruction has slightly unusual throwing semantics #14

Closed brazdil closed 11 years ago

brazdil commented 11 years ago

_Description of MONITOREXIT:

Release the monitor for the indicated object. Note: If this instruction needs to throw an exception, it must do so as if the pc has already advanced past the instruction. It may be useful to think of this as the instruction successfully executing (in a sense), and the exception getting thrown after the instruction but before the next one gets a chance to run. This definition makes it possible for a method to use a monitor cleanup catch-all (e.g., finally) block as the monitor cleanup for that block itself, as a way to handle the arbitrary exceptions that might get thrown due to the historical implementation of Thread.stop(), while still managing to have proper monitor hygiene.

(from http://www.netmite.com/android/mydroid/dalvik/docs/dalvik-bytecode.html)

brazdil commented 11 years ago

Shouldn't be a problem considering the instruction only references the register