Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6a9bbad7
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看板
提交
6a9bbad7
编写于
1月 29, 2014
作者:
T
twisti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8032686: Issues with method invoke
Reviewed-by: jrose, vlivanov, ahgross
上级
1ad79734
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
42 deletion
+44
-42
src/share/classes/java/lang/invoke/BoundMethodHandle.java
src/share/classes/java/lang/invoke/BoundMethodHandle.java
+42
-41
src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
...re/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+2
-1
未找到文件。
src/share/classes/java/lang/invoke/BoundMethodHandle.java
浏览文件 @
6a9bbad7
...
...
@@ -140,7 +140,7 @@ import jdk.internal.org.objectweb.asm.Type;
* Return the {@link SpeciesData} instance representing this BMH species. All subclasses must provide a
* static field containing this value, and they must accordingly implement this method.
*/
protected
abstract
SpeciesData
speciesData
();
/*non-public*/
abstract
SpeciesData
speciesData
();
@Override
final
Object
internalProperties
()
{
...
...
@@ -156,7 +156,7 @@ import jdk.internal.org.objectweb.asm.Type;
return
Arrays
.
asList
(
boundValues
);
}
public
final
Object
arg
(
int
i
)
{
/*non-public*/
final
Object
arg
(
int
i
)
{
try
{
switch
(
speciesData
().
fieldType
(
i
))
{
case
'L'
:
return
argL
(
i
);
...
...
@@ -170,22 +170,22 @@ import jdk.internal.org.objectweb.asm.Type;
}
throw
new
InternalError
(
"unexpected type: "
+
speciesData
().
types
+
"."
+
i
);
}
public
final
Object
argL
(
int
i
)
throws
Throwable
{
return
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
public
final
int
argI
(
int
i
)
throws
Throwable
{
return
(
int
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
public
final
float
argF
(
int
i
)
throws
Throwable
{
return
(
float
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
public
final
double
argD
(
int
i
)
throws
Throwable
{
return
(
double
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
public
final
long
argJ
(
int
i
)
throws
Throwable
{
return
(
long
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
/*non-public*/
final
Object
argL
(
int
i
)
throws
Throwable
{
return
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
/*non-public*/
final
int
argI
(
int
i
)
throws
Throwable
{
return
(
int
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
/*non-public*/
final
float
argF
(
int
i
)
throws
Throwable
{
return
(
float
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
/*non-public*/
final
double
argD
(
int
i
)
throws
Throwable
{
return
(
double
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
/*non-public*/
final
long
argJ
(
int
i
)
throws
Throwable
{
return
(
long
)
speciesData
().
getters
[
i
].
invokeBasic
(
this
);
}
//
// cloning API
//
public
abstract
BoundMethodHandle
clone
(
MethodType
mt
,
LambdaForm
lf
)
throws
Throwable
;
public
abstract
BoundMethodHandle
cloneExtendL
(
MethodType
mt
,
LambdaForm
lf
,
Object
narg
)
throws
Throwable
;
public
abstract
BoundMethodHandle
cloneExtendI
(
MethodType
mt
,
LambdaForm
lf
,
int
narg
)
throws
Throwable
;
public
abstract
BoundMethodHandle
cloneExtendJ
(
MethodType
mt
,
LambdaForm
lf
,
long
narg
)
throws
Throwable
;
public
abstract
BoundMethodHandle
cloneExtendF
(
MethodType
mt
,
LambdaForm
lf
,
float
narg
)
throws
Throwable
;
public
abstract
BoundMethodHandle
cloneExtendD
(
MethodType
mt
,
LambdaForm
lf
,
double
narg
)
throws
Throwable
;
/*non-public*/
abstract
BoundMethodHandle
clone
(
MethodType
mt
,
LambdaForm
lf
)
throws
Throwable
;
/*non-public*/
abstract
BoundMethodHandle
cloneExtendL
(
MethodType
mt
,
LambdaForm
lf
,
Object
narg
)
throws
Throwable
;
/*non-public*/
abstract
BoundMethodHandle
cloneExtendI
(
MethodType
mt
,
LambdaForm
lf
,
int
narg
)
throws
Throwable
;
/*non-public*/
abstract
BoundMethodHandle
cloneExtendJ
(
MethodType
mt
,
LambdaForm
lf
,
long
narg
)
throws
Throwable
;
/*non-public*/
abstract
BoundMethodHandle
cloneExtendF
(
MethodType
mt
,
LambdaForm
lf
,
float
narg
)
throws
Throwable
;
/*non-public*/
abstract
BoundMethodHandle
cloneExtendD
(
MethodType
mt
,
LambdaForm
lf
,
double
narg
)
throws
Throwable
;
// The following is a grossly irregular hack:
@Override
MethodHandle
reinvokerTarget
()
{
...
...
@@ -203,39 +203,39 @@ import jdk.internal.org.objectweb.asm.Type;
private
// make it private to force users to access the enclosing class first
static
final
class
Species_L
extends
BoundMethodHandle
{
final
Object
argL0
;
public
Species_L
(
MethodType
mt
,
LambdaForm
lf
,
Object
argL0
)
{
/*non-public*/
Species_L
(
MethodType
mt
,
LambdaForm
lf
,
Object
argL0
)
{
super
(
mt
,
lf
);
this
.
argL0
=
argL0
;
}
// The following is a grossly irregular hack:
@Override
MethodHandle
reinvokerTarget
()
{
return
(
MethodHandle
)
argL0
;
}
@Override
public
SpeciesData
speciesData
()
{
/*non-public*/
SpeciesData
speciesData
()
{
return
SPECIES_DATA
;
}
public
static
final
SpeciesData
SPECIES_DATA
=
SpeciesData
.
getForClass
(
"L"
,
Species_L
.
class
);
/*non-public*/
static
final
SpeciesData
SPECIES_DATA
=
SpeciesData
.
getForClass
(
"L"
,
Species_L
.
class
);
@Override
public
final
BoundMethodHandle
clone
(
MethodType
mt
,
LambdaForm
lf
)
throws
Throwable
{
/*non-public*/
final
BoundMethodHandle
clone
(
MethodType
mt
,
LambdaForm
lf
)
throws
Throwable
{
return
new
Species_L
(
mt
,
lf
,
argL0
);
}
@Override
public
final
BoundMethodHandle
cloneExtendL
(
MethodType
mt
,
LambdaForm
lf
,
Object
narg
)
throws
Throwable
{
/*non-public*/
final
BoundMethodHandle
cloneExtendL
(
MethodType
mt
,
LambdaForm
lf
,
Object
narg
)
throws
Throwable
{
return
(
BoundMethodHandle
)
SPECIES_DATA
.
extendWithIndex
(
INDEX_L
).
constructor
[
0
].
invokeBasic
(
mt
,
lf
,
argL0
,
narg
);
}
@Override
public
final
BoundMethodHandle
cloneExtendI
(
MethodType
mt
,
LambdaForm
lf
,
int
narg
)
throws
Throwable
{
/*non-public*/
final
BoundMethodHandle
cloneExtendI
(
MethodType
mt
,
LambdaForm
lf
,
int
narg
)
throws
Throwable
{
return
(
BoundMethodHandle
)
SPECIES_DATA
.
extendWithIndex
(
INDEX_I
).
constructor
[
0
].
invokeBasic
(
mt
,
lf
,
argL0
,
narg
);
}
@Override
public
final
BoundMethodHandle
cloneExtendJ
(
MethodType
mt
,
LambdaForm
lf
,
long
narg
)
throws
Throwable
{
/*non-public*/
final
BoundMethodHandle
cloneExtendJ
(
MethodType
mt
,
LambdaForm
lf
,
long
narg
)
throws
Throwable
{
return
(
BoundMethodHandle
)
SPECIES_DATA
.
extendWithIndex
(
INDEX_J
).
constructor
[
0
].
invokeBasic
(
mt
,
lf
,
argL0
,
narg
);
}
@Override
public
final
BoundMethodHandle
cloneExtendF
(
MethodType
mt
,
LambdaForm
lf
,
float
narg
)
throws
Throwable
{
/*non-public*/
final
BoundMethodHandle
cloneExtendF
(
MethodType
mt
,
LambdaForm
lf
,
float
narg
)
throws
Throwable
{
return
(
BoundMethodHandle
)
SPECIES_DATA
.
extendWithIndex
(
INDEX_F
).
constructor
[
0
].
invokeBasic
(
mt
,
lf
,
argL0
,
narg
);
}
@Override
public
final
BoundMethodHandle
cloneExtendD
(
MethodType
mt
,
LambdaForm
lf
,
double
narg
)
throws
Throwable
{
/*non-public*/
final
BoundMethodHandle
cloneExtendD
(
MethodType
mt
,
LambdaForm
lf
,
double
narg
)
throws
Throwable
{
return
(
BoundMethodHandle
)
SPECIES_DATA
.
extendWithIndex
(
INDEX_D
).
constructor
[
0
].
invokeBasic
(
mt
,
lf
,
argL0
,
narg
);
}
}
...
...
@@ -338,10 +338,10 @@ import jdk.internal.org.objectweb.asm.Type;
final
MethodHandle
[]
getters
;
final
SpeciesData
[]
extensions
;
public
int
fieldCount
()
{
/*non-public*/
int
fieldCount
()
{
return
types
.
length
();
}
public
char
fieldType
(
int
i
)
{
/*non-public*/
char
fieldType
(
int
i
)
{
return
types
.
charAt
(
i
);
}
...
...
@@ -551,30 +551,30 @@ import jdk.internal.org.objectweb.asm.Type;
* final Object argL0;
* final Object argL1;
* final int argI2;
*
public
Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
* Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
* super(mt, lf);
* this.argL0 = argL0;
* this.argL1 = argL1;
* this.argI2 = argI2;
* }
*
public
final SpeciesData speciesData() { return SPECIES_DATA; }
*
public
static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LLI", Species_LLI.class);
*
public
final BoundMethodHandle clone(MethodType mt, LambdaForm lf) {
* final SpeciesData speciesData() { return SPECIES_DATA; }
* static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LLI", Species_LLI.class);
* final BoundMethodHandle clone(MethodType mt, LambdaForm lf) {
* return SPECIES_DATA.constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2);
* }
*
public
final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) {
* final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) {
* return SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
* }
*
public
final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) {
* final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) {
* return SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
* }
*
public
final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) {
* final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) {
* return SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
* }
*
public
final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) {
* final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) {
* return SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
* }
*
public
final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) {
* final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) {
* return SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
* }
* }
...
...
@@ -588,11 +588,12 @@ import jdk.internal.org.objectweb.asm.Type;
final
String
className
=
SPECIES_PREFIX_PATH
+
types
;
final
String
sourceFile
=
SPECIES_PREFIX_NAME
+
types
;
cw
.
visit
(
V1_6
,
ACC_PUBLIC
+
ACC_FINAL
+
ACC_SUPER
,
className
,
null
,
BMH
,
null
);
final
int
NOT_ACC_PUBLIC
=
0
;
// not ACC_PUBLIC
cw
.
visit
(
V1_6
,
NOT_ACC_PUBLIC
+
ACC_FINAL
+
ACC_SUPER
,
className
,
null
,
BMH
,
null
);
cw
.
visitSource
(
sourceFile
,
null
);
// emit static types and SPECIES_DATA fields
cw
.
visitField
(
ACC_PUBLIC
+
ACC_STATIC
,
"SPECIES_DATA"
,
SPECIES_DATA_SIG
,
null
,
null
).
visitEnd
();
cw
.
visitField
(
NOT_
ACC_PUBLIC
+
ACC_STATIC
,
"SPECIES_DATA"
,
SPECIES_DATA_SIG
,
null
,
null
).
visitEnd
();
// emit bound argument fields
for
(
int
i
=
0
;
i
<
types
.
length
();
++
i
)
{
...
...
@@ -605,7 +606,7 @@ import jdk.internal.org.objectweb.asm.Type;
MethodVisitor
mv
;
// emit constructor
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
,
"<init>"
,
makeSignature
(
types
,
true
),
null
,
null
);
mv
=
cw
.
visitMethod
(
NOT_
ACC_PUBLIC
,
"<init>"
,
makeSignature
(
types
,
true
),
null
,
null
);
mv
.
visitCode
();
mv
.
visitVarInsn
(
ALOAD
,
0
);
mv
.
visitVarInsn
(
ALOAD
,
1
);
...
...
@@ -629,7 +630,7 @@ import jdk.internal.org.objectweb.asm.Type;
mv
.
visitEnd
();
// emit implementation of reinvokerTarget()
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
+
ACC_FINAL
,
"reinvokerTarget"
,
"()"
+
MH_SIG
,
null
,
null
);
mv
=
cw
.
visitMethod
(
NOT_
ACC_PUBLIC
+
ACC_FINAL
,
"reinvokerTarget"
,
"()"
+
MH_SIG
,
null
,
null
);
mv
.
visitCode
();
mv
.
visitVarInsn
(
ALOAD
,
0
);
mv
.
visitFieldInsn
(
GETFIELD
,
className
,
"argL0"
,
JLO_SIG
);
...
...
@@ -639,7 +640,7 @@ import jdk.internal.org.objectweb.asm.Type;
mv
.
visitEnd
();
// emit implementation of speciesData()
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
+
ACC_FINAL
,
"speciesData"
,
MYSPECIES_DATA_SIG
,
null
,
null
);
mv
=
cw
.
visitMethod
(
NOT_
ACC_PUBLIC
+
ACC_FINAL
,
"speciesData"
,
MYSPECIES_DATA_SIG
,
null
,
null
);
mv
.
visitCode
();
mv
.
visitFieldInsn
(
GETSTATIC
,
className
,
"SPECIES_DATA"
,
SPECIES_DATA_SIG
);
mv
.
visitInsn
(
ARETURN
);
...
...
@@ -647,7 +648,7 @@ import jdk.internal.org.objectweb.asm.Type;
mv
.
visitEnd
();
// emit clone()
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
+
ACC_FINAL
,
"clone"
,
makeSignature
(
""
,
false
),
null
,
E_THROWABLE
);
mv
=
cw
.
visitMethod
(
NOT_
ACC_PUBLIC
+
ACC_FINAL
,
"clone"
,
makeSignature
(
""
,
false
),
null
,
E_THROWABLE
);
mv
.
visitCode
();
// return speciesData().constructor[0].invokeBasic(mt, lf, argL0, ...)
// obtain constructor
...
...
@@ -670,7 +671,7 @@ import jdk.internal.org.objectweb.asm.Type;
// for each type, emit cloneExtendT()
for
(
Class
<?>
c
:
TYPES
)
{
char
t
=
Wrapper
.
basicTypeChar
(
c
);
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
+
ACC_FINAL
,
"cloneExtend"
+
t
,
makeSignature
(
String
.
valueOf
(
t
),
false
),
null
,
E_THROWABLE
);
mv
=
cw
.
visitMethod
(
NOT_
ACC_PUBLIC
+
ACC_FINAL
,
"cloneExtend"
+
t
,
makeSignature
(
String
.
valueOf
(
t
),
false
),
null
,
E_THROWABLE
);
mv
.
visitCode
();
// return SPECIES_DATA.extendWithIndex(extensionIndex(t)).constructor[0].invokeBasic(mt, lf, argL0, ..., narg)
// obtain constructor
...
...
@@ -697,7 +698,7 @@ import jdk.internal.org.objectweb.asm.Type;
}
// emit class initializer
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
|
ACC_STATIC
,
"<clinit>"
,
VOID_SIG
,
null
,
null
);
mv
=
cw
.
visitMethod
(
NOT_
ACC_PUBLIC
|
ACC_STATIC
,
"<clinit>"
,
VOID_SIG
,
null
,
null
);
mv
.
visitCode
();
mv
.
visitLdcInsn
(
types
);
mv
.
visitLdcInsn
(
Type
.
getObjectType
(
className
));
...
...
src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
浏览文件 @
6a9bbad7
...
...
@@ -274,8 +274,9 @@ class InvokerBytecodeGenerator {
* Set up class file generation.
*/
private
void
classFilePrologue
()
{
final
int
NOT_ACC_PUBLIC
=
0
;
// not ACC_PUBLIC
cw
=
new
ClassWriter
(
ClassWriter
.
COMPUTE_MAXS
+
ClassWriter
.
COMPUTE_FRAMES
);
cw
.
visit
(
Opcodes
.
V1_8
,
Opcodes
.
ACC_PUBLIC
+
Opcodes
.
ACC_FINAL
+
Opcodes
.
ACC_SUPER
,
className
,
null
,
superName
,
null
);
cw
.
visit
(
Opcodes
.
V1_8
,
NOT_
ACC_PUBLIC
+
Opcodes
.
ACC_FINAL
+
Opcodes
.
ACC_SUPER
,
className
,
null
,
superName
,
null
);
cw
.
visitSource
(
sourceFile
,
null
);
String
invokerDesc
=
invokerType
.
toMethodDescriptorString
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录