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

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

Merge some VarHandle static initializer blocks

Flag: EXEMPT refactor
Change-Id: Iea30cc984b8aa5199d9c84b2cd8030288d680ccc
parent c928459d
Loading
Loading
Loading
Loading
+7 −23
Original line number Diff line number Diff line
@@ -2611,16 +2611,6 @@ public final class MessageQueue {

    /* This is the top of our treiber stack. */
    private static final VarHandle sState;
    static {
        try {
            MethodHandles.Lookup l = MethodHandles.lookup();
            sState = l.findVarHandle(MessageQueue.class, "mStateValue",
                    MessageQueue.StackNode.class);
        } catch (Exception e) {
            Log.wtf(TAG_C, "VarHandle lookup failed with exception: " + e);
            throw new ExceptionInInitializerError(e);
        }
    }

    private volatile StackNode mStateValue = sStackStateParked;
    private final ConcurrentSkipListSet<MessageNode> mPriorityQueue =
@@ -2642,19 +2632,6 @@ public final class MessageQueue {
     */
    private static final VarHandle sNextFrontInsertSeq;
    private volatile long mNextFrontInsertSeqValue = -1;
    static {
        try {
            MethodHandles.Lookup l = MethodHandles.lookup();
            sNextInsertSeq = l.findVarHandle(MessageQueue.class, "mNextInsertSeqValue",
                    long.class);
            sNextFrontInsertSeq = l.findVarHandle(MessageQueue.class, "mNextFrontInsertSeqValue",
                    long.class);
        } catch (Exception e) {
            Log.wtf(TAG_C, "VarHandle lookup failed with exception: " + e);
            throw new ExceptionInInitializerError(e);
        }

    }

    /*
     * Combine our quitting state with a ref count of access to mPtr.
@@ -2665,9 +2642,16 @@ public final class MessageQueue {
     */
    private static VarHandle sQuittingRefCount;
    private volatile long mQuittingRefCountValue = 0;

    static {
        try {
            MethodHandles.Lookup l = MethodHandles.lookup();
            sState = l.findVarHandle(MessageQueue.class, "mStateValue",
                    MessageQueue.StackNode.class);
            sNextInsertSeq = l.findVarHandle(MessageQueue.class, "mNextInsertSeqValue",
                    long.class);
            sNextFrontInsertSeq = l.findVarHandle(MessageQueue.class, "mNextFrontInsertSeqValue",
                    long.class);
            sQuittingRefCount = l.findVarHandle(MessageQueue.class, "mQuittingRefCountValue",
                    long.class);
        } catch (Exception e) {
+7 −22
Original line number Diff line number Diff line
@@ -196,16 +196,6 @@ public final class MessageQueue {

    /* This is the top of our treiber stack. */
    private static final VarHandle sState;
    static {
        try {
            MethodHandles.Lookup l = MethodHandles.lookup();
            sState = l.findVarHandle(MessageQueue.class, "mStateValue",
                    MessageQueue.StackNode.class);
        } catch (Exception e) {
            Log.wtf(TAG, "VarHandle lookup failed with exception: " + e);
            throw new ExceptionInInitializerError(e);
        }
    }

    private volatile StackNode mStateValue = sStackStateParked;
    private final ConcurrentSkipListSet<MessageNode> mPriorityQueue =
@@ -227,18 +217,6 @@ public final class MessageQueue {
     */
    private static final VarHandle sNextFrontInsertSeq;
    private volatile long mNextFrontInsertSeqValue = -1;
    static {
        try {
            MethodHandles.Lookup l = MethodHandles.lookup();
            sNextInsertSeq = l.findVarHandle(MessageQueue.class, "mNextInsertSeqValue",
                    long.class);
            sNextFrontInsertSeq = l.findVarHandle(MessageQueue.class, "mNextFrontInsertSeqValue",
                    long.class);
        } catch (Exception e) {
            Log.wtf(TAG, "VarHandle lookup failed with exception: " + e);
            throw new ExceptionInInitializerError(e);
        }
    }

    /*
     * Combine our quitting state with a ref count of access to mPtr.
@@ -249,9 +227,16 @@ public final class MessageQueue {
     */
    private static VarHandle sQuittingRefCount;
    private volatile long mQuittingRefCountValue = 0;

    static {
        try {
            MethodHandles.Lookup l = MethodHandles.lookup();
            sState = l.findVarHandle(MessageQueue.class, "mStateValue",
                    MessageQueue.StackNode.class);
            sNextInsertSeq = l.findVarHandle(MessageQueue.class, "mNextInsertSeqValue",
                    long.class);
            sNextFrontInsertSeq = l.findVarHandle(MessageQueue.class, "mNextFrontInsertSeqValue",
                    long.class);
            sQuittingRefCount = l.findVarHandle(MessageQueue.class, "mQuittingRefCountValue",
                    long.class);
        } catch (Exception e) {