[jboss-svn-commits] JBL Code SVN: r28919 - labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/adapter/cfg.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 12 05:02:43 EDT 2009
Author: adinn
Date: 2009-08-12 05:02:43 -0400 (Wed, 12 Aug 2009)
New Revision: 28919
Modified:
labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/adapter/cfg/CFG.java
Log:
corrected monitor lock object lookup to skip over injected trigger sequences - fixes BYTEMAN-22
Modified: labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/adapter/cfg/CFG.java
===================================================================
--- labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/adapter/cfg/CFG.java 2009-08-12 06:58:00 UTC (rev 28918)
+++ labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/adapter/cfg/CFG.java 2009-08-12 09:02:43 UTC (rev 28919)
@@ -647,11 +647,25 @@
if (instruction != Opcodes.MONITORENTER) {
System.out.println("getSavedMonitorIdx : unexpected! close pair instruction " + instruction + " is not MONITOREXIT");
}
- instruction = block.getInstruction(instructionIdx - 1);
+ instructionIdx--;
+ instruction = block.getInstruction(instructionIdx );
+ // normally the monitorenter is preceded by a DUP ASTORE pair to save the monitor object
+ // however, if an AT SYNCHRONIZE trigger has been injected before the MONITORENTER then
+ // there may be a call to Rule.execute between the ASTORE and the MONITORENTER
+ if (instruction == Opcodes.INVOKESTATIC) {
+ // we can safely skip backwards to the last ASTORE because the trigger sequence will not
+ // use an ASTORE
+ while (instruction != Opcodes.ASTORE && instructionIdx > 0) {
+ // skip backwards until we find the required ASTORE
+ instructionIdx--;
+ instruction = block.getInstruction(instructionIdx);
+ }
+ }
if (instruction != Opcodes.ASTORE) {
System.out.println("getSavedMonitorIdx : unexpected! close pair preceding instruction " + instruction + " is not ASTORE");
+ return -1;
}
- int varIdx = block.getInstructionArg(instructionIdx - 1, 0);
+ int varIdx = block.getInstructionArg(instructionIdx, 0);
if (varIdx < 0) {
System.out.println("getSavedMonitorIdx : unexpected! close pair preceding ASTORE instruction has invalid index " + varIdx);
}
More information about the jboss-svn-commits
mailing list