3f64a024dec2c080b9abde74502826b29263152a |
|
13-Nov-2010 |
Andy McFadden <fadden@android.com> |
Check monitors during bytecode verification This adds tracking of monitor-enter and monitor-exit instructions to the bytecode verifier. The idea is to guarantee that all lock operations in a method are paired with unlock operations, whether the method completes normally or abnormally. Because of an issue in "dx", the code only verifies that the operation stack has the right size at all times. We do not yet confirm that the correct monitor is being unlocked by monitor-exit (the code is present but ifdefed out). Also, when monitor verification is enabled, we do not add the "can throw" path from monitor-exit to the work list, potentially causing some "dead code" warnings. (Not coincidentally, "dead code" checking is now only enabled in libdvm_assert.so.) Overall increase in bootstrap verification time is about 9%, dropping to 6% when the new checks are disabled. The feature is currently disabled by default. -Xverifyopt:checkmon enables it. Bug 2534655 Change-Id: I0eac54ce2623fb1d48cc80889fcdb4fd69de3231
|