Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
70763cd4
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
70763cd4
编写于
8月 31, 2008
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6570619: (bf) DirectByteBuffer.get/put(byte[]) does not scale well
Reviewed-by: iris
上级
1b95ba6d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
70 addition
and
51 deletion
+70
-51
make/java/java/mapfile-vers
make/java/java/mapfile-vers
+0
-2
src/share/classes/java/nio/Bits.java
src/share/classes/java/nio/Bits.java
+58
-4
src/share/classes/java/nio/Direct-X-Buffer.java
src/share/classes/java/nio/Direct-X-Buffer.java
+12
-5
src/share/native/java/nio/Bits.c
src/share/native/java/nio/Bits.c
+0
-40
未找到文件。
make/java/java/mapfile-vers
浏览文件 @
70763cd4
...
...
@@ -222,8 +222,6 @@ SUNWprivate_1.1 {
Java_java_lang_UNIXProcess_waitForProcessExit;
Java_java_lang_UNIXProcess_forkAndExec;
Java_java_lang_UNIXProcess_destroyProcess;
Java_java_nio_Bits_copyFromByteArray;
Java_java_nio_Bits_copyToByteArray;
Java_java_nio_Bits_copyFromShortArray;
Java_java_nio_Bits_copyToShortArray;
Java_java_nio_Bits_copyFromIntArray;
...
...
src/share/classes/java/nio/Bits.java
浏览文件 @
70763cd4
...
...
@@ -735,14 +735,68 @@ class Bits { // package-private
static
final
int
JNI_COPY_TO_ARRAY_THRESHOLD
=
6
;
static
final
int
JNI_COPY_FROM_ARRAY_THRESHOLD
=
6
;
// This number limits the number of bytes to copy per call to Unsafe's
// copyMemory method. A limit is imposed to allow for safepoint polling
// during a large copy
static
final
long
UNSAFE_COPY_THRESHOLD
=
1024L
*
1024L
;
// These methods do no bounds checking. Verification that the copy will not
// result in memory corruption should be done prior to invocation.
// All positions and lengths are specified in bytes.
static
native
void
copyFromByteArray
(
Object
src
,
long
srcPos
,
long
dstAddr
,
long
length
);
static
native
void
copyToByteArray
(
long
srcAddr
,
Object
dst
,
long
dstPos
,
long
length
);
/**
* Copy from given source array to destination address.
*
* @param src
* source array
* @param srcBaseOffset
* offset of first element of storage in source array
* @param srcPos
* offset within source array of the first element to read
* @param dstAddr
* destination address
* @param length
* number of bytes to copy
*/
static
void
copyFromArray
(
Object
src
,
long
srcBaseOffset
,
long
srcPos
,
long
dstAddr
,
long
length
)
{
long
offset
=
srcBaseOffset
+
srcPos
;
while
(
length
>
0
)
{
long
size
=
(
length
>
UNSAFE_COPY_THRESHOLD
)
?
UNSAFE_COPY_THRESHOLD
:
length
;
unsafe
.
copyMemory
(
src
,
offset
,
null
,
dstAddr
,
size
);
length
-=
size
;
offset
+=
size
;
dstAddr
+=
size
;
}
}
/**
* Copy from source address into given destination array.
*
* @param srcAddr
* source address
* @param dst
* destination array
* @param dstBaseOffset
* offset of first element of storage in destination array
* @param dstPos
* offset within destination array of the first element to write
* @param length
* number of bytes to copy
*/
static
void
copyToArray
(
long
srcAddr
,
Object
dst
,
long
dstBaseOffset
,
long
dstPos
,
long
length
)
{
long
offset
=
dstBaseOffset
+
dstPos
;
while
(
length
>
0
)
{
long
size
=
(
length
>
UNSAFE_COPY_THRESHOLD
)
?
UNSAFE_COPY_THRESHOLD
:
length
;
unsafe
.
copyMemory
(
null
,
srcAddr
,
dst
,
offset
,
size
);
length
-=
size
;
srcAddr
+=
size
;
offset
+=
size
;
}
}
static
void
copyFromCharArray
(
Object
src
,
long
srcPos
,
long
dstAddr
,
long
length
)
...
...
src/share/classes/java/nio/Direct-X-Buffer.java
浏览文件 @
70763cd4
...
...
@@ -47,6 +47,9 @@ class Direct$Type$Buffer$RW$$BO$
// Cached unsafe-access object
protected
static
final
Unsafe
unsafe
=
Bits
.
unsafe
();
// Cached array base offset
private
static
final
long
arrayBaseOffset
=
(
long
)
unsafe
.
arrayBaseOffset
(
$type
$
[].
class
);
// Cached unaligned-access capability
protected
static
final
boolean
unaligned
=
Bits
.
unaligned
();
...
...
@@ -242,14 +245,16 @@ class Direct$Type$Buffer$RW$$BO$
if
(
length
>
rem
)
throw
new
BufferUnderflowException
();
#
if
[!
byte
]
if
(
order
()
!=
ByteOrder
.
nativeOrder
())
Bits
.
copyTo
$Memtype$Array
(
ix
(
pos
),
dst
,
offset
<<
$LG_BYTES_PER_VALUE
$
,
length
<<
$LG_BYTES_PER_VALUE
$
);
else
Bits
.
copyToByteArray
(
ix
(
pos
),
dst
,
offset
<<
$LG_BYTES_PER_VALUE
$
,
length
<<
$LG_BYTES_PER_VALUE
$
);
#
end
[!
byte
]
Bits
.
copyToArray
(
ix
(
pos
),
dst
,
arrayBaseOffset
,
offset
<<
$LG_BYTES_PER_VALUE
$
,
length
<<
$LG_BYTES_PER_VALUE
$
);
position
(
pos
+
length
);
}
else
{
super
.
get
(
dst
,
offset
,
length
);
...
...
@@ -332,12 +337,14 @@ class Direct$Type$Buffer$RW$$BO$
if
(
length
>
rem
)
throw
new
BufferOverflowException
();
#
if
[!
byte
]
if
(
order
()
!=
ByteOrder
.
nativeOrder
())
Bits
.
copyFrom
$Memtype$Array
(
src
,
offset
<<
$LG_BYTES_PER_VALUE
$
,
ix
(
pos
),
length
<<
$LG_BYTES_PER_VALUE
$
);
else
Bits
.
copyFromByteArray
(
src
,
offset
<<
$LG_BYTES_PER_VALUE
$
,
ix
(
pos
),
length
<<
$LG_BYTES_PER_VALUE
$
);
#
end
[!
byte
]
Bits
.
copyFromArray
(
src
,
arrayBaseOffset
,
offset
<<
$LG_BYTES_PER_VALUE
$
,
ix
(
pos
),
length
<<
$LG_BYTES_PER_VALUE
$
);
position
(
pos
+
length
);
}
else
{
super
.
put
(
src
,
offset
,
length
);
...
...
src/share/native/java/nio/Bits.c
浏览文件 @
70763cd4
...
...
@@ -67,46 +67,6 @@
#define SWAPLONG(x) ((jlong)(((jlong)SWAPINT((jint)(x)) << 32) | \
((jlong)SWAPINT((jint)((x) >> 32)) & 0xffffffff)))
JNIEXPORT
void
JNICALL
Java_java_nio_Bits_copyFromByteArray
(
JNIEnv
*
env
,
jobject
this
,
jobject
src
,
jlong
srcPos
,
jlong
dstAddr
,
jlong
length
)
{
jbyte
*
bytes
;
size_t
size
;
while
(
length
>
0
)
{
size
=
(
length
>
MBYTE
?
MBYTE
:
length
);
GETCRITICAL
(
bytes
,
env
,
src
);
memcpy
((
void
*
)
dstAddr
,
bytes
+
srcPos
,
size
);
RELEASECRITICAL
(
bytes
,
env
,
src
,
JNI_ABORT
);
length
-=
size
;
dstAddr
+=
size
;
srcPos
+=
size
;
}
}
JNIEXPORT
void
JNICALL
Java_java_nio_Bits_copyToByteArray
(
JNIEnv
*
env
,
jobject
this
,
jlong
srcAddr
,
jobject
dst
,
jlong
dstPos
,
jlong
length
)
{
jbyte
*
bytes
;
size_t
size
;
while
(
length
>
0
)
{
size
=
(
length
>
MBYTE
?
MBYTE
:
length
);
GETCRITICAL
(
bytes
,
env
,
dst
);
memcpy
(
bytes
+
dstPos
,
(
void
*
)
srcAddr
,
size
);
RELEASECRITICAL
(
bytes
,
env
,
dst
,
0
);
length
-=
size
;
srcAddr
+=
size
;
dstPos
+=
size
;
}
}
JNIEXPORT
void
JNICALL
Java_java_nio_Bits_copyFromShortArray
(
JNIEnv
*
env
,
jobject
this
,
jobject
src
,
jlong
srcPos
,
jlong
dstAddr
,
jlong
length
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录