< prev index next >

openjfx9/modules/javafx.graphics/src/main/java/com/sun/marlin/IntArrayCache.java

Print this page

        

*** 20,53 **** * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ - package sun.java2d.marlin; ! import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES; ! import static sun.java2d.marlin.ArrayCacheConst.BUCKETS; ! import static sun.java2d.marlin.ArrayCacheConst.MAX_ARRAY_SIZE; ! import static sun.java2d.marlin.MarlinUtils.logInfo; ! import static sun.java2d.marlin.MarlinUtils.logException; import java.lang.ref.WeakReference; import java.util.Arrays; ! import sun.java2d.marlin.ArrayCacheConst.BucketStats; ! import sun.java2d.marlin.ArrayCacheConst.CacheStats; /* * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java * files are generated with the following command lines: */ // % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java // % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java ! final class IntArrayCache implements MarlinConst { final boolean clean; private final int bucketCapacity; private WeakReference<Bucket[]> refBuckets = null; final CacheStats stats; --- 20,54 ---- * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package com.sun.marlin; ! ! import static com.sun.marlin.ArrayCacheConst.ARRAY_SIZES; ! import static com.sun.marlin.ArrayCacheConst.BUCKETS; ! import static com.sun.marlin.ArrayCacheConst.MAX_ARRAY_SIZE; ! import static com.sun.marlin.MarlinUtils.logInfo; ! import static com.sun.marlin.MarlinUtils.logException; import java.lang.ref.WeakReference; import java.util.Arrays; ! import com.sun.marlin.ArrayCacheConst.BucketStats; ! import com.sun.marlin.ArrayCacheConst.CacheStats; /* * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java * files are generated with the following command lines: */ // % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java // % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java ! public final class IntArrayCache implements MarlinConst { final boolean clean; private final int bucketCapacity; private WeakReference<Bucket[]> refBuckets = null; final CacheStats stats;
*** 229,254 **** static int[] createArray(final int length, final boolean clean) { if (clean) { return new int[length]; } ! // use JDK9 Unsafe.allocateUninitializedArray(class, length): ! return (int[]) OffHeapArray.UNSAFE.allocateUninitializedArray(int.class, length); } ! static void fill(final int[] array, final int fromIndex, ! final int toIndex, final int value) { // clear array data: Arrays.fill(array, fromIndex, toIndex, value); if (DO_CHECKS) { check(array, fromIndex, toIndex, value); } } ! static void check(final int[] array, final int fromIndex, ! final int toIndex, final int value) { if (DO_CHECKS) { // check zero on full array: for (int i = 0; i < array.length; i++) { if (array[i] != value) { --- 230,255 ---- static int[] createArray(final int length, final boolean clean) { if (clean) { return new int[length]; } ! // use JDK9 Unsafe.allocateUninitializedArray(class, length): ! return (int[]) OffHeapArray.UNSAFE.allocateUninitializedArray(int.class, length); } ! public static void fill(final int[] array, final int fromIndex, ! final int toIndex, final int value) { // clear array data: Arrays.fill(array, fromIndex, toIndex, value); if (DO_CHECKS) { check(array, fromIndex, toIndex, value); } } ! public static void check(final int[] array, final int fromIndex, ! final int toIndex, final int value) { if (DO_CHECKS) { // check zero on full array: for (int i = 0; i < array.length; i++) { if (array[i] != value) {
< prev index next >