Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
bb062d73
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看板
提交
bb062d73
编写于
10月 03, 2014
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8058892: FILL_ARRAYS and ARRAYS are eagely initialized in MethodHandleImpl
Reviewed-by: kvn, shade
上级
9c03c033
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
8 deletion
+15
-8
src/share/classes/java/lang/invoke/MethodHandleImpl.java
src/share/classes/java/lang/invoke/MethodHandleImpl.java
+15
-8
未找到文件。
src/share/classes/java/lang/invoke/MethodHandleImpl.java
浏览文件 @
bb062d73
...
...
@@ -594,6 +594,9 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
static
class
Lazy
{
private
static
final
Class
<?>
MHI
=
MethodHandleImpl
.
class
;
private
static
final
MethodHandle
[]
ARRAYS
;
private
static
final
MethodHandle
[]
FILL_ARRAYS
;
static
final
NamedFunction
NF_checkSpreadArgument
;
static
final
NamedFunction
NF_guardWithCatch
;
static
final
NamedFunction
NF_throwException
;
...
...
@@ -606,6 +609,9 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
static
final
MethodHandle
MH_arrayIdentity
;
static
{
ARRAYS
=
makeArrays
();
FILL_ARRAYS
=
makeFillArrays
();
try
{
NF_checkSpreadArgument
=
new
NamedFunction
(
MHI
.
getDeclaredMethod
(
"checkSpreadArgument"
,
Object
.
class
,
int
.
class
));
NF_guardWithCatch
=
new
NamedFunction
(
MHI
.
getDeclaredMethod
(
"guardWithCatch"
,
MethodHandle
.
class
,
Class
.
class
,
...
...
@@ -1268,7 +1274,6 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
assert
(
mhs
.
size
()
==
11
);
// current number of methods
return
mhs
.
toArray
(
new
MethodHandle
[
MAX_ARITY
+
1
]);
}
private
static
final
MethodHandle
[]
ARRAYS
=
makeArrays
();
// filling versions of the above:
// using Integer len instead of int len and no varargs to avoid bootstrapping problems
...
...
@@ -1315,6 +1320,9 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
Object
a4
,
Object
a5
,
Object
a6
,
Object
a7
,
Object
a8
,
Object
a9
)
{
fillWithArguments
(
a
,
pos
,
a0
,
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
);
return
a
;
}
private
static
final
int
FILL_ARRAYS_COUNT
=
11
;
// current number of fillArray methods
private
static
MethodHandle
[]
makeFillArrays
()
{
ArrayList
<
MethodHandle
>
mhs
=
new
ArrayList
<>();
mhs
.
add
(
null
);
// there is no empty fill; at least a0 is required
...
...
@@ -1323,10 +1331,9 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
if
(
mh
==
null
)
break
;
mhs
.
add
(
mh
);
}
assert
(
mhs
.
size
()
==
11
);
// current number of methods
assert
(
mhs
.
size
()
==
FILL_ARRAYS_COUNT
);
return
mhs
.
toArray
(
new
MethodHandle
[
0
]);
}
private
static
final
MethodHandle
[]
FILL_ARRAYS
=
makeFillArrays
();
private
static
Object
copyAsPrimitiveArray
(
Wrapper
w
,
Object
...
boxes
)
{
Object
a
=
w
.
makeArray
(
boxes
.
length
);
...
...
@@ -1338,15 +1345,15 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
* arguments and returns an Object array of them, as if for varargs.
*/
static
MethodHandle
varargsArray
(
int
nargs
)
{
MethodHandle
mh
=
ARRAYS
[
nargs
];
MethodHandle
mh
=
Lazy
.
ARRAYS
[
nargs
];
if
(
mh
!=
null
)
return
mh
;
mh
=
findCollector
(
"array"
,
nargs
,
Object
[].
class
);
if
(
mh
!=
null
)
mh
=
makeIntrinsic
(
mh
,
Intrinsic
.
NEW_ARRAY
);
if
(
mh
!=
null
)
return
ARRAYS
[
nargs
]
=
mh
;
if
(
mh
!=
null
)
return
Lazy
.
ARRAYS
[
nargs
]
=
mh
;
mh
=
buildVarargsArray
(
Lazy
.
MH_fillNewArray
,
Lazy
.
MH_arrayIdentity
,
nargs
);
assert
(
assertCorrectArity
(
mh
,
nargs
));
mh
=
makeIntrinsic
(
mh
,
Intrinsic
.
NEW_ARRAY
);
return
ARRAYS
[
nargs
]
=
mh
;
return
Lazy
.
ARRAYS
[
nargs
]
=
mh
;
}
private
static
boolean
assertCorrectArity
(
MethodHandle
mh
,
int
arity
)
{
...
...
@@ -1382,7 +1389,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
return
mh
;
}
private
static
final
int
LEFT_ARGS
=
(
FILL_ARRAYS
.
length
-
1
)
;
private
static
final
int
LEFT_ARGS
=
FILL_ARRAYS_COUNT
-
1
;
private
static
final
MethodHandle
[]
FILL_ARRAY_TO_RIGHT
=
new
MethodHandle
[
MAX_ARITY
+
1
];
/** fill_array_to_right(N).invoke(a, argL..arg[N-1])
* fills a[L]..a[N-1] with corresponding arguments,
...
...
@@ -1413,7 +1420,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
if
(
midLen
<
LEFT_ARGS
)
rightLen
=
nargs
-
(
midLen
=
LEFT_ARGS
);
assert
(
rightLen
>
0
);
MethodHandle
midFill
=
fillToRight
(
midLen
);
// recursive fill
MethodHandle
rightFill
=
FILL_ARRAYS
[
rightLen
].
bindTo
(
midLen
);
// [midLen..nargs-1]
MethodHandle
rightFill
=
Lazy
.
FILL_ARRAYS
[
rightLen
].
bindTo
(
midLen
);
// [midLen..nargs-1]
assert
(
midFill
.
type
().
parameterCount
()
==
1
+
midLen
-
LEFT_ARGS
);
assert
(
rightFill
.
type
().
parameterCount
()
==
1
+
rightLen
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录