Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3c504251
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看板
提交
3c504251
编写于
10月 21, 2019
作者:
I
igerasim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8230279: Improve Pack200 file reading
Reviewed-by: henryjen, jlaskey
上级
b226215c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
5 deletion
+34
-5
src/share/classes/com/sun/java/util/jar/pack/ClassReader.java
...share/classes/com/sun/java/util/jar/pack/ClassReader.java
+34
-5
未找到文件。
src/share/classes/com/sun/java/util/jar/pack/ClassReader.java
浏览文件 @
3c504251
...
@@ -123,6 +123,13 @@ class ClassReader {
...
@@ -123,6 +123,13 @@ class ClassReader {
return
e
;
return
e
;
}
}
private
Entry
checkValid
(
Entry
e
)
{
if
(
e
==
INVALID_ENTRY
)
{
throw
new
IllegalStateException
(
"Invalid constant pool reference"
);
}
return
e
;
}
/** Throw a ClassFormatException if the entry does not match the expected tag type. */
/** Throw a ClassFormatException if the entry does not match the expected tag type. */
private
Entry
checkTag
(
Entry
e
,
byte
tag
)
throws
ClassFormatException
{
private
Entry
checkTag
(
Entry
e
,
byte
tag
)
throws
ClassFormatException
{
if
(
e
==
null
||
!
e
.
tagMatches
(
tag
))
{
if
(
e
==
null
||
!
e
.
tagMatches
(
tag
))
{
...
@@ -225,6 +232,29 @@ class ClassReader {
...
@@ -225,6 +232,29 @@ class ClassReader {
return
null
;
// OK
return
null
;
// OK
}
}
// use this identity for invalid references
private
static
final
Entry
INVALID_ENTRY
=
new
Entry
((
byte
)
-
1
)
{
@Override
public
boolean
equals
(
Object
o
)
{
throw
new
IllegalStateException
(
"Should not call this"
);
}
@Override
protected
int
computeValueHash
()
{
throw
new
IllegalStateException
(
"Should not call this"
);
}
@Override
public
int
compareTo
(
Object
o
)
{
throw
new
IllegalStateException
(
"Should not call this"
);
}
@Override
public
String
stringValue
()
{
throw
new
IllegalStateException
(
"Should not call this"
);
}
};
void
readConstantPool
()
throws
IOException
{
void
readConstantPool
()
throws
IOException
{
int
length
=
in
.
readUnsignedShort
();
int
length
=
in
.
readUnsignedShort
();
//System.err.println("reading CP, length="+length);
//System.err.println("reading CP, length="+length);
...
@@ -233,7 +263,7 @@ class ClassReader {
...
@@ -233,7 +263,7 @@ class ClassReader {
int
fptr
=
0
;
int
fptr
=
0
;
Entry
[]
cpMap
=
new
Entry
[
length
];
Entry
[]
cpMap
=
new
Entry
[
length
];
cpMap
[
0
]
=
null
;
cpMap
[
0
]
=
INVALID_ENTRY
;
for
(
int
i
=
1
;
i
<
length
;
i
++)
{
for
(
int
i
=
1
;
i
<
length
;
i
++)
{
//System.err.println("reading CP elt, i="+i);
//System.err.println("reading CP elt, i="+i);
int
tag
=
in
.
readByte
();
int
tag
=
in
.
readByte
();
...
@@ -254,13 +284,13 @@ class ClassReader {
...
@@ -254,13 +284,13 @@ class ClassReader {
case
CONSTANT_Long:
case
CONSTANT_Long:
{
{
cpMap
[
i
]
=
ConstantPool
.
getLiteralEntry
(
in
.
readLong
());
cpMap
[
i
]
=
ConstantPool
.
getLiteralEntry
(
in
.
readLong
());
cpMap
[++
i
]
=
null
;
cpMap
[++
i
]
=
INVALID_ENTRY
;
}
}
break
;
break
;
case
CONSTANT_Double:
case
CONSTANT_Double:
{
{
cpMap
[
i
]
=
ConstantPool
.
getLiteralEntry
(
in
.
readDouble
());
cpMap
[
i
]
=
ConstantPool
.
getLiteralEntry
(
in
.
readDouble
());
cpMap
[++
i
]
=
null
;
cpMap
[++
i
]
=
INVALID_ENTRY
;
}
}
break
;
break
;
...
@@ -315,7 +345,7 @@ class ClassReader {
...
@@ -315,7 +345,7 @@ class ClassReader {
int
ref2
=
fixups
[
fi
++];
int
ref2
=
fixups
[
fi
++];
if
(
verbose
>
3
)
if
(
verbose
>
3
)
Utils
.
log
.
fine
(
" cp["
+
cpi
+
"] = "
+
ConstantPool
.
tagName
(
tag
)+
"{"
+
ref
+
","
+
ref2
+
"}"
);
Utils
.
log
.
fine
(
" cp["
+
cpi
+
"] = "
+
ConstantPool
.
tagName
(
tag
)+
"{"
+
ref
+
","
+
ref2
+
"}"
);
if
(
ref
>=
0
&&
c
pMap
[
ref
]
==
null
||
ref2
>=
0
&&
cpMap
[
ref2
]
==
null
)
{
if
(
ref
>=
0
&&
c
heckValid
(
cpMap
[
ref
])
==
null
||
ref2
>=
0
&&
checkValid
(
cpMap
[
ref2
])
==
null
)
{
// Defer.
// Defer.
fixups
[
fptr
++]
=
cpi
;
fixups
[
fptr
++]
=
cpi
;
fixups
[
fptr
++]
=
tag
;
fixups
[
fptr
++]
=
tag
;
...
@@ -364,7 +394,6 @@ class ClassReader {
...
@@ -364,7 +394,6 @@ class ClassReader {
cls
.
cpMap
=
cpMap
;
cls
.
cpMap
=
cpMap
;
}
}
private
/*non-static*/
private
/*non-static*/
class
UnresolvedEntry
extends
Entry
{
class
UnresolvedEntry
extends
Entry
{
final
Object
[]
refsOrIndexes
;
final
Object
[]
refsOrIndexes
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录