All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.lang.invoke.VarHandleFloats Maven / Gradle / Ivy

There is a newer version: 17.alpha.0.57
Show newest version
/*
 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package java.lang.invoke;

import jdk.internal.util.Preconditions;
import jdk.internal.vm.annotation.ForceInline;

import java.lang.invoke.VarHandle.VarHandleDesc;
import java.util.Objects;
import java.util.Optional;

import org.qbicc.rt.annotation.Tracking;

import static java.lang.invoke.MethodHandleStatics.UNSAFE;

// -- This file was mechanically generated: Do not edit! -- //

@Tracking("src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template")
final class VarHandleFloats {

    static class FieldInstanceReadOnly extends VarHandle {
        final long fieldOffset;
        final Class receiverType;

        FieldInstanceReadOnly(Class receiverType, long fieldOffset) {
            this(receiverType, fieldOffset, FieldInstanceReadOnly.FORM, false);
        }

        protected FieldInstanceReadOnly(Class receiverType, long fieldOffset,
                                        VarForm form, boolean exact) {
            super(form, exact);
            this.fieldOffset = fieldOffset;
            this.receiverType = receiverType;
        }

        @Override
        public FieldInstanceReadOnly withInvokeExactBehavior() {
            return hasInvokeExactBehavior()
                ? this
                : new FieldInstanceReadOnly(receiverType, fieldOffset, vform, true);
        }

        @Override
        public FieldInstanceReadOnly withInvokeBehavior() {
            return !hasInvokeExactBehavior()
                ? this
                : new FieldInstanceReadOnly(receiverType, fieldOffset, vform, false);
        }

        @Override
        final MethodType accessModeTypeUncached(AccessType at) {
            return at.accessModeType(receiverType, float.class);
        }

        @Override
        public Optional describeConstable() {
            var receiverTypeRef = receiverType.describeConstable();
            var fieldTypeRef = float.class.describeConstable();
            if (!receiverTypeRef.isPresent() || !fieldTypeRef.isPresent())
                return Optional.empty();

            // Reflect on this VarHandle to extract the field name
            String name = VarHandles.getFieldFromReceiverAndOffset(
                receiverType, fieldOffset, float.class).getName();
            return Optional.of(VarHandleDesc.ofField(receiverTypeRef.get(), name, fieldTypeRef.get()));
        }

        @ForceInline
        static float get(VarHandle ob, Object holder) {
            FieldInstanceReadOnly handle = (FieldInstanceReadOnly)ob;
            return UNSAFE.getFloat(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                 handle.fieldOffset);
        }

        // @Override
        public float get(Object holder) {
            return UNSAFE.getFloat(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset);
        }

        @ForceInline
        static float getVolatile(VarHandle ob, Object holder) {
            FieldInstanceReadOnly handle = (FieldInstanceReadOnly)ob;
            return UNSAFE.getFloatVolatile(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                 handle.fieldOffset);
        }

        // @Override
        public float getVolatile(Object holder) {
            return UNSAFE.getFloatVolatile(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset);
        }

        @ForceInline
        static float getOpaque(VarHandle ob, Object holder) {
            FieldInstanceReadOnly handle = (FieldInstanceReadOnly)ob;
            return UNSAFE.getFloatOpaque(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                 handle.fieldOffset);
        }

        // @Override
        public float getOpaque(Object holder) {
            return UNSAFE.getFloatOpaque(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset);
        }

        @ForceInline
        static float getAcquire(VarHandle ob, Object holder) {
            FieldInstanceReadOnly handle = (FieldInstanceReadOnly)ob;
            return UNSAFE.getFloatAcquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                 handle.fieldOffset);
        }

        // @Override
        public float getAcquire(Object holder) {
            return UNSAFE.getFloatAcquire(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset);
        }

        static final VarForm FORM = new VarForm(FieldInstanceReadOnly.class, Object.class, float.class);
    }

    static final class FieldInstanceReadWrite extends FieldInstanceReadOnly {

        FieldInstanceReadWrite(Class receiverType, long fieldOffset) {
            this(receiverType, fieldOffset, false);
        }

        private FieldInstanceReadWrite(Class receiverType, long fieldOffset,
                                       boolean exact) {
            super(receiverType, fieldOffset, FieldInstanceReadWrite.FORM, exact);
        }

        @Override
        public FieldInstanceReadWrite withInvokeExactBehavior() {
            return hasInvokeExactBehavior()
                ? this
                : new FieldInstanceReadWrite(receiverType, fieldOffset, true);
        }

        @Override
        public FieldInstanceReadWrite withInvokeBehavior() {
            return !hasInvokeExactBehavior()
                ? this
                : new FieldInstanceReadWrite(receiverType, fieldOffset, false);
        }

        @ForceInline
        static void set(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            UNSAFE.putFloat(Objects.requireNonNull(handle.receiverType.cast(holder)),
                             handle.fieldOffset,
                             value);
        }

        // @Override
        public void set(Object holder, float value) {
            UNSAFE.putFloat(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset,
                             value);
        }

        @ForceInline
        static void setVolatile(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            UNSAFE.putFloatVolatile(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                     handle.fieldOffset,
                                     value);
        }

        // @Override
        public void setVolatile(Object holder, float value) {
            UNSAFE.putFloatVolatile(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset,
                                     value);
        }

        @ForceInline
        static void setOpaque(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            UNSAFE.putFloatOpaque(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                   handle.fieldOffset,
                                   value);
        }

        // @Override
        public void setOpaque(Object holder, float value) {
            UNSAFE.putFloatOpaque(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset,
                                   value);
        }

        @ForceInline
        static void setRelease(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            UNSAFE.putFloatRelease(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                    handle.fieldOffset,
                                    value);
        }

        // @Override
        public void setRelease(Object holder, float value) {
            UNSAFE.putFloatRelease(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset,
                                   value);
        }

        @ForceInline
        static boolean compareAndSet(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.compareAndSetFloat(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean compareAndSet(Object holder, float expected, float value) {
            return UNSAFE.compareAndSetFloat(Objects.requireNonNull(receiverType.cast(holder)),
                                              fieldOffset,
                                              expected,
                                              value);
        }

        @ForceInline
        static float compareAndExchange(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.compareAndExchangeFloat(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public float compareAndExchange(Object holder, float expected, float value) {
            return UNSAFE.compareAndExchangeFloat(Objects.requireNonNull(receiverType.cast(holder)),
                                               fieldOffset,
                                               expected,
                                               value);
        }

        @ForceInline
        static float compareAndExchangeAcquire(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.compareAndExchangeFloatAcquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public float compareAndExchangeAcquire(Object holder, float expected, float value) {
            return UNSAFE.compareAndExchangeFloatAcquire(Objects.requireNonNull(receiverType.cast(holder)),
                                               fieldOffset,
                                               expected,
                                               value);
        }

        @ForceInline
        static float compareAndExchangeRelease(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.compareAndExchangeFloatRelease(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public float compareAndExchangeRelease(Object holder, float expected, float value) {
            return UNSAFE.compareAndExchangeFloatRelease(Objects.requireNonNull(receiverType.cast(holder)),
                                                          fieldOffset,
                                                          expected,
                                                          value);
        }

        @ForceInline
        static boolean weakCompareAndSetPlain(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloatPlain(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSetPlain(Object holder, float expected, float value) {
            return UNSAFE.weakCompareAndSetFloatPlain(Objects.requireNonNull(receiverType.cast(holder)),
                                                       fieldOffset,
                                                       expected,
                                                       value);
        }

        @ForceInline
        static boolean weakCompareAndSet(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloat(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSet(Object holder, float expected, float value) {
            return UNSAFE.weakCompareAndSetFloat(Objects.requireNonNull(receiverType.cast(holder)),
                                                  fieldOffset,
                                                  expected,
                                                  value);
        }

        @ForceInline
        static boolean weakCompareAndSetAcquire(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloatAcquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSetAcquire(Object holder, float expected, float value) {
            return UNSAFE.weakCompareAndSetFloatAcquire(Objects.requireNonNull(receiverType.cast(holder)),
                                                         fieldOffset,
                                                         expected,
                                                         value);
        }

        @ForceInline
        static boolean weakCompareAndSetRelease(VarHandle ob, Object holder, float expected, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloatRelease(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSetRelease(Object holder, float expected, float value) {
            return UNSAFE.weakCompareAndSetFloatRelease(Objects.requireNonNull(receiverType.cast(holder)),
                                                         fieldOffset,
                                                         expected,
                                                         value);
        }

        @ForceInline
        static float getAndSet(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.getAndSetFloat(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                          handle.fieldOffset,
                                          value);
        }

        // @Override
        public float getAndSet(Object holder, float value) {
            return UNSAFE.getAndSetFloat(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset,
                                          value);
        }

        @ForceInline
        static float getAndSetAcquire(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.getAndSetFloatAcquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                          handle.fieldOffset,
                                          value);
        }

        // @Override
        public float getAndSetAcquire(Object holder, float value) {
            return UNSAFE.getAndSetFloatAcquire(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset,
                                                 value);
        }

        @ForceInline
        static float getAndSetRelease(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.getAndSetFloatRelease(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                          handle.fieldOffset,
                                          value);
        }

        // @Override
        public float getAndSetRelease(Object holder, float value) {
            return UNSAFE.getAndSetFloatRelease(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset,
                                          value);
        }

        @ForceInline
        static float getAndAdd(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.getAndAddFloat(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                       handle.fieldOffset,
                                       value);
        }

        // @Override
        public float getAndAdd(Object holder, float value) {
            return UNSAFE.getAndAddFloat(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset, value);
        }

        @ForceInline
        static float getAndAddAcquire(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.getAndAddFloatAcquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                       handle.fieldOffset,
                                       value);
        }

        // @Override
        public float getAndAddAcquire(Object holder, float value) {
            return UNSAFE.getAndAddFloatAcquire(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset, value);
        }

        @ForceInline
        static float getAndAddRelease(VarHandle ob, Object holder, float value) {
            FieldInstanceReadWrite handle = (FieldInstanceReadWrite)ob;
            return UNSAFE.getAndAddFloatRelease(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                       handle.fieldOffset,
                                       value);
        }

        // @Override
        public float getAndAddRelease(Object holder, float value) {
            return UNSAFE.getAndAddFloatRelease(Objects.requireNonNull(receiverType.cast(holder)), fieldOffset, value);
        }

        static final VarForm FORM = new VarForm(FieldInstanceReadWrite.class, Object.class, float.class);
    }


    static class FieldStaticReadOnly extends VarHandle {
        final Object base;
        final long fieldOffset;

        FieldStaticReadOnly(Object base, long fieldOffset) {
            this(base, fieldOffset, FieldStaticReadOnly.FORM, false);
        }

        protected FieldStaticReadOnly(Object base, long fieldOffset,
                                      VarForm form, boolean exact) {
            super(form, exact);
            this.base = base;
            this.fieldOffset = fieldOffset;
        }

        @Override
        public FieldStaticReadOnly withInvokeExactBehavior() {
            return hasInvokeExactBehavior()
                ? this
                : new FieldStaticReadOnly(base, fieldOffset, vform, true);
        }

        @Override
        public FieldStaticReadOnly withInvokeBehavior() {
            return !hasInvokeExactBehavior()
                ? this
                : new FieldStaticReadOnly(base, fieldOffset, vform, false);
        }

        @Override
        public Optional describeConstable() {
            var fieldTypeRef = float.class.describeConstable();
            if (!fieldTypeRef.isPresent())
                return Optional.empty();

            // Reflect on this VarHandle to extract the field name
            var staticField = VarHandles.getStaticFieldFromBaseAndOffset(
                base, fieldOffset, float.class);
            var receiverTypeRef = staticField.getDeclaringClass().describeConstable();
            if (!receiverTypeRef.isPresent())
                return Optional.empty();
            return Optional.of(VarHandleDesc.ofStaticField(receiverTypeRef.get(), staticField.getName(), fieldTypeRef.get()));
        }

        @Override
        final MethodType accessModeTypeUncached(AccessType at) {
            return at.accessModeType(null, float.class);
        }

        @ForceInline
        static float get(VarHandle ob) {
            FieldStaticReadOnly handle = (FieldStaticReadOnly)ob;
            return UNSAFE.getFloat(handle.base,
                                 handle.fieldOffset);
        }

        // @Override
        public float get() {
            return UNSAFE.getFloat(base, fieldOffset);
        }

        @ForceInline
        static float getVolatile(VarHandle ob) {
            FieldStaticReadOnly handle = (FieldStaticReadOnly)ob;
            return UNSAFE.getFloatVolatile(handle.base,
                                 handle.fieldOffset);
        }

        // @Override
        public float getVolatile() {
            return UNSAFE.getFloatVolatile(base, fieldOffset);
        }

        @ForceInline
        static float getOpaque(VarHandle ob) {
            FieldStaticReadOnly handle = (FieldStaticReadOnly)ob;
            return UNSAFE.getFloatOpaque(handle.base,
                                 handle.fieldOffset);
        }

        // @Override
        public float getOpaque() {
            return UNSAFE.getFloatOpaque(base, fieldOffset);
        }

        @ForceInline
        static float getAcquire(VarHandle ob) {
            FieldStaticReadOnly handle = (FieldStaticReadOnly)ob;
            return UNSAFE.getFloatAcquire(handle.base,
                                 handle.fieldOffset);
        }

        // @Override
        public float getAcquire() {
            return UNSAFE.getFloatAcquire(base, fieldOffset);
        }

        static final VarForm FORM = new VarForm(FieldStaticReadOnly.class, null, float.class);
    }

    static final class FieldStaticReadWrite extends FieldStaticReadOnly {

        FieldStaticReadWrite(Object base, long fieldOffset) {
            this(base, fieldOffset, false);
        }

        private FieldStaticReadWrite(Object base, long fieldOffset,
                                     boolean exact) {
            super(base, fieldOffset, FieldStaticReadWrite.FORM, exact);
        }

        @Override
        public FieldStaticReadWrite withInvokeExactBehavior() {
            return hasInvokeExactBehavior()
                ? this
                : new FieldStaticReadWrite(base, fieldOffset, true);
        }

        @Override
        public FieldStaticReadWrite withInvokeBehavior() {
            return !hasInvokeExactBehavior()
                ? this
                : new FieldStaticReadWrite(base, fieldOffset, false);
        }

        @ForceInline
        static void set(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            UNSAFE.putFloat(handle.base,
                             handle.fieldOffset,
                             value);
        }

        // @Override
        public void set(float value) {
            UNSAFE.putFloat(base, fieldOffset, value);
        }

        @ForceInline
        static void setVolatile(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            UNSAFE.putFloatVolatile(handle.base,
                                     handle.fieldOffset,
                                     value);
        }

        // @Override
        public void setVolatile(float value) {
            UNSAFE.putFloatVolatile(base, fieldOffset, value);
        }

        @ForceInline
        static void setOpaque(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            UNSAFE.putFloatOpaque(handle.base,
                                   handle.fieldOffset,
                                   value);
        }

        // @Override
        public void setOpaque(float value) {
            UNSAFE.putFloatOpaque(base, fieldOffset, value);
        }

        @ForceInline
        static void setRelease(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            UNSAFE.putFloatRelease(handle.base,
                                    handle.fieldOffset,
                                    value);
        }

        // @Override
        public void setRelease(float value) {
            UNSAFE.putFloatRelease(base, fieldOffset, value);
        }

        @ForceInline
        static boolean compareAndSet(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.compareAndSetFloat(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean compareAndSet(float expected, float value) {
            return UNSAFE.compareAndSetFloat(base, fieldOffset,
                                              expected,
                                              value);
        }

        @ForceInline
        static float compareAndExchange(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.compareAndExchangeFloat(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public float compareAndExchange(float expected, float value) {
            return UNSAFE.compareAndExchangeFloat(base, fieldOffset,
                                               expected,
                                               value);
        }

        @ForceInline
        static float compareAndExchangeAcquire(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.compareAndExchangeFloatAcquire(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public float compareAndExchangeAcquire(float expected, float value) {
            return UNSAFE.compareAndExchangeFloatAcquire(base, fieldOffset,
                                               expected,
                                               value);
        }

        @ForceInline
        static float compareAndExchangeRelease(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.compareAndExchangeFloatRelease(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public float compareAndExchangeRelease(float expected, float value) {
            return UNSAFE.compareAndExchangeFloatRelease(base, fieldOffset,
                                               expected,
                                               value);
        }

        @ForceInline
        static boolean weakCompareAndSetPlain(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloatPlain(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSetPlain(float expected, float value) {
            return UNSAFE.weakCompareAndSetFloatPlain(base, fieldOffset,
                                                       expected,
                                                       value);
        }

        @ForceInline
        static boolean weakCompareAndSet(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloat(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSet(float expected, float value) {
            return UNSAFE.weakCompareAndSetFloat(base, fieldOffset,
                                                  expected,
                                                  value);
        }

        @ForceInline
        static boolean weakCompareAndSetAcquire(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloatAcquire(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSetAcquire(float expected, float value) {
            return UNSAFE.weakCompareAndSetFloatAcquire(base, fieldOffset,
                                                         expected,
                                                         value);
        }

        @ForceInline
        static boolean weakCompareAndSetRelease(VarHandle ob, float expected, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.weakCompareAndSetFloatRelease(handle.base,
                                               handle.fieldOffset,
                                               expected,
                                               value);
        }

        // @Override
        public boolean weakCompareAndSetRelease(float expected, float value) {
            return UNSAFE.weakCompareAndSetFloatRelease(base, fieldOffset,
                                                         expected,
                                                         value);
        }

        @ForceInline
        static float getAndSet(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.getAndSetFloat(handle.base,
                                          handle.fieldOffset,
                                          value);
        }

        // @Override
        public float getAndSet(float value) {
            return UNSAFE.getAndSetFloat(base, fieldOffset, value);
        }

        @ForceInline
        static float getAndSetAcquire(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.getAndSetFloatAcquire(handle.base,
                                          handle.fieldOffset,
                                          value);
        }

        // @Override
        public float getAndSetAcquire(float value) {
            return UNSAFE.getAndSetFloatAcquire(base, fieldOffset, value);
        }

        @ForceInline
        static float getAndSetRelease(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.getAndSetFloatRelease(handle.base,
                                          handle.fieldOffset,
                                          value);
        }

        // @Override
        public float getAndSetRelease(float value) {
            return UNSAFE.getAndSetFloatRelease(base, fieldOffset, value);
        }

        @ForceInline
        static float getAndAdd(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.getAndAddFloat(handle.base,
                                       handle.fieldOffset,
                                       value);
        }

        // @Override
        public float getAndAdd(float value) {
            return UNSAFE.getAndAddFloat(base, fieldOffset, value);
        }

        @ForceInline
        static float getAndAddAcquire(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.getAndAddFloatAcquire(handle.base,
                                       handle.fieldOffset,
                                       value);
        }

        // @Override
        public float getAndAddAcquire(float value) {
            return UNSAFE.getAndAddFloatAcquire(base, fieldOffset, value);
        }

        @ForceInline
        static float getAndAddRelease(VarHandle ob, float value) {
            FieldStaticReadWrite handle = (FieldStaticReadWrite)ob;
            return UNSAFE.getAndAddFloatRelease(handle.base,
                                       handle.fieldOffset,
                                       value);
        }

        // @Override
        public float getAndAddRelease(float value) {
            return UNSAFE.getAndAddFloatRelease(base, fieldOffset, value);
        }

        static final VarForm FORM = new VarForm(FieldStaticReadWrite.class, null, float.class);
    }


    static final class Array extends VarHandle {
        final int abase;
        final int ashift;

        Array(int abase, int ashift) {
            this(abase, ashift, false);
        }

        private Array(int abase, int ashift, boolean exact) {
            super(Array.FORM, exact);
            this.abase = abase;
            this.ashift = ashift;
        }

        @Override
        public Array withInvokeExactBehavior() {
            return hasInvokeExactBehavior()
                ? this
                : new Array(abase, ashift, true);
        }

        @Override
        public Array withInvokeBehavior() {
            return !hasInvokeExactBehavior()
                ? this
                : new Array(abase, ashift, false);
        }

        @Override
        public Optional describeConstable() {
            var arrayTypeRef = float[].class.describeConstable();
            if (!arrayTypeRef.isPresent())
                return Optional.empty();

            return Optional.of(VarHandleDesc.ofArray(arrayTypeRef.get()));
        }

        @Override
        final MethodType accessModeTypeUncached(AccessType at) {
            return at.accessModeType(float[].class, float.class, int.class);
        }


        @ForceInline
        static float get(VarHandle ob, Object oarray, int index) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return array[index];
        }

        // @Override
        public float get(Object oarray, int index) {
            float[] array = (float[]) oarray;
            return array[index];
        }

        @ForceInline
        static void set(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            array[index] = value;
        }

        // @Override
        public void set(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            array[index] = value;
        }

        @ForceInline
        static float getVolatile(VarHandle ob, Object oarray, int index) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getFloatVolatile(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase);
        }

        // @Override
        public float getVolatile(Object oarray, int index) {
            float[] array = (float[]) oarray;
            return UNSAFE.getFloatVolatile(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase);
        }

        @ForceInline
        static void setVolatile(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            UNSAFE.putFloatVolatile(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public void setVolatile(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            UNSAFE.putFloatVolatile(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static float getOpaque(VarHandle ob, Object oarray, int index) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getFloatOpaque(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase);
        }

        // @Override
        public float getOpaque(Object oarray, int index) {
            float[] array = (float[]) oarray;
            return UNSAFE.getFloatOpaque(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase);
        }

        @ForceInline
        static void setOpaque(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            UNSAFE.putFloatOpaque(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public void setOpaque(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            UNSAFE.putFloatOpaque(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static float getAcquire(VarHandle ob, Object oarray, int index) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase);
        }

        // @Override
        public float getAcquire(Object oarray, int index) {
            float[] array = (float[]) oarray;
            return UNSAFE.getFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase);
        }

        @ForceInline
        static void setRelease(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            UNSAFE.putFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public void setRelease(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            UNSAFE.putFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static boolean compareAndSet(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndSetFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public boolean compareAndSet(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndSetFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static float compareAndExchange(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndExchangeFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public float compareAndExchange(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndExchangeFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static float compareAndExchangeAcquire(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndExchangeFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public float compareAndExchangeAcquire(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndExchangeFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static float compareAndExchangeRelease(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndExchangeFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public float compareAndExchangeRelease(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.compareAndExchangeFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static boolean weakCompareAndSetPlain(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloatPlain(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public boolean weakCompareAndSetPlain(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloatPlain(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static boolean weakCompareAndSet(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public boolean weakCompareAndSet(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static boolean weakCompareAndSetAcquire(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public boolean weakCompareAndSetAcquire(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static boolean weakCompareAndSetRelease(VarHandle ob, Object oarray, int index, float expected, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    expected,
                    value);
        }

        // @Override
        public boolean weakCompareAndSetRelease(Object oarray, int index, float expected, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.weakCompareAndSetFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    expected,
                    value);
        }

        @ForceInline
        static float getAndSet(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getAndSetFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public float getAndSet(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.getAndSetFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static float getAndSetAcquire(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getAndSetFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public float getAndSetAcquire(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.getAndSetFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static float getAndSetRelease(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getAndSetFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public float getAndSetRelease(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.getAndSetFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static float getAndAdd(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getAndAddFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public float getAndAdd(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.getAndAddFloat(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static float getAndAddAcquire(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getAndAddFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public float getAndAddAcquire(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.getAndAddFloatAcquire(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        @ForceInline
        static float getAndAddRelease(VarHandle ob, Object oarray, int index, float value) {
            Array handle = (Array)ob;
            float[] array = (float[]) oarray;
            return UNSAFE.getAndAddFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                    value);
        }

        // @Override
        public float getAndAddRelease(Object oarray, int index, float value) {
            float[] array = (float[]) oarray;
            return UNSAFE.getAndAddFloatRelease(array,
                    (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << ashift) + abase,
                    value);
        }

        static final VarForm FORM = new VarForm(Array.class, float[].class, float.class, int.class);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy