Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
15d1126f
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看板
提交
15d1126f
编写于
9月 18, 2013
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8024616: JSR292: lazily initialize core NamedFunctions used for bootstrapping
Reviewed-by: jrose
上级
3b938ee7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
73 addition
and
61 deletion
+73
-61
src/share/classes/java/lang/invoke/DirectMethodHandle.java
src/share/classes/java/lang/invoke/DirectMethodHandle.java
+58
-52
src/share/classes/java/lang/invoke/MethodHandleImpl.java
src/share/classes/java/lang/invoke/MethodHandleImpl.java
+15
-9
未找到文件。
src/share/classes/java/lang/invoke/DirectMethodHandle.java
浏览文件 @
15d1126f
...
...
@@ -257,12 +257,12 @@ class DirectMethodHandle extends MethodHandle {
assert
(
names
.
length
==
nameCursor
);
if
(
doesAlloc
)
{
// names = { argx,y,z,... new C, init method }
names
[
NEW_OBJ
]
=
new
Name
(
NF_allocateInstance
,
names
[
DMH_THIS
]);
names
[
GET_MEMBER
]
=
new
Name
(
NF_constructorMethod
,
names
[
DMH_THIS
]);
names
[
NEW_OBJ
]
=
new
Name
(
Lazy
.
NF_allocateInstance
,
names
[
DMH_THIS
]);
names
[
GET_MEMBER
]
=
new
Name
(
Lazy
.
NF_constructorMethod
,
names
[
DMH_THIS
]);
}
else
if
(
needsInit
)
{
names
[
GET_MEMBER
]
=
new
Name
(
NF_internalMemberNameEnsureInit
,
names
[
DMH_THIS
]);
names
[
GET_MEMBER
]
=
new
Name
(
Lazy
.
NF_internalMemberNameEnsureInit
,
names
[
DMH_THIS
]);
}
else
{
names
[
GET_MEMBER
]
=
new
Name
(
NF_internalMemberName
,
names
[
DMH_THIS
]);
names
[
GET_MEMBER
]
=
new
Name
(
Lazy
.
NF_internalMemberName
,
names
[
DMH_THIS
]);
}
Object
[]
outArgs
=
Arrays
.
copyOfRange
(
names
,
ARG_BASE
,
GET_MEMBER
+
1
,
Object
[].
class
);
assert
(
outArgs
[
outArgs
.
length
-
1
]
==
names
[
GET_MEMBER
]);
// look, shifted args!
...
...
@@ -637,18 +637,18 @@ class DirectMethodHandle extends MethodHandle {
final
int
RESULT
=
nameCursor
-
1
;
// either the call or the cast
Name
[]
names
=
arguments
(
nameCursor
-
ARG_LIMIT
,
mtype
.
invokerType
());
if
(
needsInit
)
names
[
INIT_BAR
]
=
new
Name
(
NF_ensureInitialized
,
names
[
DMH_THIS
]);
names
[
INIT_BAR
]
=
new
Name
(
Lazy
.
NF_ensureInitialized
,
names
[
DMH_THIS
]);
if
(
needsCast
&&
!
isGetter
)
names
[
PRE_CAST
]
=
new
Name
(
NF_checkCast
,
names
[
DMH_THIS
],
names
[
SET_VALUE
]);
names
[
PRE_CAST
]
=
new
Name
(
Lazy
.
NF_checkCast
,
names
[
DMH_THIS
],
names
[
SET_VALUE
]);
Object
[]
outArgs
=
new
Object
[
1
+
linkerType
.
parameterCount
()];
assert
(
outArgs
.
length
==
(
isGetter
?
3
:
4
));
outArgs
[
0
]
=
UNSAFE
;
if
(
isStatic
)
{
outArgs
[
1
]
=
names
[
F_HOLDER
]
=
new
Name
(
NF_staticBase
,
names
[
DMH_THIS
]);
outArgs
[
2
]
=
names
[
F_OFFSET
]
=
new
Name
(
NF_staticOffset
,
names
[
DMH_THIS
]);
outArgs
[
1
]
=
names
[
F_HOLDER
]
=
new
Name
(
Lazy
.
NF_staticBase
,
names
[
DMH_THIS
]);
outArgs
[
2
]
=
names
[
F_OFFSET
]
=
new
Name
(
Lazy
.
NF_staticOffset
,
names
[
DMH_THIS
]);
}
else
{
outArgs
[
1
]
=
names
[
OBJ_CHECK
]
=
new
Name
(
NF_checkBase
,
names
[
OBJ_BASE
]);
outArgs
[
2
]
=
names
[
F_OFFSET
]
=
new
Name
(
NF_fieldOffset
,
names
[
DMH_THIS
]);
outArgs
[
1
]
=
names
[
OBJ_CHECK
]
=
new
Name
(
Lazy
.
NF_checkBase
,
names
[
OBJ_BASE
]);
outArgs
[
2
]
=
names
[
F_OFFSET
]
=
new
Name
(
Lazy
.
NF_fieldOffset
,
names
[
DMH_THIS
]);
}
if
(!
isGetter
)
{
outArgs
[
3
]
=
(
needsCast
?
names
[
PRE_CAST
]
:
names
[
SET_VALUE
]);
...
...
@@ -656,7 +656,7 @@ class DirectMethodHandle extends MethodHandle {
for
(
Object
a
:
outArgs
)
assert
(
a
!=
null
);
names
[
LINKER_CALL
]
=
new
Name
(
linker
,
outArgs
);
if
(
needsCast
&&
isGetter
)
names
[
POST_CAST
]
=
new
Name
(
NF_checkCast
,
names
[
DMH_THIS
],
names
[
LINKER_CALL
]);
names
[
POST_CAST
]
=
new
Name
(
Lazy
.
NF_checkCast
,
names
[
DMH_THIS
],
names
[
LINKER_CALL
]);
for
(
Name
n
:
names
)
assert
(
n
!=
null
);
String
fieldOrStatic
=
(
isStatic
?
"Static"
:
"Field"
);
String
lambdaName
=
(
linkerName
+
fieldOrStatic
);
// significant only for debugging
...
...
@@ -665,7 +665,12 @@ class DirectMethodHandle extends MethodHandle {
return
new
LambdaForm
(
lambdaName
,
ARG_LIMIT
,
names
,
RESULT
);
}
private
static
final
NamedFunction
/**
* Pre-initialized NamedFunctions for bootstrapping purposes.
* Factored in an inner class to delay initialization until first usage.
*/
private
static
class
Lazy
{
static
final
NamedFunction
NF_internalMemberName
,
NF_internalMemberNameEnsureInit
,
NF_ensureInitialized
,
...
...
@@ -709,4 +714,5 @@ class DirectMethodHandle extends MethodHandle {
throw
newInternalError
(
ex
);
}
}
}
}
src/share/classes/java/lang/invoke/MethodHandleImpl.java
浏览文件 @
15d1126f
...
...
@@ -435,7 +435,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
// Spread the array.
MethodHandle
aload
=
MethodHandles
.
arrayElementGetter
(
spreadArgType
);
Name
array
=
names
[
argIndex
];
names
[
nameCursor
++]
=
new
Name
(
NF_checkSpreadArgument
,
array
,
spreadArgCount
);
names
[
nameCursor
++]
=
new
Name
(
Lazy
.
NF_checkSpreadArgument
,
array
,
spreadArgCount
);
for
(
int
j
=
0
;
j
<
spreadArgCount
;
i
++,
j
++)
{
indexes
[
i
]
=
nameCursor
;
names
[
nameCursor
++]
=
new
Name
(
aload
,
array
,
j
);
...
...
@@ -480,7 +480,12 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
throw
new
WrongMethodTypeException
(
"Array is not of length "
+
n
);
}
private
static
final
NamedFunction
NF_checkSpreadArgument
;
/**
* Pre-initialized NamedFunctions for bootstrapping purposes.
* Factored in an inner class to delay initialization until first usage.
*/
private
static
class
Lazy
{
static
final
NamedFunction
NF_checkSpreadArgument
;
static
{
try
{
NF_checkSpreadArgument
=
new
NamedFunction
(
MethodHandleImpl
.
class
...
...
@@ -490,6 +495,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
throw
newInternalError
(
ex
);
}
}
}
/** Factory method: Collect or filter selected argument(s). */
static
MethodHandle
makeCollectArguments
(
MethodHandle
target
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录