jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template
author vlivanov
Mon, 09 May 2016 12:39:41 +0300
changeset 38358 cb99c6d2af1b
parent 37719 add11bc0e6e2
parent 38356 1e4ecca97792
child 38367 21801e8e9344
permissions -rw-r--r--
Merge
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;
38356
1e4ecca97792 8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents: 36934
diff changeset
    28
import jdk.internal.util.Preconditions;
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    29
import jdk.internal.vm.annotation.ForceInline;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    30
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    31
import java.nio.ByteBuffer;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    32
import java.nio.ReadOnlyBufferException;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    33
import java.util.Objects;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    34
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    35
import static java.lang.invoke.MethodHandleStatics.UNSAFE;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    36
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    37
#warn
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    38
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    39
final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    40
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    41
    static final int ALIGN = $BoxType$.BYTES - 1;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    42
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    43
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    44
    @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    45
    static $rawType$ convEndian(boolean big, $type$ v) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    46
        $rawType$ rv = $Type$.$type$ToRaw$RawType$Bits(v);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    47
        return big == BE ? rv : $RawBoxType$.reverseBytes(rv);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    48
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    49
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    50
    @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    51
    static $type$ convEndian(boolean big, $rawType$ rv) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    52
        rv = big == BE ? rv : $RawBoxType$.reverseBytes(rv);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    53
        return $Type$.$rawType$BitsTo$Type$(rv);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    54
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    55
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    56
    @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    57
    static $type$ convEndian(boolean big, $type$ n) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    58
        return big == BE ? n : $BoxType$.reverseBytes(n);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    59
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    60
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    61
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    62
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    63
    private static class ByteArrayViewVarHandle extends VarHandle {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    64
        final boolean be;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    65
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    66
        ByteArrayViewVarHandle(Class<? extends ByteArrayViewVarHandle> implSubType,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    67
                               Class<?> arrayType, Class<?> component, boolean be) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    68
            super(VarForm.createFromStatic(implSubType),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    69
                  arrayType, component, int.class);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    70
            this.be = be;
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
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    74
    static final class ArrayHandle extends ByteArrayViewVarHandle {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    75
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    76
        ArrayHandle(boolean be) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    77
            super(ArrayHandle.class, byte[].class, $type$.class, be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    78
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    79
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    80
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    81
        static int index(byte[] ba, int index) {
38356
1e4ecca97792 8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents: 36934
diff changeset
    82
            return Preconditions.checkIndex(index, ba.length - ALIGN, null);
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    83
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    84
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    85
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    86
        static long address(byte[] ba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    87
            long address = ((long) index) + Unsafe.ARRAY_BYTE_BASE_OFFSET;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    88
            if ((address & ALIGN) != 0)
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    89
                throw newIllegalStateExceptionForMisalignedAccess(index);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    90
            return address;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    91
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    92
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    93
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    94
        static $type$ get(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    95
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    96
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    97
            $rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    98
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
    99
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   100
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   101
            return $Type$.$rawType$BitsTo$Type$(rawValue);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   102
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   103
            return UNSAFE.get$Type$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   104
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   105
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   106
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   107
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   108
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   109
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   110
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   111
        static void set(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   112
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   113
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   114
            UNSAFE.put$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   115
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   116
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   117
                    $Type$.$type$ToRaw$RawType$Bits(value),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   118
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   119
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   120
            UNSAFE.put$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   121
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   122
                    ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   123
                    value,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   124
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   125
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   126
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   127
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   128
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   129
        static $type$ getVolatile(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   130
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   131
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   132
                              UNSAFE.get$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   133
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   134
                                      address(ba, index(ba, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   135
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   136
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   137
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   138
        static void setVolatile(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   139
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   140
            UNSAFE.put$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   141
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   142
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   143
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   144
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   145
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   146
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   147
        static $type$ getAcquire(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   148
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   149
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   150
                              UNSAFE.get$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   151
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   152
                                      address(ba, index(ba, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   153
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   154
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   155
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   156
        static void setRelease(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   157
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   158
            UNSAFE.put$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   159
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   160
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   161
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   162
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   163
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   164
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   165
        static $type$ getOpaque(ArrayHandle handle, Object oba, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   166
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   167
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   168
                              UNSAFE.get$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   169
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   170
                                      address(ba, index(ba, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   171
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   172
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   173
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   174
        static void setOpaque(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   175
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   176
            UNSAFE.put$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   177
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   178
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   179
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   180
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   181
#if[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   182
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   183
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   184
        static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   185
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   186
            return UNSAFE.compareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   187
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   188
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   189
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   190
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   191
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   192
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   193
        static $type$ compareAndExchangeVolatile(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   194
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   195
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   196
                              UNSAFE.compareAndExchange$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   197
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   198
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   199
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   200
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   201
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   202
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   203
        static $type$ compareAndExchangeAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   204
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   205
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   206
                              UNSAFE.compareAndExchange$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   207
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   208
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   209
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   210
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   211
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   212
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   213
        static $type$ compareAndExchangeRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   214
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   215
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   216
                              UNSAFE.compareAndExchange$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   217
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   218
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   219
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   220
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   221
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   222
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   223
        static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   224
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   225
            return UNSAFE.weakCompareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   226
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   227
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   228
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   229
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   230
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   231
        @ForceInline
37719
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   232
        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
   233
            byte[] ba = (byte[]) oba;
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   234
            // 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
   235
            return UNSAFE.compareAndSwap$RawType$(
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   236
                    ba,
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   237
                    address(ba, index(ba, index)),
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   238
                    convEndian(handle.be, expected), convEndian(handle.be, value));
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
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   241
        @ForceInline
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   242
        static boolean weakCompareAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   243
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   244
            return UNSAFE.weakCompareAndSwap$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   245
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   246
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   247
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   248
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   249
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   250
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   251
        static boolean weakCompareAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   252
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   253
            return UNSAFE.weakCompareAndSwap$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   254
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   255
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   256
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   257
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   258
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   259
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   260
        static $type$ getAndSet(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   261
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   262
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   263
                              UNSAFE.getAndSet$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   264
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   265
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   266
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   267
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   268
#end[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   269
#if[AtomicAdd]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   270
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   271
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   272
        static $type$ getAndAdd(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   273
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   274
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   275
                              UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   276
                                      ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   277
                                      address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   278
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   279
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   280
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   281
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   282
        static $type$ addAndGet(ArrayHandle handle, Object oba, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   283
            byte[] ba = (byte[]) oba;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   284
            return convEndian(handle.be, UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   285
                    ba,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   286
                    address(ba, index(ba, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   287
                    convEndian(handle.be, value))) + value;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   288
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   289
#end[AtomicAdd]
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
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   293
    static final class ByteBufferHandle extends ByteArrayViewVarHandle {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   294
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   295
        ByteBufferHandle(boolean be) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   296
            super(ByteBufferHandle.class, ByteBuffer.class, $type$.class, be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   297
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   298
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   299
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   300
        static int index(ByteBuffer bb, int index) {
38356
1e4ecca97792 8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents: 36934
diff changeset
   301
            return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null);
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   302
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   303
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   304
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   305
        static int indexRO(ByteBuffer bb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   306
            if (UNSAFE.getBoolean(bb, BYTE_BUFFER_IS_READ_ONLY))
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   307
                throw new ReadOnlyBufferException();
38356
1e4ecca97792 8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents: 36934
diff changeset
   308
            return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null);
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   309
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   310
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   311
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   312
        static long address(ByteBuffer bb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   313
            long address = ((long) index) + UNSAFE.getLong(bb, BUFFER_ADDRESS);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   314
            if ((address & ALIGN) != 0)
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   315
                throw newIllegalStateExceptionForMisalignedAccess(index);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   316
            return address;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   317
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   318
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   319
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   320
        static $type$ get(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   321
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   322
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   323
            $rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   324
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   325
                    ((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   326
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   327
            return $Type$.$rawType$BitsTo$Type$(rawValue);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   328
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   329
            return UNSAFE.get$Type$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   330
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   331
                    ((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   332
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   333
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   334
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   335
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   336
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   337
        static void set(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   338
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   339
#if[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   340
            UNSAFE.put$RawType$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   341
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   342
                    ((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   343
                    $Type$.$type$ToRaw$RawType$Bits(value),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   344
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   345
#else[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   346
            UNSAFE.put$Type$Unaligned(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   347
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   348
                    ((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   349
                    value,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   350
                    handle.be);
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   351
#end[floatingPoint]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   352
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   353
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   354
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   355
        static $type$ getVolatile(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   356
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   357
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   358
                              UNSAFE.get$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   359
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   360
                                      address(bb, index(bb, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   361
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   362
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   363
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   364
        static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   365
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   366
            UNSAFE.put$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   367
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   368
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   369
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   370
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   371
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   372
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   373
        static $type$ getAcquire(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   374
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   375
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   376
                              UNSAFE.get$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   377
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   378
                                      address(bb, index(bb, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   379
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   380
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   381
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   382
        static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   383
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   384
            UNSAFE.put$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   385
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   386
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   387
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   388
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   389
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   390
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   391
        static $type$ getOpaque(ByteBufferHandle handle, Object obb, int index) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   392
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   393
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   394
                              UNSAFE.get$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   395
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   396
                                      address(bb, index(bb, index))));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   397
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   398
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   399
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   400
        static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   401
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   402
            UNSAFE.put$RawType$Opaque(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   403
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   404
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   405
                    convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   406
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   407
#if[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   408
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   409
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   410
        static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   411
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   412
            return UNSAFE.compareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   413
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   414
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   415
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   416
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   417
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   418
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   419
        static $type$ compareAndExchangeVolatile(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   420
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   421
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   422
                              UNSAFE.compareAndExchange$RawType$Volatile(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   423
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   424
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   425
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   426
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   427
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   428
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   429
        static $type$ compareAndExchangeAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   430
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   431
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   432
                              UNSAFE.compareAndExchange$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   433
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   434
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   435
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   436
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   437
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   438
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   439
        static $type$ compareAndExchangeRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   440
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   441
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   442
                              UNSAFE.compareAndExchange$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   443
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   444
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   445
                                      convEndian(handle.be, expected), convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   446
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   447
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   448
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   449
        static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   450
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   451
            return UNSAFE.weakCompareAndSwap$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   452
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   453
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   454
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   455
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   456
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   457
        @ForceInline
37719
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   458
        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
   459
            ByteBuffer bb = (ByteBuffer) obb;
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   460
            // 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
   461
            return UNSAFE.compareAndSwap$RawType$(
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   462
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   463
                    address(bb, indexRO(bb, index)),
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   464
                    convEndian(handle.be, expected), convEndian(handle.be, value));
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
add11bc0e6e2 8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents: 36934
diff changeset
   467
        @ForceInline
36934
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   468
        static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   469
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   470
            return UNSAFE.weakCompareAndSwap$RawType$Acquire(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   471
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   472
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   473
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   474
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   475
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   476
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   477
        static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   478
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   479
            return UNSAFE.weakCompareAndSwap$RawType$Release(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   480
                    UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   481
                    address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   482
                    convEndian(handle.be, expected), convEndian(handle.be, value));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   483
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   484
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   485
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   486
        static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   487
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   488
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   489
                              UNSAFE.getAndSet$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   490
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   491
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   492
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   493
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   494
#end[CAS]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   495
#if[AtomicAdd]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   496
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   497
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   498
        static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   499
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   500
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   501
                              UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   502
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   503
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   504
                                      convEndian(handle.be, value)));
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   505
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   506
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   507
        @ForceInline
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   508
        static $type$ addAndGet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   509
            ByteBuffer bb = (ByteBuffer) obb;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   510
            return convEndian(handle.be,
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   511
                              UNSAFE.getAndAdd$RawType$(
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   512
                                      UNSAFE.getObject(bb, BYTE_BUFFER_HB),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   513
                                      address(bb, indexRO(bb, index)),
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   514
                                      convEndian(handle.be, value))) + value;
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   515
        }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   516
#end[AtomicAdd]
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   517
    }
590fc47a0aeb 8149644: Integrate VarHandles
psandoz
parents:
diff changeset
   518
}