From fb1c2c905ea38b19f43e267cd45a15e546b69288 Mon Sep 17 00:00:00 2001 From: Fred Shih Date: Wed, 25 Jun 2014 15:58:00 -0700 Subject: Moved slow path flag to Reference class Added static field in Reference class to hold slow path flag and added benchmark to test Reference.get() performance. Change-Id: I13ad65a356fe4e104d8d83980694dc2740d7d039 --- libart/src/main/java/java/lang/ref/Reference.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libart') diff --git a/libart/src/main/java/java/lang/ref/Reference.java b/libart/src/main/java/java/lang/ref/Reference.java index 3b03ff1..31ea588 100644 --- a/libart/src/main/java/java/lang/ref/Reference.java +++ b/libart/src/main/java/java/lang/ref/Reference.java @@ -98,6 +98,22 @@ package java.lang.ref; public abstract class Reference { /** + * Forces JNI path. + * If GC is not in progress (ie: not going through slow path), the referent + * can be quickly returned through intrinsic without passing through JNI. + * This flag forces the JNI path so that it can be tested and benchmarked. + */ + private static boolean disableIntrinsic = false; + + /** + * Slow path flag for the reference processor. + * Used by the reference processor to determine whether or not the referent + * can be immediately returned. Because the referent might get swept during + * GC, the slow path, which passes through JNI, must be taken. + */ + private static boolean slowPathEnabled = false; + + /** * The object to which this reference refers. * VM requirement: this field must be called "referent" * and be an object. -- cgit v1.1