Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
50959a7f
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看板
提交
50959a7f
编写于
9月 10, 2014
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8057657: Annotate LambdaForm parameters with types
Reviewed-by: vlivanov, psandoz Contributed-by: john.r.rose@oracle.com
上级
84c4c1ae
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
5 deletion
+37
-5
src/share/classes/java/lang/invoke/BoundMethodHandle.java
src/share/classes/java/lang/invoke/BoundMethodHandle.java
+2
-1
src/share/classes/java/lang/invoke/DelegatingMethodHandle.java
...hare/classes/java/lang/invoke/DelegatingMethodHandle.java
+3
-1
src/share/classes/java/lang/invoke/Invokers.java
src/share/classes/java/lang/invoke/Invokers.java
+3
-1
src/share/classes/java/lang/invoke/LambdaForm.java
src/share/classes/java/lang/invoke/LambdaForm.java
+28
-2
src/share/classes/java/lang/invoke/MethodHandleImpl.java
src/share/classes/java/lang/invoke/MethodHandleImpl.java
+1
-0
未找到文件。
src/share/classes/java/lang/invoke/BoundMethodHandle.java
浏览文件 @
50959a7f
...
...
@@ -138,7 +138,8 @@ import jdk.internal.org.objectweb.asm.Type;
*/
static
BoundMethodHandle
makeReinvoker
(
MethodHandle
target
)
{
LambdaForm
form
=
DelegatingMethodHandle
.
makeReinvokerForm
(
target
,
MethodTypeForm
.
LF_REBIND
,
Species_L
.
SPECIES_DATA
.
getterFunction
(
0
)
);
target
,
MethodTypeForm
.
LF_REBIND
,
Species_L
.
SPECIES_DATA
,
Species_L
.
SPECIES_DATA
.
getterFunction
(
0
));
return
Species_L
.
make
(
target
.
type
(),
form
,
target
);
}
...
...
src/share/classes/java/lang/invoke/DelegatingMethodHandle.java
浏览文件 @
50959a7f
...
...
@@ -85,12 +85,13 @@ abstract class DelegatingMethodHandle extends MethodHandle {
private
static
LambdaForm
chooseDelegatingForm
(
MethodHandle
target
)
{
if
(
target
instanceof
SimpleMethodHandle
)
return
target
.
internalForm
();
// no need for an indirection
return
makeReinvokerForm
(
target
,
MethodTypeForm
.
LF_DELEGATE
,
NF_getTarget
);
return
makeReinvokerForm
(
target
,
MethodTypeForm
.
LF_DELEGATE
,
DelegatingMethodHandle
.
class
,
NF_getTarget
);
}
/** Create a LF which simply reinvokes a target of the given basic type. */
static
LambdaForm
makeReinvokerForm
(
MethodHandle
target
,
int
whichCache
,
Object
constraint
,
NamedFunction
getTargetFn
)
{
MethodType
mtype
=
target
.
type
().
basicType
();
boolean
customized
=
(
whichCache
<
0
||
...
...
@@ -108,6 +109,7 @@ abstract class DelegatingMethodHandle extends MethodHandle {
final
int
REINVOKE
=
nameCursor
++;
LambdaForm
.
Name
[]
names
=
LambdaForm
.
arguments
(
nameCursor
-
ARG_LIMIT
,
mtype
.
invokerType
());
assert
(
names
.
length
==
nameCursor
);
names
[
THIS_DMH
]
=
names
[
THIS_DMH
].
withConstraint
(
constraint
);
Object
[]
targetArgs
;
if
(
customized
)
{
targetArgs
=
Arrays
.
copyOfRange
(
names
,
ARG_BASE
,
ARG_LIMIT
,
Object
[].
class
);
...
...
src/share/classes/java/lang/invoke/Invokers.java
浏览文件 @
50959a7f
...
...
@@ -260,7 +260,9 @@ class Invokers {
:
Arrays
.
asList
(
mtype
,
customized
,
which
,
nameCursor
,
names
.
length
);
if
(
MTYPE_ARG
>=
INARG_LIMIT
)
{
assert
(
names
[
MTYPE_ARG
]
==
null
);
NamedFunction
getter
=
BoundMethodHandle
.
speciesData_L
().
getterFunction
(
0
);
BoundMethodHandle
.
SpeciesData
speciesData
=
BoundMethodHandle
.
speciesData_L
();
names
[
THIS_MH
]
=
names
[
THIS_MH
].
withConstraint
(
speciesData
);
NamedFunction
getter
=
speciesData
.
getterFunction
(
0
);
names
[
MTYPE_ARG
]
=
new
Name
(
getter
,
names
[
THIS_MH
]);
// else if isLinker, then MTYPE is passed in from the caller (e.g., the JVM)
}
...
...
src/share/classes/java/lang/invoke/LambdaForm.java
浏览文件 @
50959a7f
...
...
@@ -460,6 +460,11 @@ class LambdaForm {
return
param
;
}
/** Report the N-th argument type constraint. */
Object
parameterConstraint
(
int
n
)
{
return
parameter
(
n
).
constraint
;
}
/** Report the arity. */
int
arity
()
{
return
arity
;
...
...
@@ -1421,6 +1426,7 @@ class LambdaForm {
final
BasicType
type
;
private
short
index
;
final
NamedFunction
function
;
final
Object
constraint
;
// additional type information, if not null
@Stable
final
Object
[]
arguments
;
private
Name
(
int
index
,
BasicType
type
,
NamedFunction
function
,
Object
[]
arguments
)
{
...
...
@@ -1428,8 +1434,18 @@ class LambdaForm {
this
.
type
=
type
;
this
.
function
=
function
;
this
.
arguments
=
arguments
;
this
.
constraint
=
null
;
assert
(
this
.
index
==
index
);
}
private
Name
(
Name
that
,
Object
constraint
)
{
this
.
index
=
that
.
index
;
this
.
type
=
that
.
type
;
this
.
function
=
that
.
function
;
this
.
arguments
=
that
.
arguments
;
this
.
constraint
=
constraint
;
assert
(
constraint
==
null
||
isParam
());
// only params have constraints
assert
(
constraint
==
null
||
constraint
instanceof
BoundMethodHandle
.
SpeciesData
||
constraint
instanceof
Class
);
}
Name
(
MethodHandle
function
,
Object
...
arguments
)
{
this
(
new
NamedFunction
(
function
),
arguments
);
}
...
...
@@ -1477,7 +1493,11 @@ class LambdaForm {
}
Name
cloneWithIndex
(
int
i
)
{
Object
[]
newArguments
=
(
arguments
==
null
)
?
null
:
arguments
.
clone
();
return
new
Name
(
i
,
type
,
function
,
newArguments
);
return
new
Name
(
i
,
type
,
function
,
newArguments
).
withConstraint
(
constraint
);
}
Name
withConstraint
(
Object
constraint
)
{
if
(
constraint
==
this
.
constraint
)
return
this
;
return
new
Name
(
this
,
constraint
);
}
Name
replaceName
(
Name
oldName
,
Name
newName
)
{
// FIXME: use replaceNames uniformly
if
(
oldName
==
newName
)
return
this
;
...
...
@@ -1557,7 +1577,12 @@ class LambdaForm {
return
(
function
==
null
)
?
s
:
s
+
"="
+
exprString
();
}
public
String
paramString
()
{
return
toString
();
String
s
=
toString
();
Object
c
=
constraint
;
if
(
c
==
null
)
return
s
;
if
(
c
instanceof
Class
)
c
=
((
Class
<?>)
c
).
getSimpleName
();
return
s
+
"/"
+
c
;
}
public
String
exprString
()
{
if
(
function
==
null
)
return
toString
();
...
...
@@ -1679,6 +1704,7 @@ class LambdaForm {
static
Name
internArgument
(
Name
n
)
{
assert
(
n
.
isParam
())
:
"not param: "
+
n
;
assert
(
n
.
index
<
INTERNED_ARGUMENT_LIMIT
);
if
(
n
.
constraint
!=
null
)
return
n
;
return
argument
(
n
.
index
,
n
.
type
);
}
static
Name
[]
arguments
(
int
extra
,
String
types
)
{
...
...
src/share/classes/java/lang/invoke/MethodHandleImpl.java
浏览文件 @
50959a7f
...
...
@@ -710,6 +710,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
Name
[]
names
=
arguments
(
nameCursor
-
ARG_LIMIT
,
lambdaType
);
BoundMethodHandle
.
SpeciesData
data
=
BoundMethodHandle
.
speciesData_LLLLL
();
names
[
THIS_MH
]
=
names
[
THIS_MH
].
withConstraint
(
data
);
names
[
GET_TARGET
]
=
new
Name
(
data
.
getterFunction
(
0
),
names
[
THIS_MH
]);
names
[
GET_CLASS
]
=
new
Name
(
data
.
getterFunction
(
1
),
names
[
THIS_MH
]);
names
[
GET_CATCHER
]
=
new
Name
(
data
.
getterFunction
(
2
),
names
[
THIS_MH
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录