< prev index next >

src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 97,107 **** private final FloatArrayCache cache; Reference(final FloatArrayCache cache, final int initialSize) { this.cache = cache; this.clean = cache.clean; ! this.initial = createArray(initialSize, clean); if (DO_STATS) { cache.stats.totalInitial += initialSize; } } --- 97,107 ---- private final FloatArrayCache cache; Reference(final FloatArrayCache cache, final int initialSize) { this.cache = cache; this.clean = cache.clean; ! this.initial = createArray(initialSize); if (DO_STATS) { cache.stats.totalInitial += initialSize; } }
*** 114,124 **** } if (DO_LOG_OVERSIZE) { logInfo(getLogPrefix(clean) + "FloatArrayCache: " + "getArray[oversize]: length=\t" + length); } ! return createArray(length, clean); } float[] widenArray(final float[] array, final int usedSize, final int needSize) { --- 114,124 ---- } if (DO_LOG_OVERSIZE) { logInfo(getLogPrefix(clean) + "FloatArrayCache: " + "getArray[oversize]: length=\t" + length); } ! return createArray(length); } float[] widenArray(final float[] array, final int usedSize, final int needSize) {
*** 200,210 **** return array; } if (DO_STATS) { stats.createOp++; } ! return createArray(arraySize, clean); } void putArray(final float[] array) { if (DO_CHECKS && (array.length != arraySize)) { --- 200,210 ---- return array; } if (DO_STATS) { stats.createOp++; } ! return createArray(arraySize); } void putArray(final float[] array) { if (DO_CHECKS && (array.length != arraySize)) {
*** 227,242 **** + "array capacity exceeded !"); } } } ! static float[] createArray(final int length, final boolean clean) { ! if (clean) { ! return new float[length]; ! } ! // use JDK9 Unsafe.allocateUninitializedArray(class, length): ! return (float[]) OffHeapArray.UNSAFE.allocateUninitializedArray(float.class, length); } static void fill(final float[] array, final int fromIndex, final int toIndex, final float value) { --- 227,238 ---- + "array capacity exceeded !"); } } } ! static float[] createArray(final int length) { ! return new float[length]; } static void fill(final float[] array, final int fromIndex, final int toIndex, final float value) {
< prev index next >