Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
adb9b34e
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看板
提交
adb9b34e
编写于
9月 10, 2014
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8050174: Support overriding of isInvokeSpecial flag in WrappedMember
Reviewed-by: vlivanov, psandoz Contributed-by: john.r.rose@oracle.com
上级
0c13f227
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
13 deletion
+19
-13
src/share/classes/java/lang/invoke/Invokers.java
src/share/classes/java/lang/invoke/Invokers.java
+1
-1
src/share/classes/java/lang/invoke/MethodHandle.java
src/share/classes/java/lang/invoke/MethodHandle.java
+2
-2
src/share/classes/java/lang/invoke/MethodHandleImpl.java
src/share/classes/java/lang/invoke/MethodHandleImpl.java
+16
-10
未找到文件。
src/share/classes/java/lang/invoke/Invokers.java
浏览文件 @
adb9b34e
...
...
@@ -107,7 +107,7 @@ class Invokers {
LambdaForm
lform
=
invokeHandleForm
(
mtype
,
false
,
which
);
MethodHandle
invoker
=
BoundMethodHandle
.
bindSingle
(
invokerType
,
lform
,
mtype
);
String
whichName
=
(
isExact
?
"invokeExact"
:
"invoke"
);
invoker
=
invoker
.
withInternalMemberName
(
MemberName
.
makeMethodHandleInvoke
(
whichName
,
mtype
));
invoker
=
invoker
.
withInternalMemberName
(
MemberName
.
makeMethodHandleInvoke
(
whichName
,
mtype
)
,
false
);
assert
(
checkInvoker
(
invoker
));
maybeCompileToBytecode
(
invoker
);
return
invoker
;
...
...
src/share/classes/java/lang/invoke/MethodHandle.java
浏览文件 @
adb9b34e
...
...
@@ -1356,9 +1356,9 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
}
/*non-public*/
MethodHandle
withInternalMemberName
(
MemberName
member
)
{
MethodHandle
withInternalMemberName
(
MemberName
member
,
boolean
isInvokeSpecial
)
{
if
(
member
!=
null
)
{
return
MethodHandleImpl
.
makeWrappedMember
(
this
,
member
);
return
MethodHandleImpl
.
makeWrappedMember
(
this
,
member
,
isInvokeSpecial
);
}
else
if
(
internalMemberName
()
==
null
)
{
// The required internaMemberName is null, and this MH (like most) doesn't have one.
return
this
;
...
...
src/share/classes/java/lang/invoke/MethodHandleImpl.java
浏览文件 @
adb9b34e
...
...
@@ -807,7 +807,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
mh
=
mh
.
bindTo
(
new
UnsupportedOperationException
(
"cannot reflectively invoke MethodHandle"
));
if
(!
method
.
getInvocationType
().
equals
(
mh
.
type
()))
throw
new
InternalError
(
method
.
toString
());
mh
=
mh
.
withInternalMemberName
(
method
);
mh
=
mh
.
withInternalMemberName
(
method
,
false
);
mh
=
mh
.
asVarargsCollector
(
Object
[].
class
);
assert
(
method
.
isVarargs
());
FAKE_METHOD_HANDLE_INVOKE
[
idx
]
=
mh
;
...
...
@@ -844,7 +844,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
MethodHandle
vamh
=
prepareForInvoker
(
mh
);
// Cache the result of makeInjectedInvoker once per argument class.
MethodHandle
bccInvoker
=
CV_makeInjectedInvoker
.
get
(
hostClass
);
return
restoreToType
(
bccInvoker
.
bindTo
(
vamh
),
mh
.
type
(),
mh
.
internalMemberName
()
,
hostClass
);
return
restoreToType
(
bccInvoker
.
bindTo
(
vamh
),
mh
,
hostClass
);
}
private
static
MethodHandle
makeInjectedInvoker
(
Class
<?>
hostClass
)
{
...
...
@@ -899,12 +899,14 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
}
// Undo the adapter effect of prepareForInvoker:
private
static
MethodHandle
restoreToType
(
MethodHandle
vamh
,
MethodType
type
,
Me
mberName
member
,
private
static
MethodHandle
restoreToType
(
MethodHandle
vamh
,
Me
thodHandle
original
,
Class
<?>
hostClass
)
{
MethodType
type
=
original
.
type
();
MethodHandle
mh
=
vamh
.
asCollector
(
Object
[].
class
,
type
.
parameterCount
());
MemberName
member
=
original
.
internalMemberName
();
mh
=
mh
.
asType
(
type
);
mh
=
new
WrappedMember
(
mh
,
type
,
member
,
hostClass
);
mh
=
new
WrappedMember
(
mh
,
type
,
member
,
original
.
isInvokeSpecial
(),
hostClass
);
return
mh
;
}
...
...
@@ -974,12 +976,16 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
private
final
MethodHandle
target
;
private
final
MemberName
member
;
private
final
Class
<?>
callerClass
;
private
final
boolean
isInvokeSpecial
;
private
WrappedMember
(
MethodHandle
target
,
MethodType
type
,
MemberName
member
,
Class
<?>
callerClass
)
{
private
WrappedMember
(
MethodHandle
target
,
MethodType
type
,
MemberName
member
,
boolean
isInvokeSpecial
,
Class
<?>
callerClass
)
{
super
(
type
,
reinvokerForm
(
target
));
this
.
target
=
target
;
this
.
member
=
member
;
this
.
callerClass
=
callerClass
;
this
.
isInvokeSpecial
=
isInvokeSpecial
;
}
@Override
...
...
@@ -1002,7 +1008,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
}
@Override
boolean
isInvokeSpecial
()
{
return
target
.
isInvokeSpecial
()
;
return
isInvokeSpecial
;
}
@Override
...
...
@@ -1011,10 +1017,10 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
}
}
static
MethodHandle
makeWrappedMember
(
MethodHandle
target
,
MemberName
member
)
{
if
(
member
.
equals
(
target
.
internalMemberName
()))
static
MethodHandle
makeWrappedMember
(
MethodHandle
target
,
MemberName
member
,
boolean
isInvokeSpecial
)
{
if
(
member
.
equals
(
target
.
internalMemberName
())
&&
isInvokeSpecial
==
target
.
isInvokeSpecial
()
)
return
target
;
return
new
WrappedMember
(
target
,
target
.
type
(),
member
,
null
);
return
new
WrappedMember
(
target
,
target
.
type
(),
member
,
isInvokeSpecial
,
null
);
}
/// Collection of multiple arguments.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录