Leaving the stack frame

Will Morton <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
I'm teaching myself ASM by writing a little utility that catches
thread deadlock scenarios before they happen.  The idea is that each
class containing synchronized blocks/methods is annotated with
@SyncPriority(int priority), with a runtime instrumenter that monitors
syncs and throws exceptions if high-priority syncs get called inside
low-priority ones.

For entering synchronized areas this looks fairly simple.   For sync
blocks I can scan for MONITORENTER instructions and insert some calls
that look up the syncpriority annotation value and do the checks, and
add the same checks before synchronized method calls.

However, adding checks to threads leaving sync areas seems to be
tougher.  Normal execution flow is ok - I can add checks before
RETURNs in sync methods, and before MONITOREXIT instructions - but
exception handling is a problem - if an exception is thrown but not
caught inside a synchronized method/block, the jvm unwinds the stack
without calling RETURNS or MONITOREXITs (I think), meaning my checks
are not notified of leaving the sync.

Is there any way of inserting some code that is called reliably when a
stack frame is left via a thrown exception?

Many thanks

Will
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.