Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
294fc162
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
294fc162
编写于
11月 02, 2016
作者:
K
kevinw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8167104: Additional class construction refinements
Reviewed-by: hseigel
上级
0a788d8f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
70 deletion
+27
-70
src/share/vm/classfile/stackMapFrame.cpp
src/share/vm/classfile/stackMapFrame.cpp
+3
-43
src/share/vm/classfile/stackMapFrame.hpp
src/share/vm/classfile/stackMapFrame.hpp
+2
-5
src/share/vm/classfile/stackMapTable.cpp
src/share/vm/classfile/stackMapTable.cpp
+11
-12
src/share/vm/classfile/stackMapTable.hpp
src/share/vm/classfile/stackMapTable.hpp
+3
-3
src/share/vm/classfile/verifier.cpp
src/share/vm/classfile/verifier.cpp
+2
-2
test/runtime/handlerInTry/LoadHandlerInTry.java
test/runtime/handlerInTry/LoadHandlerInTry.java
+6
-5
未找到文件。
src/share/vm/classfile/stackMapFrame.cpp
浏览文件 @
294fc162
/*
* Copyright (c) 2003, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
6
, 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
...
...
@@ -155,47 +155,8 @@ int StackMapFrame::is_assignable_to(
return
i
;
}
bool
StackMapFrame
::
has_flag_match_exception
(
const
StackMapFrame
*
target
)
const
{
// We allow flags of {UninitThis} to assign to {} if-and-only-if the
// target frame does not depend upon the current type.
// This is slightly too strict, as we need only enforce that the
// slots that were initialized by the <init> (the things that were
// UninitializedThis before initialize_object() converted them) are unused.
// However we didn't save that information so we'll enforce this upon
// anything that might have been initialized. This is a rare situation
// and javac never generates code that would end up here, but some profilers
// (such as NetBeans) might, when adding exception handlers in <init>
// methods to cover the invokespecial instruction. See 7020118.
assert
(
max_locals
()
==
target
->
max_locals
()
&&
stack_size
()
==
target
->
stack_size
(),
"StackMap sizes must match"
);
VerificationType
top
=
VerificationType
::
top_type
();
VerificationType
this_type
=
verifier
()
->
current_type
();
if
(
!
flag_this_uninit
()
||
target
->
flags
()
!=
0
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
target
->
locals_size
();
++
i
)
{
if
(
locals
()[
i
]
==
this_type
&&
target
->
locals
()[
i
]
!=
top
)
{
return
false
;
}
}
for
(
int
i
=
0
;
i
<
target
->
stack_size
();
++
i
)
{
if
(
stack
()[
i
]
==
this_type
&&
target
->
stack
()[
i
]
!=
top
)
{
return
false
;
}
}
return
true
;
}
bool
StackMapFrame
::
is_assignable_to
(
const
StackMapFrame
*
target
,
bool
is_exception_handler
,
ErrorContext
*
ctx
,
TRAPS
)
const
{
const
StackMapFrame
*
target
,
ErrorContext
*
ctx
,
TRAPS
)
const
{
if
(
_max_locals
!=
target
->
max_locals
())
{
*
ctx
=
ErrorContext
::
locals_size_mismatch
(
_offset
,
(
StackMapFrame
*
)
this
,
(
StackMapFrame
*
)
target
);
...
...
@@ -226,8 +187,7 @@ bool StackMapFrame::is_assignable_to(
return
false
;
}
bool
match_flags
=
(
_flags
|
target
->
flags
())
==
target
->
flags
();
if
(
match_flags
||
is_exception_handler
&&
has_flag_match_exception
(
target
))
{
if
((
_flags
|
target
->
flags
())
==
target
->
flags
())
{
return
true
;
}
else
{
*
ctx
=
ErrorContext
::
bad_flags
(
target
->
offset
(),
...
...
src/share/vm/classfile/stackMapFrame.hpp
浏览文件 @
294fc162
/*
* Copyright (c) 2003, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
6
, 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
...
...
@@ -167,8 +167,7 @@ class StackMapFrame : public ResourceObj {
// Return true if this stack map frame is assignable to target.
bool
is_assignable_to
(
const
StackMapFrame
*
target
,
bool
is_exception_handler
,
ErrorContext
*
ctx
,
TRAPS
)
const
;
const
StackMapFrame
*
target
,
ErrorContext
*
ctx
,
TRAPS
)
const
;
inline
void
set_mark
()
{
#ifdef ASSERT
...
...
@@ -290,8 +289,6 @@ class StackMapFrame : public ResourceObj {
int
is_assignable_to
(
VerificationType
*
src
,
VerificationType
*
target
,
int32_t
len
,
TRAPS
)
const
;
bool
has_flag_match_exception
(
const
StackMapFrame
*
target
)
const
;
TypeOrigin
stack_top_ctx
();
void
print_on
(
outputStream
*
str
)
const
;
...
...
src/share/vm/classfile/stackMapTable.cpp
浏览文件 @
294fc162
/*
* Copyright (c) 2003, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
6
, 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
...
...
@@ -70,26 +70,25 @@ int StackMapTable::get_index_from_offset(int32_t offset) const {
bool
StackMapTable
::
match_stackmap
(
StackMapFrame
*
frame
,
int32_t
target
,
bool
match
,
bool
update
,
bool
handler
,
ErrorContext
*
ctx
,
TRAPS
)
const
{
bool
match
,
bool
update
,
ErrorContext
*
ctx
,
TRAPS
)
const
{
int
index
=
get_index_from_offset
(
target
);
return
match_stackmap
(
frame
,
target
,
index
,
match
,
update
,
handler
,
ctx
,
THREAD
);
return
match_stackmap
(
frame
,
target
,
index
,
match
,
update
,
ctx
,
THREAD
);
}
// Match and/or update current_frame to the frame in stackmap table with
// specified offset and frame index. Return true if the two frames match.
// handler is true if the frame in stackmap_table is for an exception handler.
//
// The values of match and update are: _match__update
__handler
// The values of match and update are: _match__update
//
// checking a branch target: true false
false
// checking an exception handler: true false
true
// checking a branch target: true false
// checking an exception handler: true false
// linear bytecode verification following an
// unconditional branch: false true
false
// unconditional branch: false true
// linear bytecode verification not following an
// unconditional branch: true true
false
// unconditional branch: true true
bool
StackMapTable
::
match_stackmap
(
StackMapFrame
*
frame
,
int32_t
target
,
int32_t
frame_index
,
bool
match
,
bool
update
,
bool
handler
,
ErrorContext
*
ctx
,
TRAPS
)
const
{
bool
match
,
bool
update
,
ErrorContext
*
ctx
,
TRAPS
)
const
{
if
(
frame_index
<
0
||
frame_index
>=
_frame_count
)
{
*
ctx
=
ErrorContext
::
missing_stackmap
(
frame
->
offset
());
frame
->
verifier
()
->
verify_error
(
...
...
@@ -102,7 +101,7 @@ bool StackMapTable::match_stackmap(
if
(
match
)
{
// Has direct control flow from last instruction, need to match the two
// frames.
result
=
frame
->
is_assignable_to
(
stackmap_frame
,
handler
,
result
=
frame
->
is_assignable_to
(
stackmap_frame
,
ctx
,
CHECK_VERIFY_
(
frame
->
verifier
(),
result
));
}
if
(
update
)
{
...
...
@@ -126,7 +125,7 @@ void StackMapTable::check_jump_target(
StackMapFrame
*
frame
,
int32_t
target
,
TRAPS
)
const
{
ErrorContext
ctx
;
bool
match
=
match_stackmap
(
frame
,
target
,
true
,
false
,
false
,
&
ctx
,
CHECK_VERIFY
(
frame
->
verifier
()));
frame
,
target
,
true
,
false
,
&
ctx
,
CHECK_VERIFY
(
frame
->
verifier
()));
if
(
!
match
||
(
target
<
0
||
target
>=
_code_length
))
{
frame
->
verifier
()
->
verify_error
(
ctx
,
"Inconsistent stackmap frames at branch target %d"
,
target
);
...
...
src/share/vm/classfile/stackMapTable.hpp
浏览文件 @
294fc162
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
6
, 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
...
...
@@ -74,12 +74,12 @@ class StackMapTable : public StackObj {
// specified offset. Return true if the two frames match.
bool
match_stackmap
(
StackMapFrame
*
current_frame
,
int32_t
offset
,
bool
match
,
bool
update
,
bool
handler
,
ErrorContext
*
ctx
,
TRAPS
)
const
;
bool
match
,
bool
update
,
ErrorContext
*
ctx
,
TRAPS
)
const
;
// Match and/or update current_frame to the frame in stackmap table with
// specified offset and frame index. Return true if the two frames match.
bool
match_stackmap
(
StackMapFrame
*
current_frame
,
int32_t
offset
,
int32_t
frame_index
,
bool
match
,
bool
update
,
bool
handler
,
ErrorContext
*
ctx
,
TRAPS
)
const
;
bool
match
,
bool
update
,
ErrorContext
*
ctx
,
TRAPS
)
const
;
// Check jump instructions. Make sure there are no uninitialized
// instances on backward branch.
...
...
src/share/vm/classfile/verifier.cpp
浏览文件 @
294fc162
...
...
@@ -1814,7 +1814,7 @@ u2 ClassVerifier::verify_stackmap_table(u2 stackmap_index, u2 bci,
// If matched, current_frame will be updated by this method.
bool
matches
=
stackmap_table
->
match_stackmap
(
current_frame
,
this_offset
,
stackmap_index
,
!
no_control_flow
,
true
,
false
,
&
ctx
,
CHECK_VERIFY_
(
this
,
0
));
!
no_control_flow
,
true
,
&
ctx
,
CHECK_VERIFY_
(
this
,
0
));
if
(
!
matches
)
{
// report type error
verify_error
(
ctx
,
"Instruction type does not match stack map"
);
...
...
@@ -1861,7 +1861,7 @@ void ClassVerifier::verify_exception_handler_targets(u2 bci, bool this_uninit, S
}
ErrorContext
ctx
;
bool
matches
=
stackmap_table
->
match_stackmap
(
new_frame
,
handler_pc
,
true
,
false
,
true
,
&
ctx
,
CHECK_VERIFY
(
this
));
new_frame
,
handler_pc
,
true
,
false
,
&
ctx
,
CHECK_VERIFY
(
this
));
if
(
!
matches
)
{
verify_error
(
ctx
,
"Stack map does not match the one at "
"exception handler %d"
,
handler_pc
);
...
...
test/runtime/handlerInTry/LoadHandlerInTry.java
浏览文件 @
294fc162
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015,
2016,
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
...
...
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8075118
* @summary
Allow a ctor to call super() from a switch bytecode.
* @summary
JVM stuck in infinite loop during verification
* @compile HandlerInTry.jasm
* @compile IsolatedHandlerInTry.jasm
* @run main/othervm -Xverify:all LoadHandlerInTry
...
...
@@ -70,9 +70,10 @@ public class LoadHandlerInTry {
System
.
out
.
println
(
"Regression test for bug 8075118"
);
try
{
Class
newClass
=
Class
.
forName
(
"HandlerInTry"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed: Exception was thrown: "
+
e
.
toString
());
throw
e
;
throw
new
RuntimeException
(
"Failed to throw VerifyError for HandlerInTry"
);
}
catch
(
java
.
lang
.
VerifyError
e
)
{
System
.
out
.
println
(
"Passed: VerifyError exception was thrown"
);
}
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录