Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87306201 authored by Shai Barack's avatar Shai Barack
Browse files

Document why we use VarHandle directly rather than Atomics

Flag: EXEMPT comment
Change-Id: I11da825389066b0bcc4fa97f8999e745c6fb2b7b
parent 1ba8ea9b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2608,6 +2608,8 @@ public final class MessageQueue {
        private volatile boolean mRemovedFromStackValue;
        static {
            try {
                // We need to use VarHandle rather than java.util.concurrent.atomic.*
                // for performance reasons. See: b/421437036
                MethodHandles.Lookup l = MethodHandles.lookup();
                sRemovedFromStack = l.findVarHandle(MessageQueue.MessageNode.class,
                        "mRemovedFromStackValue", boolean.class);
@@ -2681,6 +2683,8 @@ public final class MessageQueue {

    static {
        try {
            // We need to use VarHandle rather than java.util.concurrent.atomic.*
            // for performance reasons. See: b/421437036
            MethodHandles.Lookup l = MethodHandles.lookup();
            sState = l.findVarHandle(MessageQueue.class, "mStateValue",
                    MessageQueue.StackNode.class);
@@ -2803,6 +2807,8 @@ public final class MessageQueue {
        private volatile long mCountsValue = 0;
        static {
            try {
                // We need to use VarHandle rather than java.util.concurrent.atomic.*
                // for performance reasons. See: b/421437036
                MethodHandles.Lookup l = MethodHandles.lookup();
                sCounts = l.findVarHandle(MessageQueue.MessageCounts.class, "mCountsValue",
                        long.class);