< prev index next >

src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.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 IntArrayCache cache; Reference(final IntArrayCache 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 IntArrayCache cache; Reference(final IntArrayCache 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) + "IntArrayCache: " + "getArray[oversize]: length=\t" + length); } ! return createArray(length, clean); } int[] widenArray(final int[] array, final int usedSize, final int needSize) { --- 114,124 ---- } if (DO_LOG_OVERSIZE) { logInfo(getLogPrefix(clean) + "IntArrayCache: " + "getArray[oversize]: length=\t" + length); } ! return createArray(length); } int[] widenArray(final int[] array, final int usedSize, final int needSize) {
*** 200,210 **** return array; } if (DO_STATS) { stats.createOp++; } ! return createArray(arraySize, clean); } void putArray(final int[] array) { if (DO_CHECKS && (array.length != arraySize)) { --- 200,210 ---- return array; } if (DO_STATS) { stats.createOp++; } ! return createArray(arraySize); } void putArray(final int[] array) { if (DO_CHECKS && (array.length != arraySize)) {
*** 227,242 **** + "array capacity exceeded !"); } } } ! 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) { --- 227,238 ---- + "array capacity exceeded !"); } } } ! static int[] createArray(final int length) { ! return new int[length]; } static void fill(final int[] array, final int fromIndex, final int toIndex, final int value) {
< prev index next >