< prev index next >

src/java.base/share/classes/java/lang/invoke/VarHandles.java

Print this page

        

@@ -301,17 +301,17 @@
      *
      * Coordinates are multiplied with corresponding scale factors ({@code strides}) and added
      * to a single fixed offset to compute an effective offset from the given MemoryAddress for the access.
      *
      * @param carrier the Java carrier type.
-     * @param alignment alignment requirement to be checked upon access. In bytes. Must be a power of 2.
+     * @param alignmentMask alignment requirement to be checked upon access. In bytes. Expressed as a mask.
      * @param byteOrder the byte order.
      * @param offset a constant offset for the access.
      * @param strides the scale factors with which to multiply given access coordinates.
      * @return the created VarHandle.
      */
-    static VarHandle makeMemoryAddressViewHandle(Class<?> carrier, long alignment,
+    static VarHandle makeMemoryAddressViewHandle(Class<?> carrier, long alignmentMask,
                                                  ByteOrder byteOrder, long offset, long[] strides) {
         if (!carrier.isPrimitive() || carrier == void.class || carrier == boolean.class) {
             throw new IllegalArgumentException("Invalid carrier: " + carrier.getName());
         }
         long size = Wrapper.forPrimitiveType(carrier).bitWidth() / 8;

@@ -321,11 +321,11 @@
         MethodHandle fac = carrierFactory.computeIfAbsent(strides.length,
                 dims -> new AddressVarHandleGenerator(carrier, dims)
                             .generateHandleFactory());
 
         try {
-            return (VarHandle)fac.invoke(be, size, offset, alignment - 1, strides);
+            return (VarHandle)fac.invoke(be, size, offset, alignmentMask, strides);
         } catch (Throwable ex) {
             throw new IllegalStateException(ex);
         }
     }
 
< prev index next >