Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
e19ccc26
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看板
提交
e19ccc26
编写于
4月 14, 2015
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8075838: Method for typing MethodTypes
Reviewed-by: jrose, ahgross, alanb, bmoloden
上级
01694654
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
17 deletion
+33
-17
src/share/vm/classfile/systemDictionary.cpp
src/share/vm/classfile/systemDictionary.cpp
+33
-17
未找到文件。
src/share/vm/classfile/systemDictionary.cpp
浏览文件 @
e19ccc26
...
...
@@ -2349,9 +2349,6 @@ methodHandle SystemDictionary::find_method_handle_invoker(Symbol* name,
assert
(
!
THREAD
->
is_Compiler_thread
(),
""
);
Handle
method_type
=
SystemDictionary
::
find_method_handle_type
(
signature
,
accessing_klass
,
CHECK_
(
empty
));
if
(
false
)
{
// FIXME: Decide if the Java upcall should resolve signatures.
method_type
=
java_lang_String
::
create_from_symbol
(
signature
,
CHECK_
(
empty
));
}
KlassHandle
mh_klass
=
SystemDictionary
::
MethodHandle_klass
();
int
ref_kind
=
JVM_REF_invokeVirtual
;
...
...
@@ -2383,6 +2380,24 @@ methodHandle SystemDictionary::find_method_handle_invoker(Symbol* name,
return
unpack_method_and_appendix
(
mname
,
accessing_klass
,
appendix_box
,
appendix_result
,
THREAD
);
}
// Decide if we can globally cache a lookup of this class, to be returned to any client that asks.
// We must ensure that all class loaders everywhere will reach this class, for any client.
// This is a safe bet for public classes in java.lang, such as Object and String.
// We also include public classes in java.lang.invoke, because they appear frequently in system-level method types.
// Out of an abundance of caution, we do not include any other classes, not even for packages like java.util.
static
bool
is_always_visible_class
(
oop
mirror
)
{
Klass
*
klass
=
java_lang_Class
::
as_Klass
(
mirror
);
if
(
klass
->
oop_is_objArray
())
{
klass
=
ObjArrayKlass
::
cast
(
klass
)
->
bottom_klass
();
// check element type
}
if
(
klass
->
oop_is_typeArray
())
{
return
true
;
// primitive array
}
assert
(
klass
->
oop_is_instance
(),
klass
->
external_name
());
return
klass
->
is_public
()
&&
(
InstanceKlass
::
cast
(
klass
)
->
is_same_class_package
(
SystemDictionary
::
Object_klass
())
||
// java.lang
InstanceKlass
::
cast
(
klass
)
->
is_same_class_package
(
SystemDictionary
::
MethodHandle_klass
()));
// java.lang.invoke
}
// Ask Java code to find or construct a java.lang.invoke.MethodType for the given
// signature, as interpreted relative to the given class loader.
...
...
@@ -2405,32 +2420,33 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
}
Handle
class_loader
,
protection_domain
;
bool
is_on_bcp
=
true
;
// keep this true as long as we can materialize from the boot classloader
if
(
accessing_klass
.
not_null
())
{
class_loader
=
Handle
(
THREAD
,
InstanceKlass
::
cast
(
accessing_klass
())
->
class_loader
());
protection_domain
=
Handle
(
THREAD
,
InstanceKlass
::
cast
(
accessing_klass
())
->
protection_domain
());
}
bool
can_be_cached
=
true
;
int
npts
=
ArgumentCount
(
signature
).
size
();
objArrayHandle
pts
=
oopFactory
::
new_objArray
(
SystemDictionary
::
Class_klass
(),
npts
,
CHECK_
(
empty
));
int
arg
=
0
;
Handle
rt
;
// the return type from the signature
Handle
rt
;
// the return type from the signature
ResourceMark
rm
(
THREAD
);
for
(
SignatureStream
ss
(
signature
);
!
ss
.
is_done
();
ss
.
next
())
{
oop
mirror
=
NULL
;
if
(
is_on_bcp
)
{
//
Note: class_loader & protection_domain are both null at this point
.
mirror
=
ss
.
as_java_mirror
(
class_loader
,
protection_domain
,
if
(
can_be_cached
)
{
//
Use neutral class loader to lookup candidate classes to be placed in the cache
.
mirror
=
ss
.
as_java_mirror
(
Handle
(),
Handle
()
,
SignatureStream
::
ReturnNull
,
CHECK_
(
empty
));
if
(
mirror
==
NULL
)
{
// fall back from BCP to accessing_klass
if
(
accessing_klass
.
not_null
())
{
class_loader
=
Handle
(
THREAD
,
InstanceKlass
::
cast
(
accessing_klass
())
->
class_loader
());
protection_domain
=
Handle
(
THREAD
,
InstanceKlass
::
cast
(
accessing_klass
())
->
protection_domain
());
}
is_on_bcp
=
false
;
if
(
mirror
==
NULL
||
(
ss
.
is_object
()
&&
!
is_always_visible_class
(
mirror
)))
{
// Fall back to accessing_klass context.
can_be_cached
=
false
;
}
}
if
(
!
is_on_bcp
)
{
if
(
!
can_be_cached
)
{
// Resolve, throwing a real error if it doesn't work.
mirror
=
ss
.
as_java_mirror
(
class_loader
,
protection_domain
,
SignatureStream
::
NCDFError
,
CHECK_
(
empty
));
}
assert
(
!
oopDesc
::
is_null
(
mirror
),
ss
.
as_symbol
(
THREAD
)
->
as_C_string
());
if
(
ss
.
at_return_type
())
rt
=
Handle
(
THREAD
,
mirror
);
else
...
...
@@ -2462,7 +2478,7 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
&
args
,
CHECK_
(
empty
));
Handle
method_type
(
THREAD
,
(
oop
)
result
.
get_jobject
());
if
(
is_on_bcp
)
{
if
(
can_be_cached
)
{
// We can cache this MethodType inside the JVM.
MutexLocker
ml
(
SystemDictionary_lock
,
THREAD
);
spe
=
invoke_method_table
()
->
find_entry
(
index
,
hash
,
signature
,
null_iid
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录