aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--make/sun/awt/FILES_c_unix.gmk1
-rw-r--r--make/sun/awt/FILES_c_windows.gmk1
-rw-r--r--make/sun/awt/mapfile-vers1
-rw-r--r--make/sun/awt/mapfile-vers-linux1
-rw-r--r--src/share/classes/sun/java2d/pipe/RenderBuffer.java36
-rw-r--r--src/share/native/sun/java2d/pipe/RenderBuffer.c71
6 files changed, 11 insertions, 100 deletions
diff --git a/make/sun/awt/FILES_c_unix.gmk b/make/sun/awt/FILES_c_unix.gmk
index f85635f00..3b4ad3f1c 100644
--- a/make/sun/awt/FILES_c_unix.gmk
+++ b/make/sun/awt/FILES_c_unix.gmk
@@ -125,7 +125,6 @@ FILES_2D_c = \
FourByteAbgrPre.c \
BufferedMaskBlit.c \
BufferedRenderPipe.c \
- RenderBuffer.c \
ShapeSpanIterator.c \
SpanClipRenderer.c \
awt_ImageRep.c \
diff --git a/make/sun/awt/FILES_c_windows.gmk b/make/sun/awt/FILES_c_windows.gmk
index 1a9b3b6ad..211ab1c6b 100644
--- a/make/sun/awt/FILES_c_windows.gmk
+++ b/make/sun/awt/FILES_c_windows.gmk
@@ -70,7 +70,6 @@ FILES_c = \
FourByteAbgrPre.c \
BufferedMaskBlit.c \
BufferedRenderPipe.c \
- RenderBuffer.c \
ShapeSpanIterator.c \
SpanClipRenderer.c \
SurfaceData.c \
diff --git a/make/sun/awt/mapfile-vers b/make/sun/awt/mapfile-vers
index 9ab965e07..06a1d5b97 100644
--- a/make/sun/awt/mapfile-vers
+++ b/make/sun/awt/mapfile-vers
@@ -65,7 +65,6 @@ SUNWprivate_1.1 {
Java_sun_awt_image_ShortComponentRaster_initIDs;
Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile;
Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans;
- Java_sun_java2d_pipe_RenderBuffer_copyFromArray;
Java_sun_java2d_pipe_SpanClipRenderer_eraseTile;
Java_sun_java2d_pipe_SpanClipRenderer_fillTile;
Java_sun_java2d_pipe_ShapeSpanIterator_addSegment;
diff --git a/make/sun/awt/mapfile-vers-linux b/make/sun/awt/mapfile-vers-linux
index 83afeebc7..2d1f0893a 100644
--- a/make/sun/awt/mapfile-vers-linux
+++ b/make/sun/awt/mapfile-vers-linux
@@ -117,7 +117,6 @@ SUNWprivate_1.1 {
Java_sun_java2d_loops_MaskBlit_MaskBlit;
Java_sun_java2d_loops_MaskFill_MaskFill;
Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans;
- Java_sun_java2d_pipe_RenderBuffer_copyFromArray;
Java_sun_java2d_pipe_SpanClipRenderer_initIDs;
sun_awt_image_GifImageDecoder_initIDs;
diff --git a/src/share/classes/sun/java2d/pipe/RenderBuffer.java b/src/share/classes/sun/java2d/pipe/RenderBuffer.java
index 62026e490..f0b8069a5 100644
--- a/src/share/classes/sun/java2d/pipe/RenderBuffer.java
+++ b/src/share/classes/sun/java2d/pipe/RenderBuffer.java
@@ -63,7 +63,7 @@ public class RenderBuffer {
* (This value can be adjusted if the cost of JNI downcalls is reduced
* in a future release.)
*/
- private static final int COPY_FROM_ARRAY_THRESHOLD = 28;
+ private static final int COPY_FROM_ARRAY_THRESHOLD = 6;
protected final Unsafe unsafe;
protected final long baseAddress;
@@ -93,20 +93,6 @@ public class RenderBuffer {
}
/**
- * Copies length bytes from the Java-level srcArray to the native
- * memory located at dstAddr. Note that this method performs no bounds
- * checking. Verification that the copy will not result in memory
- * corruption should be done by the caller prior to invocation.
- *
- * @param srcArray the source array
- * @param srcPos the starting position of the source array (in bytes)
- * @param dstAddr pointer to the destination block of native memory
- * @param length the number of bytes to copy from source to destination
- */
- private static native void copyFromArray(Object srcArray, long srcPos,
- long dstAddr, long length);
-
- /**
* The behavior (and names) of the following methods are nearly
* identical to their counterparts in the various NIO Buffer classes.
*/
@@ -147,9 +133,9 @@ public class RenderBuffer {
public RenderBuffer put(byte[] x, int offset, int length) {
if (length > COPY_FROM_ARRAY_THRESHOLD) {
- long offsetInBytes = offset * SIZEOF_BYTE;
+ long offsetInBytes = offset * SIZEOF_BYTE + Unsafe.ARRAY_BYTE_BASE_OFFSET;
long lengthInBytes = length * SIZEOF_BYTE;
- copyFromArray(x, offsetInBytes, curAddress, lengthInBytes);
+ unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes);
position(position() + lengthInBytes);
} else {
int end = offset + length;
@@ -178,9 +164,9 @@ public class RenderBuffer {
public RenderBuffer put(short[] x, int offset, int length) {
// assert (position() % SIZEOF_SHORT == 0);
if (length > COPY_FROM_ARRAY_THRESHOLD) {
- long offsetInBytes = offset * SIZEOF_SHORT;
+ long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET;
long lengthInBytes = length * SIZEOF_SHORT;
- copyFromArray(x, offsetInBytes, curAddress, lengthInBytes);
+ unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes);
position(position() + lengthInBytes);
} else {
int end = offset + length;
@@ -215,9 +201,9 @@ public class RenderBuffer {
public RenderBuffer put(int[] x, int offset, int length) {
// assert (position() % SIZEOF_INT == 0);
if (length > COPY_FROM_ARRAY_THRESHOLD) {
- long offsetInBytes = offset * SIZEOF_INT;
+ long offsetInBytes = offset * SIZEOF_INT + Unsafe.ARRAY_INT_BASE_OFFSET;
long lengthInBytes = length * SIZEOF_INT;
- copyFromArray(x, offsetInBytes, curAddress, lengthInBytes);
+ unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes);
position(position() + lengthInBytes);
} else {
int end = offset + length;
@@ -246,9 +232,9 @@ public class RenderBuffer {
public RenderBuffer put(float[] x, int offset, int length) {
// assert (position() % SIZEOF_FLOAT == 0);
if (length > COPY_FROM_ARRAY_THRESHOLD) {
- long offsetInBytes = offset * SIZEOF_FLOAT;
+ long offsetInBytes = offset * SIZEOF_FLOAT + Unsafe.ARRAY_FLOAT_BASE_OFFSET;
long lengthInBytes = length * SIZEOF_FLOAT;
- copyFromArray(x, offsetInBytes, curAddress, lengthInBytes);
+ unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes);
position(position() + lengthInBytes);
} else {
int end = offset + length;
@@ -277,9 +263,9 @@ public class RenderBuffer {
public RenderBuffer put(long[] x, int offset, int length) {
// assert (position() % SIZEOF_LONG == 0);
if (length > COPY_FROM_ARRAY_THRESHOLD) {
- long offsetInBytes = offset * SIZEOF_LONG;
+ long offsetInBytes = offset * SIZEOF_LONG + Unsafe.ARRAY_LONG_BASE_OFFSET;
long lengthInBytes = length * SIZEOF_LONG;
- copyFromArray(x, offsetInBytes, curAddress, lengthInBytes);
+ unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes);
position(position() + lengthInBytes);
} else {
int end = offset + length;
diff --git a/src/share/native/sun/java2d/pipe/RenderBuffer.c b/src/share/native/sun/java2d/pipe/RenderBuffer.c
deleted file mode 100644
index fd6b5abd4..000000000
--- a/src/share/native/sun/java2d/pipe/RenderBuffer.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc. 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jlong.h"
-#include <string.h>
-
-#include "sun_java2d_pipe_RenderBuffer.h"
-
-/**
- * Note: The code in this file is nearly identical to that in
- * java/nio/Bits.c...
- */
-
-#define MBYTE 1048576
-
-JNIEXPORT void JNICALL
-Java_sun_java2d_pipe_RenderBuffer_copyFromArray
- (JNIEnv *env, jclass rb,
- jobject srcArray, jlong srcPos, jlong dstAddr, jlong length)
-{
- jbyte *bytes;
- size_t size;
-
- while (length > 0) {
- /*
- * Copy no more than one megabyte at a time, to allow for GC.
- * (Probably not an issue for STR, since our buffer size is likely
- * much smaller than a megabyte, but just in case...)
- */
- size = (size_t)(length > MBYTE ? MBYTE : length);
-
- bytes = (*env)->GetPrimitiveArrayCritical(env, srcArray, NULL);
- if (bytes == NULL) {
- JNU_ThrowInternalError(env, "Unable to get array");
- return;
- }
-
- memcpy(jlong_to_ptr(dstAddr), bytes + srcPos, size);
-
- (*env)->ReleasePrimitiveArrayCritical(env, srcArray,
- bytes, JNI_ABORT);
-
- length -= size;
- dstAddr += size;
- srcPos += size;
- }
-}