I finally found the problem why the boolean $$$oldThread$$$
flag wasn’t sticking: I seemed to set it to false
, but the next time I looked at it, it was true
again.
The Java code basically is this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public static synchronized void compactWait(long code, long tid) { if (!_replaying) { return; } monitorEnter(_waitAlgoObj); if (isOldThread()) { // If this is NOT the first sync point for this thread... ... } else { // Otherwise, if it was the first time... set flag. setOldThread(); ... } // More code... ... |
monitorEnter()
, isOldThread()
and setOldThread()
are dummy marker methods and get replaced with bytecode during instrumentation:
monitorEnter()
becomes just a
GeSHi Error: GeSHi could not find the language jvm (using path /home/dh_8dhf9b/concurrentaffair.org/wp-content/plugins/codecolorer/lib/geshi/) (code 2)isOldThread()
becomes
GeSHi Error: GeSHi could not find the language jvm (using path /home/dh_8dhf9b/concurrentaffair.org/wp-content/plugins/codecolorer/lib/geshi/) (code 2)setOldThread()
becomes
GeSHi Error: GeSHi could not find the language jvm (using path /home/dh_8dhf9b/concurrentaffair.org/wp-content/plugins/codecolorer/lib/geshi/) (code 2)
The Java code above roughly corresponds to this bytecode:
GeSHi Error: GeSHi could not find the language jvm (using path /home/dh_8dhf9b/concurrentaffair.org/wp-content/plugins/codecolorer/lib/geshi/) (code 2)
My faulty instrumentation of the marker methods, however, generated this bytecode:
GeSHi Error: GeSHi could not find the language jvm (using path /home/dh_8dhf9b/concurrentaffair.org/wp-content/plugins/codecolorer/lib/geshi/) (code 2)
I was inserting the correct bytecode, but I was modifying call targets it in a way such that calls to the insertion location would go to the opcode just PAST the inserted code, whereas it should have gone right TO the inserted code. Now I can move on and face new, exciting problems