Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
2939dd56
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看板
提交
2939dd56
编写于
7月 12, 2010
作者:
N
never
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6958668: repeated uncommon trapping for new of klass which is being initialized
Reviewed-by: kvn, jrose
上级
7dfc0570
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
69 addition
and
35 deletion
+69
-35
src/share/vm/ci/ciInstanceKlass.cpp
src/share/vm/ci/ciInstanceKlass.cpp
+5
-19
src/share/vm/ci/ciInstanceKlass.hpp
src/share/vm/ci/ciInstanceKlass.hpp
+19
-13
src/share/vm/opto/doCall.cpp
src/share/vm/opto/doCall.cpp
+2
-1
src/share/vm/opto/parse.hpp
src/share/vm/opto/parse.hpp
+1
-0
src/share/vm/opto/parseHelper.cpp
src/share/vm/opto/parseHelper.cpp
+42
-2
未找到文件。
src/share/vm/ci/ciInstanceKlass.cpp
浏览文件 @
2939dd56
/*
* Copyright (c) 1999, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
10
, 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
...
...
@@ -44,9 +44,7 @@ ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
_flags
=
ciFlags
(
access_flags
);
_has_finalizer
=
access_flags
.
has_finalizer
();
_has_subklass
=
ik
->
subklass
()
!=
NULL
;
_is_initialized
=
ik
->
is_initialized
();
// Next line must follow and use the result of the previous line:
_is_linked
=
_is_initialized
||
ik
->
is_linked
();
_init_state
=
(
instanceKlass
::
ClassState
)
ik
->
get_init_state
();
_nonstatic_field_size
=
ik
->
nonstatic_field_size
();
_has_nonstatic_fields
=
ik
->
has_nonstatic_fields
();
_nonstatic_fields
=
NULL
;
// initialized lazily by compute_nonstatic_fields:
...
...
@@ -91,8 +89,7 @@ ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
:
ciKlass
(
name
,
ciInstanceKlassKlass
::
make
())
{
assert
(
name
->
byte_at
(
0
)
!=
'['
,
"not an instance klass"
);
_is_initialized
=
false
;
_is_linked
=
false
;
_init_state
=
(
instanceKlass
::
ClassState
)
0
;
_nonstatic_field_size
=
-
1
;
_has_nonstatic_fields
=
false
;
_nonstatic_fields
=
NULL
;
...
...
@@ -109,21 +106,10 @@ ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
// ------------------------------------------------------------------
// ciInstanceKlass::compute_shared_is_initialized
bool
ciInstanceKlass
::
compute_shared_is_initialized
()
{
void
ciInstanceKlass
::
compute_shared_init_state
()
{
GUARDED_VM_ENTRY
(
instanceKlass
*
ik
=
get_instanceKlass
();
_is_initialized
=
ik
->
is_initialized
();
return
_is_initialized
;
)
}
// ------------------------------------------------------------------
// ciInstanceKlass::compute_shared_is_linked
bool
ciInstanceKlass
::
compute_shared_is_linked
()
{
GUARDED_VM_ENTRY
(
instanceKlass
*
ik
=
get_instanceKlass
();
_is_linked
=
ik
->
is_linked
();
return
_is_linked
;
_init_state
=
(
instanceKlass
::
ClassState
)
ik
->
get_init_state
();
)
}
...
...
src/share/vm/ci/ciInstanceKlass.hpp
浏览文件 @
2939dd56
/*
* Copyright (c) 1999, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
10
, 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
...
...
@@ -39,9 +39,8 @@ private:
jobject
_loader
;
jobject
_protection_domain
;
instanceKlass
::
ClassState
_init_state
;
// state of class
bool
_is_shared
;
bool
_is_initialized
;
bool
_is_linked
;
bool
_has_finalizer
;
bool
_has_subklass
;
bool
_has_nonstatic_fields
;
...
...
@@ -87,27 +86,34 @@ protected:
bool
is_shared
()
{
return
_is_shared
;
}
bool
compute_shared_is_initialized
();
bool
compute_shared_is_linked
();
void
compute_shared_init_state
();
bool
compute_shared_has_subklass
();
int
compute_shared_nof_implementors
();
int
compute_nonstatic_fields
();
GrowableArray
<
ciField
*>*
compute_nonstatic_fields_impl
(
GrowableArray
<
ciField
*>*
super_fields
);
// Update the init_state for shared klasses
void
update_if_shared
(
instanceKlass
::
ClassState
expected
)
{
if
(
_is_shared
&&
_init_state
!=
expected
)
{
if
(
is_loaded
())
compute_shared_init_state
();
}
}
public:
// Has this klass been initialized?
bool
is_initialized
()
{
if
(
_is_shared
&&
!
_is_initialized
)
{
return
is_loaded
()
&&
compute_shared_is_initialized
();
}
return
_is_initialized
;
update_if_shared
(
instanceKlass
::
fully_initialized
);
return
_init_state
==
instanceKlass
::
fully_initialized
;
}
// Is this klass being initialized?
bool
is_being_initialized
()
{
update_if_shared
(
instanceKlass
::
being_initialized
);
return
_init_state
==
instanceKlass
::
being_initialized
;
}
// Has this klass been linked?
bool
is_linked
()
{
if
(
_is_shared
&&
!
_is_linked
)
{
return
is_loaded
()
&&
compute_shared_is_linked
();
}
return
_is_linked
;
update_if_shared
(
instanceKlass
::
linked
);
return
_init_state
>=
instanceKlass
::
linked
;
}
// General klass information.
...
...
src/share/vm/opto/doCall.cpp
浏览文件 @
2939dd56
...
...
@@ -343,7 +343,8 @@ bool Parse::can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass* kl
// being initialized. Uncommon-trap for not-initialized static or
// v-calls. Let interface calls happen.
ciInstanceKlass
*
holder_klass
=
dest_method
->
holder
();
if
(
!
holder_klass
->
is_initialized
()
&&
if
(
!
holder_klass
->
is_being_initialized
()
&&
!
holder_klass
->
is_initialized
()
&&
!
holder_klass
->
is_interface
())
{
uncommon_trap
(
Deoptimization
::
Reason_uninitialized
,
Deoptimization
::
Action_reinterpret
,
...
...
src/share/vm/opto/parse.hpp
浏览文件 @
2939dd56
...
...
@@ -480,6 +480,7 @@ class Parse : public GraphKit {
bool
push_constant
(
ciConstant
con
,
bool
require_constant
=
false
);
// implementation of object creation bytecodes
void
emit_guard_for_new
(
ciInstanceKlass
*
klass
);
void
do_new
();
void
do_newarray
(
BasicType
elemtype
);
void
do_anewarray
();
...
...
src/share/vm/opto/parseHelper.cpp
浏览文件 @
2939dd56
/*
* Copyright (c) 1998, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
10
, 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
...
...
@@ -197,6 +197,43 @@ void Parse::array_store_check() {
}
void
Parse
::
emit_guard_for_new
(
ciInstanceKlass
*
klass
)
{
// Emit guarded new
// if (klass->_init_thread != current_thread ||
// klass->_init_state != being_initialized)
// uncommon_trap
Node
*
cur_thread
=
_gvn
.
transform
(
new
(
C
,
1
)
ThreadLocalNode
()
);
Node
*
merge
=
new
(
C
,
3
)
RegionNode
(
3
);
_gvn
.
set_type
(
merge
,
Type
::
CONTROL
);
Node
*
kls
=
makecon
(
TypeKlassPtr
::
make
(
klass
));
Node
*
init_thread_offset
=
_gvn
.
MakeConX
(
instanceKlass
::
init_thread_offset_in_bytes
()
+
klassOopDesc
::
klass_part_offset_in_bytes
());
Node
*
adr_node
=
basic_plus_adr
(
kls
,
kls
,
init_thread_offset
);
Node
*
init_thread
=
make_load
(
NULL
,
adr_node
,
TypeRawPtr
::
BOTTOM
,
T_ADDRESS
);
Node
*
tst
=
Bool
(
CmpP
(
init_thread
,
cur_thread
),
BoolTest
::
eq
);
IfNode
*
iff
=
create_and_map_if
(
control
(),
tst
,
PROB_ALWAYS
,
COUNT_UNKNOWN
);
set_control
(
IfTrue
(
iff
));
merge
->
set_req
(
1
,
IfFalse
(
iff
));
Node
*
init_state_offset
=
_gvn
.
MakeConX
(
instanceKlass
::
init_state_offset_in_bytes
()
+
klassOopDesc
::
klass_part_offset_in_bytes
());
adr_node
=
basic_plus_adr
(
kls
,
kls
,
init_state_offset
);
Node
*
init_state
=
make_load
(
NULL
,
adr_node
,
TypeInt
::
INT
,
T_INT
);
Node
*
being_init
=
_gvn
.
intcon
(
instanceKlass
::
being_initialized
);
tst
=
Bool
(
CmpI
(
init_state
,
being_init
),
BoolTest
::
eq
);
iff
=
create_and_map_if
(
control
(),
tst
,
PROB_ALWAYS
,
COUNT_UNKNOWN
);
set_control
(
IfTrue
(
iff
));
merge
->
set_req
(
2
,
IfFalse
(
iff
));
PreserveJVMState
pjvms
(
this
);
record_for_igvn
(
merge
);
set_control
(
merge
);
uncommon_trap
(
Deoptimization
::
Reason_uninitialized
,
Deoptimization
::
Action_reinterpret
,
klass
);
}
//------------------------------do_new-----------------------------------------
void
Parse
::
do_new
()
{
kill_dead_locals
();
...
...
@@ -206,7 +243,7 @@ void Parse::do_new() {
assert
(
will_link
,
"_new: typeflow responsibility"
);
// Should initialize, or throw an InstantiationError?
if
(
!
klass
->
is_initialized
()
||
if
(
!
klass
->
is_initialized
()
&&
!
klass
->
is_being_initialized
()
||
klass
->
is_abstract
()
||
klass
->
is_interface
()
||
klass
->
name
()
==
ciSymbol
::
java_lang_Class
()
||
iter
().
is_unresolved_klass
())
{
...
...
@@ -215,6 +252,9 @@ void Parse::do_new() {
klass
);
return
;
}
if
(
klass
->
is_being_initialized
())
{
emit_guard_for_new
(
klass
);
}
Node
*
kls
=
makecon
(
TypeKlassPtr
::
make
(
klass
));
Node
*
obj
=
new_instance
(
kls
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录