Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
93cefacc
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看板
提交
93cefacc
编写于
11月 11, 2009
作者:
A
acorn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6893504: LinkageError for bootstrap duplicate class definitions.
Reviewed-by: kamg, xlu
上级
6652bf0c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
8 deletion
+23
-8
src/share/vm/classfile/systemDictionary.cpp
src/share/vm/classfile/systemDictionary.cpp
+22
-8
src/share/vm/classfile/systemDictionary.hpp
src/share/vm/classfile/systemDictionary.hpp
+1
-0
未找到文件。
src/share/vm/classfile/systemDictionary.cpp
浏览文件 @
93cefacc
...
@@ -99,6 +99,15 @@ bool SystemDictionary::is_parallelCapable(Handle class_loader) {
...
@@ -99,6 +99,15 @@ bool SystemDictionary::is_parallelCapable(Handle class_loader) {
return
java_lang_Class
::
parallelCapable
(
class_loader
());
return
java_lang_Class
::
parallelCapable
(
class_loader
());
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ParallelDefineClass flag does not apply to bootclass loader
bool
SystemDictionary
::
is_parallelDefine
(
Handle
class_loader
)
{
if
(
class_loader
.
is_null
())
return
false
;
if
(
AllowParallelDefineClass
&&
java_lang_Class
::
parallelCapable
(
class_loader
()))
{
return
true
;
}
return
false
;
}
// ----------------------------------------------------------------------------
// Resolving of classes
// Resolving of classes
// Forwards to resolve_or_null
// Forwards to resolve_or_null
...
@@ -724,13 +733,13 @@ klassOop SystemDictionary::resolve_instance_class_or_null(symbolHandle class_nam
...
@@ -724,13 +733,13 @@ klassOop SystemDictionary::resolve_instance_class_or_null(symbolHandle class_nam
// Do actual loading
// Do actual loading
k
=
load_instance_class
(
name
,
class_loader
,
THREAD
);
k
=
load_instance_class
(
name
,
class_loader
,
THREAD
);
// For UnsyncloadClass
and AllowParallelDefineClass only:
// For UnsyncloadClass
only
// If they got a linkageError, check if a parallel class load succeeded.
// If they got a linkageError, check if a parallel class load succeeded.
// If it did, then for bytecode resolution the specification requires
// If it did, then for bytecode resolution the specification requires
// that we return the same result we did for the other thread, i.e. the
// that we return the same result we did for the other thread, i.e. the
// successfully loaded instanceKlass
// successfully loaded instanceKlass
// Should not get here for classloaders that support parallelism
// Should not get here for classloaders that support parallelism
// with the new cleaner mechanism
// with the new cleaner mechanism
, even with AllowParallelDefineClass
// Bootstrap goes through here to allow for an extra guarantee check
// Bootstrap goes through here to allow for an extra guarantee check
if
(
UnsyncloadClass
||
(
class_loader
.
is_null
()))
{
if
(
UnsyncloadClass
||
(
class_loader
.
is_null
()))
{
if
(
k
.
is_null
()
&&
HAS_PENDING_EXCEPTION
if
(
k
.
is_null
()
&&
HAS_PENDING_EXCEPTION
...
@@ -1483,14 +1492,17 @@ void SystemDictionary::define_instance_class(instanceKlassHandle k, TRAPS) {
...
@@ -1483,14 +1492,17 @@ void SystemDictionary::define_instance_class(instanceKlassHandle k, TRAPS) {
}
}
// Support parallel classloading
// Support parallel classloading
// Initial implementation for bootstrap classloader
// All parallel class loaders, including bootstrap classloader
// For custom class loaders that support parallel classloading,
// lock a placeholder entry for this class/class_loader pair
// to allow parallel defines of different classes for this class loader
// With AllowParallelDefine flag==true, in case they do not synchronize around
// With AllowParallelDefine flag==true, in case they do not synchronize around
// FindLoadedClass/DefineClass, calls, we check for parallel
// FindLoadedClass/DefineClass, calls, we check for parallel
// loading for them, wait if a defineClass is in progress
// loading for them, wait if a defineClass is in progress
// and return the initial requestor's results
// and return the initial requestor's results
// This flag does not apply to the bootstrap classloader.
// With AllowParallelDefine flag==false, call through to define_instance_class
// With AllowParallelDefine flag==false, call through to define_instance_class
// which will throw LinkageError: duplicate class definition.
// which will throw LinkageError: duplicate class definition.
// False is the requested default.
// For better performance, the class loaders should synchronize
// For better performance, the class loaders should synchronize
// findClass(), i.e. FindLoadedClass/DefineClassIfAbsent or they
// findClass(), i.e. FindLoadedClass/DefineClassIfAbsent or they
// potentially waste time reading and parsing the bytestream.
// potentially waste time reading and parsing the bytestream.
...
@@ -1511,9 +1523,11 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(symbolHandle
...
@@ -1511,9 +1523,11 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(symbolHandle
{
{
MutexLocker
mu
(
SystemDictionary_lock
,
THREAD
);
MutexLocker
mu
(
SystemDictionary_lock
,
THREAD
);
// First check if class already defined
// First check if class already defined
klassOop
check
=
find_class
(
d_index
,
d_hash
,
name_h
,
class_loader
);
if
(
UnsyncloadClass
||
(
is_parallelDefine
(
class_loader
)))
{
if
(
check
!=
NULL
)
{
klassOop
check
=
find_class
(
d_index
,
d_hash
,
name_h
,
class_loader
);
return
(
instanceKlassHandle
(
THREAD
,
check
));
if
(
check
!=
NULL
)
{
return
(
instanceKlassHandle
(
THREAD
,
check
));
}
}
}
// Acquire define token for this class/classloader
// Acquire define token for this class/classloader
...
@@ -1529,7 +1543,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(symbolHandle
...
@@ -1529,7 +1543,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(symbolHandle
// Only special cases allow parallel defines and can use other thread's results
// Only special cases allow parallel defines and can use other thread's results
// Other cases fall through, and may run into duplicate defines
// Other cases fall through, and may run into duplicate defines
// caught by finding an entry in the SystemDictionary
// caught by finding an entry in the SystemDictionary
if
((
UnsyncloadClass
||
AllowParallelDefineClass
)
&&
(
probe
->
instanceKlass
()
!=
NULL
))
{
if
((
UnsyncloadClass
||
is_parallelDefine
(
class_loader
)
)
&&
(
probe
->
instanceKlass
()
!=
NULL
))
{
probe
->
remove_seen_thread
(
THREAD
,
PlaceholderTable
::
DEFINE_CLASS
);
probe
->
remove_seen_thread
(
THREAD
,
PlaceholderTable
::
DEFINE_CLASS
);
placeholders
()
->
find_and_remove
(
p_index
,
p_hash
,
name_h
,
class_loader
,
THREAD
);
placeholders
()
->
find_and_remove
(
p_index
,
p_hash
,
name_h
,
class_loader
,
THREAD
);
SystemDictionary_lock
->
notify_all
();
SystemDictionary_lock
->
notify_all
();
...
...
src/share/vm/classfile/systemDictionary.hpp
浏览文件 @
93cefacc
...
@@ -578,6 +578,7 @@ private:
...
@@ -578,6 +578,7 @@ private:
static
Handle
compute_loader_lock_object
(
Handle
class_loader
,
TRAPS
);
static
Handle
compute_loader_lock_object
(
Handle
class_loader
,
TRAPS
);
static
void
check_loader_lock_contention
(
Handle
loader_lock
,
TRAPS
);
static
void
check_loader_lock_contention
(
Handle
loader_lock
,
TRAPS
);
static
bool
is_parallelCapable
(
Handle
class_loader
);
static
bool
is_parallelCapable
(
Handle
class_loader
);
static
bool
is_parallelDefine
(
Handle
class_loader
);
static
klassOop
find_shared_class
(
symbolHandle
class_name
);
static
klassOop
find_shared_class
(
symbolHandle
class_name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录