Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c40e7077
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看板
提交
c40e7077
编写于
1月 29, 2015
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
Reviewed-by: jrose, kvn
上级
9139353f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
21 deletion
+56
-21
src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
...re/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+0
-1
src/share/classes/java/lang/invoke/LambdaForm.java
src/share/classes/java/lang/invoke/LambdaForm.java
+4
-8
src/share/classes/java/lang/invoke/MethodHandleImpl.java
src/share/classes/java/lang/invoke/MethodHandleImpl.java
+48
-11
src/share/classes/java/lang/invoke/MethodHandleStatics.java
src/share/classes/java/lang/invoke/MethodHandleStatics.java
+4
-1
未找到文件。
src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
浏览文件 @
c40e7077
...
...
@@ -635,7 +635,6 @@ class InvokerBytecodeGenerator {
mv
.
visitAnnotation
(
"Ljava/lang/invoke/DontInline;"
,
true
);
}
// iterate over the form's names, generating bytecode instructions for each
// start iterating at the first name following the arguments
Name
onStack
=
null
;
...
...
src/share/classes/java/lang/invoke/LambdaForm.java
浏览文件 @
c40e7077
...
...
@@ -244,7 +244,7 @@ class LambdaForm {
LambdaForm
(
String
debugName
,
int
arity
,
Name
[]
names
,
int
result
)
{
this
(
debugName
,
arity
,
names
,
result
,
true
);
this
(
debugName
,
arity
,
names
,
result
,
/*forceInline=*/
true
);
}
LambdaForm
(
String
debugName
,
int
arity
,
Name
[]
names
,
int
result
,
boolean
forceInline
)
{
...
...
@@ -263,7 +263,7 @@ class LambdaForm {
}
LambdaForm
(
String
debugName
,
int
arity
,
Name
[]
names
)
{
this
(
debugName
,
arity
,
names
,
LAST_RESULT
,
true
);
this
(
debugName
,
arity
,
names
,
LAST_RESULT
,
/*forceInline=*/
true
);
}
LambdaForm
(
String
debugName
,
int
arity
,
Name
[]
names
,
boolean
forceInline
)
{
...
...
@@ -272,7 +272,7 @@ class LambdaForm {
LambdaForm
(
String
debugName
,
Name
[]
formals
,
Name
[]
temps
,
Name
result
)
{
this
(
debugName
,
formals
.
length
,
buildNames
(
formals
,
temps
,
result
),
LAST_RESULT
,
true
);
formals
.
length
,
buildNames
(
formals
,
temps
,
result
),
LAST_RESULT
,
/*forceInline=*/
true
);
}
LambdaForm
(
String
debugName
,
Name
[]
formals
,
Name
[]
temps
,
Name
result
,
boolean
forceInline
)
{
...
...
@@ -291,10 +291,6 @@ class LambdaForm {
}
private
LambdaForm
(
String
sig
)
{
this
(
sig
,
true
);
}
private
LambdaForm
(
String
sig
,
boolean
forceInline
)
{
// Make a blank lambda form, which returns a constant zero or null.
// It is used as a template for managing the invocation of similar forms that are non-empty.
// Called only from getPreparedForm.
...
...
@@ -303,7 +299,7 @@ class LambdaForm {
this
.
result
=
(
signatureReturn
(
sig
)
==
V_TYPE
?
-
1
:
arity
);
this
.
names
=
buildEmptyNames
(
arity
,
sig
);
this
.
debugName
=
"LF.zero"
;
this
.
forceInline
=
forceInlin
e
;
this
.
forceInline
=
tru
e
;
assert
(
nameRefsAreLegal
());
assert
(
isEmpty
());
assert
(
sig
.
equals
(
basicTypeSignature
()))
:
sig
+
" != "
+
basicTypeSignature
();
...
...
src/share/classes/java/lang/invoke/MethodHandleImpl.java
浏览文件 @
c40e7077
...
...
@@ -597,6 +597,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
static
final
NamedFunction
NF_checkSpreadArgument
;
static
final
NamedFunction
NF_guardWithCatch
;
static
final
NamedFunction
NF_throwException
;
static
final
NamedFunction
NF_profileBoolean
;
static
final
MethodHandle
MH_castReference
;
static
final
MethodHandle
MH_selectAlternative
;
...
...
@@ -614,10 +615,12 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
NF_guardWithCatch
=
new
NamedFunction
(
MHI
.
getDeclaredMethod
(
"guardWithCatch"
,
MethodHandle
.
class
,
Class
.
class
,
MethodHandle
.
class
,
Object
[].
class
));
NF_throwException
=
new
NamedFunction
(
MHI
.
getDeclaredMethod
(
"throwException"
,
Throwable
.
class
));
NF_profileBoolean
=
new
NamedFunction
(
MHI
.
getDeclaredMethod
(
"profileBoolean"
,
boolean
.
class
,
int
[].
class
));
NF_checkSpreadArgument
.
resolve
();
NF_guardWithCatch
.
resolve
();
NF_throwException
.
resolve
();
NF_profileBoolean
.
resolve
();
MH_castReference
=
IMPL_LOOKUP
.
findStatic
(
MHI
,
"castReference"
,
MethodType
.
methodType
(
Object
.
class
,
Class
.
class
,
Object
.
class
));
...
...
@@ -697,7 +700,26 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
@LambdaForm
.
Hidden
static
MethodHandle
selectAlternative
(
boolean
testResult
,
MethodHandle
target
,
MethodHandle
fallback
)
{
return
testResult
?
target
:
fallback
;
if
(
testResult
)
{
return
target
;
}
else
{
return
fallback
;
}
}
// Intrinsified by C2. Counters are used during parsing to calculate branch frequencies.
@LambdaForm
.
Hidden
static
boolean
profileBoolean
(
boolean
result
,
int
[]
counters
)
{
// Profile is int[2] where [0] and [1] correspond to false and true occurrences respectively.
int
idx
=
result
?
1
:
0
;
try
{
counters
[
idx
]
=
Math
.
addExact
(
counters
[
idx
],
1
);
}
catch
(
ArithmeticException
e
)
{
// Avoid continuous overflow by halving the problematic count.
counters
[
idx
]
=
counters
[
idx
]
/
2
;
}
return
result
;
}
static
...
...
@@ -708,13 +730,18 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
assert
(
test
.
type
().
equals
(
type
.
changeReturnType
(
boolean
.
class
))
&&
fallback
.
type
().
equals
(
type
));
MethodType
basicType
=
type
.
basicType
();
LambdaForm
form
=
makeGuardWithTestForm
(
basicType
);
BoundMethodHandle
.
SpeciesData
data
=
BoundMethodHandle
.
speciesData_LLL
();
BoundMethodHandle
mh
;
try
{
mh
=
(
BoundMethodHandle
)
data
.
constructor
().
invokeBasic
(
type
,
form
,
(
Object
)
test
,
(
Object
)
profile
(
target
),
(
Object
)
profile
(
fallback
));
if
(
PROFILE_GWT
)
{
int
[]
counts
=
new
int
[
2
];
mh
=
(
BoundMethodHandle
)
BoundMethodHandle
.
speciesData_LLLL
().
constructor
().
invokeBasic
(
type
,
form
,
(
Object
)
test
,
(
Object
)
profile
(
target
),
(
Object
)
profile
(
fallback
),
counts
);
}
else
{
mh
=
(
BoundMethodHandle
)
BoundMethodHandle
.
speciesData_LLL
().
constructor
().
invokeBasic
(
type
,
form
,
(
Object
)
test
,
(
Object
)
profile
(
target
),
(
Object
)
profile
(
fallback
));
}
}
catch
(
Throwable
ex
)
{
throw
uncaughtException
(
ex
);
}
...
...
@@ -856,7 +883,10 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
final
int
GET_TEST
=
nameCursor
++;
final
int
GET_TARGET
=
nameCursor
++;
final
int
GET_FALLBACK
=
nameCursor
++;
final
int
GET_COUNTERS
=
PROFILE_GWT
?
nameCursor
++
:
-
1
;
final
int
CALL_TEST
=
nameCursor
++;
final
int
PROFILE
=
(
GET_COUNTERS
!=
-
1
)
?
nameCursor
++
:
-
1
;
final
int
TEST
=
nameCursor
-
1
;
// previous statement: either PROFILE or CALL_TEST
final
int
SELECT_ALT
=
nameCursor
++;
final
int
CALL_TARGET
=
nameCursor
++;
assert
(
CALL_TARGET
==
SELECT_ALT
+
1
);
// must be true to trigger IBG.emitSelectAlternative
...
...
@@ -864,12 +894,16 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
MethodType
lambdaType
=
basicType
.
invokerType
();
Name
[]
names
=
arguments
(
nameCursor
-
ARG_LIMIT
,
lambdaType
);
BoundMethodHandle
.
SpeciesData
data
=
BoundMethodHandle
.
speciesData_LLL
();
BoundMethodHandle
.
SpeciesData
data
=
(
GET_COUNTERS
!=
-
1
)
?
BoundMethodHandle
.
speciesData_LLLL
()
:
BoundMethodHandle
.
speciesData_LLL
();
names
[
THIS_MH
]
=
names
[
THIS_MH
].
withConstraint
(
data
);
names
[
GET_TEST
]
=
new
Name
(
data
.
getterFunction
(
0
),
names
[
THIS_MH
]);
names
[
GET_TARGET
]
=
new
Name
(
data
.
getterFunction
(
1
),
names
[
THIS_MH
]);
names
[
GET_FALLBACK
]
=
new
Name
(
data
.
getterFunction
(
2
),
names
[
THIS_MH
]);
if
(
GET_COUNTERS
!=
-
1
)
{
names
[
GET_COUNTERS
]
=
new
Name
(
data
.
getterFunction
(
3
),
names
[
THIS_MH
]);
}
Object
[]
invokeArgs
=
Arrays
.
copyOfRange
(
names
,
0
,
ARG_LIMIT
,
Object
[].
class
);
// call test
...
...
@@ -877,15 +911,18 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
invokeArgs
[
0
]
=
names
[
GET_TEST
];
names
[
CALL_TEST
]
=
new
Name
(
testType
,
invokeArgs
);
// profile branch
if
(
PROFILE
!=
-
1
)
{
names
[
PROFILE
]
=
new
Name
(
Lazy
.
NF_profileBoolean
,
names
[
CALL_TEST
],
names
[
GET_COUNTERS
]);
}
// call selectAlternative
names
[
SELECT_ALT
]
=
new
Name
(
Lazy
.
MH_selectAlternative
,
names
[
CALL_TEST
],
names
[
GET_TARGET
],
names
[
GET_FALLBACK
]);
names
[
SELECT_ALT
]
=
new
Name
(
Lazy
.
MH_selectAlternative
,
names
[
TEST
],
names
[
GET_TARGET
],
names
[
GET_FALLBACK
]);
// call target or fallback
invokeArgs
[
0
]
=
names
[
SELECT_ALT
];
names
[
CALL_TARGET
]
=
new
Name
(
basicType
,
invokeArgs
);
lform
=
new
LambdaForm
(
"guard"
,
lambdaType
.
parameterCount
(),
names
);
lform
=
new
LambdaForm
(
"guard"
,
lambdaType
.
parameterCount
(),
names
,
/*forceInline=*/
true
);
return
basicType
.
form
().
setCachedLambdaForm
(
MethodTypeForm
.
LF_GWT
,
lform
);
}
...
...
src/share/classes/java/lang/invoke/MethodHandleStatics.java
浏览文件 @
c40e7077
...
...
@@ -48,9 +48,10 @@ import sun.misc.Unsafe;
static
final
int
COMPILE_THRESHOLD
;
static
final
int
DONT_INLINE_THRESHOLD
;
static
final
int
PROFILE_LEVEL
;
static
final
boolean
PROFILE_GWT
;
static
{
final
Object
[]
values
=
new
Object
[
7
];
final
Object
[]
values
=
new
Object
[
8
];
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
values
[
0
]
=
Boolean
.
getBoolean
(
"java.lang.invoke.MethodHandle.DEBUG_NAMES"
);
...
...
@@ -60,6 +61,7 @@ import sun.misc.Unsafe;
values
[
4
]
=
Integer
.
getInteger
(
"java.lang.invoke.MethodHandle.COMPILE_THRESHOLD"
,
0
);
values
[
5
]
=
Integer
.
getInteger
(
"java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD"
,
30
);
values
[
6
]
=
Integer
.
getInteger
(
"java.lang.invoke.MethodHandle.PROFILE_LEVEL"
,
0
);
values
[
7
]
=
Boolean
.
parseBoolean
(
System
.
getProperty
(
"java.lang.invoke.MethodHandle.PROFILE_GWT"
,
"true"
));
return
null
;
}
});
...
...
@@ -70,6 +72,7 @@ import sun.misc.Unsafe;
COMPILE_THRESHOLD
=
(
Integer
)
values
[
4
];
DONT_INLINE_THRESHOLD
=
(
Integer
)
values
[
5
];
PROFILE_LEVEL
=
(
Integer
)
values
[
6
];
PROFILE_GWT
=
(
Boolean
)
values
[
7
];
}
/** Tell if any of the debugging switches are turned on.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录