summaryrefslogtreecommitdiffstats
path: root/vm/analysis/CodeVerify.h
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2010-11-12 16:55:21 -0800
committerAndy McFadden <fadden@android.com>2010-11-23 13:00:21 -0800
commit3f64a024dec2c080b9abde74502826b29263152a (patch)
treeed1f1c0a17a138c1d1c27f3fbd36deb97652cc59 /vm/analysis/CodeVerify.h
parent5016966b91f1bc36b2bd52ec13ecfd8de1c68209 (diff)
downloadandroid_dalvik-3f64a024dec2c080b9abde74502826b29263152a.tar.gz
android_dalvik-3f64a024dec2c080b9abde74502826b29263152a.tar.bz2
android_dalvik-3f64a024dec2c080b9abde74502826b29263152a.zip
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
Diffstat (limited to 'vm/analysis/CodeVerify.h')
-rw-r--r--vm/analysis/CodeVerify.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/vm/analysis/CodeVerify.h b/vm/analysis/CodeVerify.h
index 8069d092c..be7231c8b 100644
--- a/vm/analysis/CodeVerify.h
+++ b/vm/analysis/CodeVerify.h
@@ -181,6 +181,12 @@ typedef struct VerifierData {
* in GC points.
*/
RegisterLine* registerLines;
+
+ /*
+ * The number of occurrences of specific opcodes.
+ */
+ size_t newInstanceCount;
+ size_t monitorEnterCount;
} VerifierData;