jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template
author psandoz
Fri, 29 Apr 2016 13:46:19 -0700
changeset 37719 add11bc0e6e2
parent 36934 590fc47a0aeb
child 38358 cb99c6d2af1b
child 37792 dd626e6f5967
permissions -rw-r--r--
8154755: Add a VarHandle weakCompareAndSet with volatile semantics Reviewed-by: shade, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     1
/*
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     4
 *
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    10
 *
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    15
 * accompanied this code).
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    16
 *
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    20
 *
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    23
 * questions.
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    24
 */
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    25
package java.lang.invoke;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    26
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    27
import jdk.internal.misc.Unsafe;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    28
import jdk.internal.vm.annotation.ForceInline;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    29
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    30
import java.nio.ByteBuffer;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    31
import java.nio.ReadOnlyBufferException;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    32
import java.util.Objects;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    33
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    34
import static java.lang.invoke.MethodHandleStatics.UNSAFE;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    35
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    36
#warn
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    37
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    38
final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    39
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    40
    static final int ALIGN = $BoxType$.BYTES - 1;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    41
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    42
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    43
    @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    44
    static $rawType$ convEndian(boolean big, $type$ v) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    45
        $rawType$ rv = $Type$.$type$ToRaw$RawType$Bits(v);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    46
        return big == BE ? rv : $RawBoxType$.reverseBytes(rv);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    47
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    48
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    49
    @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    50
    static $type$ convEndian(boolean big, $rawType$ rv) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    51
        rv = big == BE ? rv : $RawBoxType$.reverseBytes(rv);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    52
        return $Type$.$rawType$BitsTo$Type$(rv);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    53
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    54
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    55
    @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    56
    static $type$ convEndian(boolean big, $type$ n) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    57
        return big == BE ? n : $BoxType$.reverseBytes(n);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    58
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    59
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    60
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    61
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    62
    private static class ByteArrayViewVarHandle extends VarHandle {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    63
        final boolean be;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    64
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    65
        ByteArrayViewVarHandle(Class<? extends ByteArrayViewVarHandle> implSubType,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    66
                               Class<?> arrayType, Class<?> component, boolean be) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    67
            super(VarForm.createFromStatic(implSubType),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    68
                  arrayType, component, int.class);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    69
            this.be = be;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    70
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    71
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    72
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    73
    static final class ArrayHandle extends ByteArrayViewVarHandle {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    74
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    75
        ArrayHandle(boolean be) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    76
            super(ArrayHandle.class, byte[].class, $type$.class, be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    77
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    78
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    79
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    80
        static int index(byte[] ba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    81
            return Objects.checkIndex(index, ba.length - ALIGN, null);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    82
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    83
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    84
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    85
        static long address(byte[] ba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    86
            long address = ((long) index) + Unsafe.ARRAY_BYTE_BASE_OFFSET;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    87
            if ((address & ALIGN) != 0)
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    88
                throw newIllegalStateExceptionForMisalignedAccess(index);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    89
            return address;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    90
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    91
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    92
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    93
        static $type$ get(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    94
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    95
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    96
            $rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    97
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    98
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    99
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   100
            return $Type$.$rawType$BitsTo$Type$(rawValue);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   101
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   102
            return UNSAFE.get$Type$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   103
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   104
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   105
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   106
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   107
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   108
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   109
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   110
        static void set(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   111
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   112
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   113
            UNSAFE.put$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   114
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   115
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   116
                    $Type$.$type$ToRaw$RawType$Bits(value),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   117
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   118
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   119
            UNSAFE.put$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   120
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   121
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   122
                    value,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   123
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   124
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   125
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   126
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   127
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   128
        static $type$ getVolatile(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   129
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   130
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   131
                              UNSAFE.get$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   132
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   133
                                      address(ba, index(ba, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   134
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   135
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   136
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   137
        static void setVolatile(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   138
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   139
            UNSAFE.put$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   140
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   141
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   142
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   143
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   144
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   145
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   146
        static $type$ getAcquire(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   147
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   148
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   149
                              UNSAFE.get$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   150
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   151
                                      address(ba, index(ba, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   152
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   153
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   154
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   155
        static void setRelease(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   156
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   157
            UNSAFE.put$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   158
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   159
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   160
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   161
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   162
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   163
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   164
        static $type$ getOpaque(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   165
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   166
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   167
                              UNSAFE.get$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   168
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   169
                                      address(ba, index(ba, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   170
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   171
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   172
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   173
        static void setOpaque(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   174
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   175
            UNSAFE.put$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   176
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   177
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   178
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   179
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   180
#if[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   181
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   182
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   183
        static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   184
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   185
            return UNSAFE.compareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   186
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   187
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   188
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   189
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   190
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   191
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   192
        static $type$ compareAndExchangeVolatile(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   193
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   194
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   195
                              UNSAFE.compareAndExchange$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   196
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   197
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   198
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   199
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   200
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   201
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   202
        static $type$ compareAndExchangeAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   203
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   204
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   205
                              UNSAFE.compareAndExchange$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   206
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   207
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   208
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   209
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   210
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   211
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   212
        static $type$ compareAndExchangeRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   213
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   214
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   215
                              UNSAFE.compareAndExchange$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   216
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   217
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   218
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   219
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   220
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   221
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   222
        static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   223
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   224
            return UNSAFE.weakCompareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   225
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   226
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   227
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   228
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   229
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   230
        @ForceInline
37719
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   231
        static boolean weakCompareAndSetVolatile(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   232
            byte[] ba = (byte[]) oba;
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   233
            // TODO defer to strong form until new Unsafe method is added
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   234
            return UNSAFE.compareAndSwap$RawType$(
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   235
                    ba,
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   236
                    address(ba, index(ba, index)),
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   237
                    convEndian(handle.be, expected), convEndian(handle.be, value));
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   238
        }
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   239
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   240
        @ForceInline
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   241
        static boolean weakCompareAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   242
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   243
            return UNSAFE.weakCompareAndSwap$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   244
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   245
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   246
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   247
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   248
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   249
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   250
        static boolean weakCompareAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   251
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   252
            return UNSAFE.weakCompareAndSwap$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   253
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   254
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   255
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   256
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   257
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   258
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   259
        static $type$ getAndSet(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   260
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   261
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   262
                              UNSAFE.getAndSet$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   263
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   264
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   265
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   266
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   267
#end[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   268
#if[AtomicAdd]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   269
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   270
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   271
        static $type$ getAndAdd(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   272
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   273
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   274
                              UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   275
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   276
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   277
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   278
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   279
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   280
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   281
        static $type$ addAndGet(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   282
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   283
            return convEndian(handle.be, UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   284
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   285
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   286
                    convEndian(handle.be, value))) + value;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   287
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   288
#end[AtomicAdd]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   289
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   290
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   291
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   292
    static final class ByteBufferHandle extends ByteArrayViewVarHandle {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   293
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   294
        ByteBufferHandle(boolean be) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   295
            super(ByteBufferHandle.class, ByteBuffer.class, $type$.class, be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   296
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   297
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   298
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   299
        static int index(ByteBuffer bb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   300
            return Objects.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   301
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   302
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   303
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   304
        static int indexRO(ByteBuffer bb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   305
            if (UNSAFE.getBoolean(bb, BYTE_BUFFER_IS_READ_ONLY))
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   306
                throw new ReadOnlyBufferException();
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   307
            return Objects.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   308
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   309
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   310
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   311
        static long address(ByteBuffer bb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   312
            long address = ((long) index) + UNSAFE.getLong(bb, BUFFER_ADDRESS);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   313
            if ((address & ALIGN) != 0)
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   314
                throw newIllegalStateExceptionForMisalignedAccess(index);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   315
            return address;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   316
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   317
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   318
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   319
        static $type$ get(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   320
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   321
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   322
            $rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   323
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   324
                    ((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   325
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   326
            return $Type$.$rawType$BitsTo$Type$(rawValue);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   327
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   328
            return UNSAFE.get$Type$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   329
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   330
                    ((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   331
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   332
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   333
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   334
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   335
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   336
        static void set(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   337
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   338
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   339
            UNSAFE.put$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   340
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   341
                    ((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   342
                    $Type$.$type$ToRaw$RawType$Bits(value),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   343
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   344
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   345
            UNSAFE.put$Type$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   346
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   347
                    ((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   348
                    value,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   349
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   350
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   351
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   352
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   353
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   354
        static $type$ getVolatile(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   355
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   356
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   357
                              UNSAFE.get$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   358
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   359
                                      address(bb, index(bb, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   360
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   361
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   362
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   363
        static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   364
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   365
            UNSAFE.put$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   366
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   367
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   368
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   369
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   370
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   371
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   372
        static $type$ getAcquire(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   373
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   374
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   375
                              UNSAFE.get$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   376
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   377
                                      address(bb, index(bb, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   378
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   379
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   380
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   381
        static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   382
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   383
            UNSAFE.put$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   384
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   385
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   386
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   387
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   388
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   389
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   390
        static $type$ getOpaque(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   391
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   392
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   393
                              UNSAFE.get$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   394
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   395
                                      address(bb, index(bb, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   396
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   397
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   398
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   399
        static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   400
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   401
            UNSAFE.put$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   402
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   403
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   404
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   405
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   406
#if[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   407
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   408
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   409
        static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   410
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   411
            return UNSAFE.compareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   412
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   413
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   414
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   415
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   416
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   417
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   418
        static $type$ compareAndExchangeVolatile(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   419
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   420
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   421
                              UNSAFE.compareAndExchange$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   422
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   423
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   424
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   425
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   426
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   427
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   428
        static $type$ compareAndExchangeAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   429
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   430
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   431
                              UNSAFE.compareAndExchange$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   432
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   433
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   434
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   435
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   436
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   437
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   438
        static $type$ compareAndExchangeRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   439
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   440
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   441
                              UNSAFE.compareAndExchange$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   442
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   443
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   444
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   445
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   446
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   447
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   448
        static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   449
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   450
            return UNSAFE.weakCompareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   451
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   452
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   453
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   454
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   455
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   456
        @ForceInline
37719
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   457
        static boolean weakCompareAndSetVolatile(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   458
            ByteBuffer bb = (ByteBuffer) obb;
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   459
            // TODO defer to strong form until new Unsafe method is added
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   460
            return UNSAFE.compareAndSwap$RawType$(
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   461
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   462
                    address(bb, indexRO(bb, index)),
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   463
                    convEndian(handle.be, expected), convEndian(handle.be, value));
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   464
        }
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   465
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   466
        @ForceInline
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   467
        static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   468
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   469
            return UNSAFE.weakCompareAndSwap$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   470
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   471
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   472
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   473
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   474
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   475
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   476
        static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   477
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   478
            return UNSAFE.weakCompareAndSwap$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   479
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   480
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   481
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   482
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   483
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   484
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   485
        static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   486
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   487
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   488
                              UNSAFE.getAndSet$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   489
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   490
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   491
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   492
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   493
#end[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   494
#if[AtomicAdd]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   495
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   496
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   497
        static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   498
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   499
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   500
                              UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   501
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   502
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   503
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   504
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   505
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   506
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   507
        static $type$ addAndGet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   508
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   509
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   510
                              UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   511
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   512
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   513
                                      convEndian(handle.be, value))) + value;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   514
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   515
#end[AtomicAdd]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   516
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   517
}