Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
28604a53
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看板
提交
28604a53
编写于
10月 16, 2012
作者:
K
ksrini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7186946: Refine unpacker resource usage
Reviewed-by: jrose, jjh, mschoene
上级
fb7c4351
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
18 deletion
+42
-18
src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
...hare/classes/com/sun/java/util/jar/pack/NativeUnpack.java
+5
-1
src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
+2
-2
src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
...hare/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
+3
-3
src/share/native/com/sun/java/util/jar/pack/jni.cpp
src/share/native/com/sun/java/util/jar/pack/jni.cpp
+29
-11
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+3
-1
未找到文件。
src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
浏览文件 @
28604a53
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
2
, 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
...
...
@@ -109,6 +109,10 @@ class NativeUnpack {
return
(
p200
==
null
)?
null
:
p200
.
_nunp
;
}
private
synchronized
long
getUnpackerPtr
()
{
return
unpackerPtr
;
}
// Callback from the unpacker engine to get more data.
private
long
readInputFn
(
ByteBuffer
pbuf
,
long
minlen
)
throws
IOException
{
if
(
in
==
null
)
return
0
;
// nothing is readable
...
...
src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
浏览文件 @
28604a53
...
...
@@ -83,7 +83,7 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
* @param out an OutputStream
* @exception IOException if an error is encountered.
*/
public
void
pack
(
JarFile
in
,
OutputStream
out
)
throws
IOException
{
public
synchronized
void
pack
(
JarFile
in
,
OutputStream
out
)
throws
IOException
{
assert
(
Utils
.
currentInstance
.
get
()
==
null
);
TimeZone
tz
=
(
props
.
getBoolean
(
Utils
.
PACK_DEFAULT_TIMEZONE
))
?
null
...
...
@@ -118,7 +118,7 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
* @param out an OutputStream
* @exception IOException if an error is encountered.
*/
public
void
pack
(
JarInputStream
in
,
OutputStream
out
)
throws
IOException
{
public
synchronized
void
pack
(
JarInputStream
in
,
OutputStream
out
)
throws
IOException
{
assert
(
Utils
.
currentInstance
.
get
()
==
null
);
TimeZone
tz
=
(
props
.
getBoolean
(
Utils
.
PACK_DEFAULT_TIMEZONE
))
?
null
:
TimeZone
.
getDefault
();
...
...
src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
浏览文件 @
28604a53
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
2
, 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
...
...
@@ -106,7 +106,7 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
* @param out a JarOutputStream.
* @exception IOException if an error is encountered.
*/
public
void
unpack
(
InputStream
in
,
JarOutputStream
out
)
throws
IOException
{
public
synchronized
void
unpack
(
InputStream
in
,
JarOutputStream
out
)
throws
IOException
{
if
(
in
==
null
)
{
throw
new
NullPointerException
(
"null input"
);
}
...
...
@@ -151,7 +151,7 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
* @param out a JarOutputStream.
* @exception IOException if an error is encountered.
*/
public
void
unpack
(
File
in
,
JarOutputStream
out
)
throws
IOException
{
public
synchronized
void
unpack
(
File
in
,
JarOutputStream
out
)
throws
IOException
{
if
(
in
==
null
)
{
throw
new
NullPointerException
(
"null input"
);
}
...
...
src/share/native/com/sun/java/util/jar/pack/jni.cpp
浏览文件 @
28604a53
...
...
@@ -50,6 +50,7 @@ static jfieldID unpackerPtrFID;
static
jmethodID
currentInstMID
;
static
jmethodID
readInputMID
;
static
jclass
NIclazz
;
static
jmethodID
getUnpackerPtrMID
;
static
char
*
dbg
=
null
;
...
...
@@ -60,8 +61,8 @@ static jlong read_input_via_jni(unpacker* self,
static
unpacker
*
get_unpacker
(
JNIEnv
*
env
,
jobject
pObj
,
bool
noCreate
=
false
)
{
unpacker
*
uPtr
;
uPtr
=
(
unpacker
*
)
jlong2ptr
(
env
->
GetLongField
(
pObj
,
unpackerPtrFID
)
);
//fprintf(stderr, "get_unpacker(%p) uPtr=%p\n", pObj, uPtr
);
jlong
p
=
env
->
CallLongMethod
(
pObj
,
getUnpackerPtrMID
);
uPtr
=
(
unpacker
*
)
jlong2ptr
(
p
);
if
(
uPtr
==
null
)
{
if
(
noCreate
)
return
null
;
uPtr
=
new
unpacker
();
...
...
@@ -94,11 +95,15 @@ static unpacker* get_unpacker() {
if
(
env
==
null
)
return
null
;
jobject
pObj
=
env
->
CallStaticObjectMethod
(
NIclazz
,
currentInstMID
);
//fprintf(stderr, "get_unpacker() pObj=%p\n", pObj);
if
(
pObj
==
null
)
return
null
;
// Got pObj and env; now do it the easy way.
return
get_unpacker
(
env
,
pObj
);
//fprintf(stderr, "get_unpacker0() pObj=%p\n", pObj);
if
(
pObj
!=
null
)
{
// Got pObj and env; now do it the easy way.
return
get_unpacker
(
env
,
pObj
);
}
// this should really not happen, if it does something is seriously
// wrong throw an exception
THROW_IOE
(
ERROR_INTERNAL
);
return
null
;
}
static
void
free_unpacker
(
JNIEnv
*
env
,
jobject
pObj
,
unpacker
*
uPtr
)
{
...
...
@@ -137,10 +142,13 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_initIDs(JNIEnv *env, jclass clazz)
"()Ljava/lang/Object;"
);
readInputMID
=
env
->
GetMethodID
(
clazz
,
"readInputFn"
,
"(Ljava/nio/ByteBuffer;J)J"
);
getUnpackerPtrMID
=
env
->
GetMethodID
(
clazz
,
"getUnpackerPtr"
,
"()J"
);
if
(
unpackerPtrFID
==
null
||
currentInstMID
==
null
||
readInputMID
==
null
||
NIclazz
==
null
)
{
NIclazz
==
null
||
getUnpackerPtrMID
==
null
)
{
THROW_IOE
(
"cannot init class members"
);
}
}
...
...
@@ -148,8 +156,13 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_initIDs(JNIEnv *env, jclass clazz)
JNIEXPORT
jlong
JNICALL
Java_com_sun_java_util_jar_pack_NativeUnpack_start
(
JNIEnv
*
env
,
jobject
pObj
,
jobject
pBuf
,
jlong
offset
)
{
unpacker
*
uPtr
=
get_unpacker
(
env
,
pObj
);
// try to get the unpacker pointer the hard way first, we do this to ensure
// valid object pointers and env is intact, if not now is good time to bail.
unpacker
*
uPtr
=
get_unpacker
();
//fprintf(stderr, "start(%p) uPtr=%p initializing\n", pObj, uPtr);
if
(
uPtr
==
null
)
{
return
-
1
;
}
// redirect our io to the default log file or whatever.
uPtr
->
redirect_stdio
();
...
...
@@ -165,7 +178,12 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_start(JNIEnv *env, jobject pObj,
else
{
buf
=
(
char
*
)
buf
+
(
size_t
)
offset
;
buflen
-=
(
size_t
)
offset
;
}
}
// before we start off we make sure there is no other error by the time we
// get here
if
(
uPtr
->
aborting
())
{
THROW_IOE
(
uPtr
->
get_abort_message
());
return
0
;
}
uPtr
->
start
(
buf
,
buflen
);
if
(
uPtr
->
aborting
())
{
THROW_IOE
(
uPtr
->
get_abort_message
());
...
...
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
浏览文件 @
28604a53
...
...
@@ -3117,7 +3117,7 @@ void unpacker::read_bcs() {
void
unpacker
::
read_bands
()
{
byte
*
rp0
=
rp
;
CHECK
;
read_file_header
();
CHECK
;
...
...
@@ -3879,10 +3879,12 @@ void unpacker::dump_options() {
// packed file and len is the length of the buffer.
// If null, the callback is used to fill an internal buffer.
void
unpacker
::
start
(
void
*
packptr
,
size_t
len
)
{
CHECK
;
NOT_PRODUCT
(
debug_u
=
this
);
if
(
packptr
!=
null
&&
len
!=
0
)
{
inbytes
.
set
((
byte
*
)
packptr
,
len
);
}
CHECK
;
read_bands
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录