isMonitorEnterPrologue
protected static boolean isMonitorEnterPrologue(MethodInfo mi,
int insnIndex)
do a little bytecode pattern analysis on the fly, to find out if a
GETFIELD or GETSTATIC is just part of a "..synchronized (obj) {..} .."
pattern, which usually translates into the following pattern:
...
getfield / getstatic
dup
[astore]
monitorenter
...
If it does, there is no need to break the transition since the object
reference is not used for anything that can cause violations between
the get and the monitorenter.
<2do> We might want to extend this in the future to also cover sync on
local vars, like "Object o = myField; synchronized(o){..}..", but then
the check becomes more expensive since we get interspersed aload/astore
insns, and some of the locals could be used outside the sync block. Not
sure if it buys much on the bottom line
<2do> this relies on javac code patterns. The dup/astore could
lead to subsequent use of the object reference w/o corresponding get/putfield
insns (if it's not a volatile), but this access would be either a call
or a get/putfield on a share object, i.e. would be checked separately