Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
55695a9d
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
55695a9d
编写于
7月 10, 2014
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8043546: C1 optimizes @Stable instance fields with default values
Reviewed-by: kvn, jrose
上级
c35b8fae
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
819 addition
and
515 deletion
+819
-515
src/share/vm/c1/c1_GraphBuilder.cpp
src/share/vm/c1/c1_GraphBuilder.cpp
+5
-0
test/compiler/stable/StableConfiguration.java
test/compiler/stable/StableConfiguration.java
+62
-0
test/compiler/stable/TestStableBoolean.java
test/compiler/stable/TestStableBoolean.java
+72
-54
test/compiler/stable/TestStableByte.java
test/compiler/stable/TestStableByte.java
+85
-56
test/compiler/stable/TestStableChar.java
test/compiler/stable/TestStableChar.java
+85
-57
test/compiler/stable/TestStableDouble.java
test/compiler/stable/TestStableDouble.java
+85
-58
test/compiler/stable/TestStableFloat.java
test/compiler/stable/TestStableFloat.java
+85
-58
test/compiler/stable/TestStableInt.java
test/compiler/stable/TestStableInt.java
+85
-58
test/compiler/stable/TestStableLong.java
test/compiler/stable/TestStableLong.java
+85
-58
test/compiler/stable/TestStableObject.java
test/compiler/stable/TestStableObject.java
+85
-58
test/compiler/stable/TestStableShort.java
test/compiler/stable/TestStableShort.java
+85
-58
未找到文件。
src/share/vm/c1/c1_GraphBuilder.cpp
浏览文件 @
55695a9d
...
@@ -1569,6 +1569,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
...
@@ -1569,6 +1569,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
default:
default:
constant
=
new
Constant
(
as_ValueType
(
field_val
));
constant
=
new
Constant
(
as_ValueType
(
field_val
));
}
}
// Stable static fields are checked for non-default values in ciField::initialize_from().
}
}
if
(
constant
!=
NULL
)
{
if
(
constant
!=
NULL
)
{
push
(
type
,
append
(
constant
));
push
(
type
,
append
(
constant
));
...
@@ -1610,6 +1611,10 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
...
@@ -1610,6 +1611,10 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
default:
default:
constant
=
new
Constant
(
as_ValueType
(
field_val
));
constant
=
new
Constant
(
as_ValueType
(
field_val
));
}
}
if
(
FoldStableValues
&&
field
->
is_stable
()
&&
field_val
.
is_null_or_zero
())
{
// Stable field with default value can't be constant.
constant
=
NULL
;
}
}
else
{
}
else
{
// For CallSite objects treat the target field as a compile time constant.
// For CallSite objects treat the target field as a compile time constant.
if
(
const_oop
->
is_call_site
())
{
if
(
const_oop
->
is_call_site
())
{
...
...
test/compiler/stable/StableConfiguration.java
0 → 100644
浏览文件 @
55695a9d
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
java.lang.invoke
;
import
java.lang.reflect.Method
;
import
java.util.Properties
;
import
sun.hotspot.WhiteBox
;
public
class
StableConfiguration
{
static
final
WhiteBox
WB
=
WhiteBox
.
getWhiteBox
();
static
final
boolean
isStableEnabled
;
static
final
boolean
isServerWithStable
;
static
{
Boolean
value
=
WB
.
getBooleanVMFlag
(
"FoldStableValues"
);
isStableEnabled
=
(
value
==
null
?
false
:
value
);
isServerWithStable
=
isStableEnabled
&&
get
();
System
.
out
.
println
(
"@Stable: "
+
(
isStableEnabled
?
"enabled"
:
"disabled"
));
System
.
out
.
println
(
"Server Compiler: "
+
get
());
}
// ::get() is among immediately compiled methods.
static
boolean
get
()
{
try
{
Method
m
=
StableConfiguration
.
class
.
getDeclaredMethod
(
"get"
);
int
level
=
WB
.
getMethodCompilationLevel
(
m
);
if
(
level
>
0
)
{
return
(
level
==
4
);
}
else
{
String
javaVM
=
System
.
getProperty
(
"java.vm.name"
,
""
);
if
(
javaVM
.
contains
(
"Server"
))
return
true
;
if
(
javaVM
.
contains
(
"Client"
))
return
false
;
throw
new
Error
(
"Unknown VM type: "
+
javaVM
);
}
}
catch
(
NoSuchMethodException
e
)
{
throw
new
Error
(
e
);
}
}
}
test/compiler/stable/TestStableBoolean.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableBoolean
* @test TestStableBoolean
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableBoolean.java
* @build TestStableBoolean StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableBoolean
* java/lang/invoke/TestStableBoolean
* java/lang/invoke/TestStableBoolean$BooleanStable
* java/lang/invoke/TestStableBoolean$BooleanStable
* java/lang/invoke/TestStableBoolean$StaticBooleanStable
* java/lang/invoke/TestStableBoolean$StaticBooleanStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableBoolean$NestedStableField3
* java/lang/invoke/TestStableBoolean$NestedStableField3
* java/lang/invoke/TestStableBoolean$NestedStableField3$A
* java/lang/invoke/TestStableBoolean$NestedStableField3$A
* java/lang/invoke/TestStableBoolean$DefaultValue
* java/lang/invoke/TestStableBoolean$DefaultValue
* java/lang/invoke/TestStableBoolean$DefaultStaticValue
* java/lang/invoke/TestStableBoolean$ObjectArrayLowerDim2
* java/lang/invoke/TestStableBoolean$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* java.lang.invoke.TestStableBoolean
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* java.lang.invoke.TestStableBoolean
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* java.lang.invoke.TestStableBoolean
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* java.lang.invoke.TestStableBoolean
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableBoolean
{
public
class
TestStableBoolean
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
BooleanStable
.
class
);
run
(
BooleanStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticBooleanStable
.
class
);
run
(
StaticBooleanStable
.
class
);
run
(
VolatileBooleanStable
.
class
);
run
(
VolatileBooleanStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableBoolean {
...
@@ -145,6 +161,21 @@ public class TestStableBoolean {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
boolean
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
boolean
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
boolean
val1
=
get
();
c
.
v
=
true
;
boolean
val2
=
get
();
assertEquals
(
val1
,
false
);
assertEquals
(
val2
,
true
);
}
}
/* ==================================================== */
static
class
StaticBooleanStable
{
static
class
StaticBooleanStable
{
public
static
@Stable
boolean
v
;
public
static
@Stable
boolean
v
;
...
@@ -188,14 +219,14 @@ public class TestStableBoolean {
...
@@ -188,14 +219,14 @@ public class TestStableBoolean {
c
.
v
=
new
boolean
[
1
];
c
.
v
[
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
=
new
boolean
[
1
];
c
.
v
[
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
[
0
]
=
false
;
boolean
val2
=
get
();
c
.
v
[
0
]
=
false
;
boolean
val2
=
get
();
assertEquals
(
val1
,
true
);
assertEquals
(
val1
,
true
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
true
:
false
));
}
}
{
{
c
.
v
=
new
boolean
[
20
];
c
.
v
[
10
]
=
true
;
boolean
val1
=
get1
();
c
.
v
=
new
boolean
[
20
];
c
.
v
[
10
]
=
true
;
boolean
val1
=
get1
();
c
.
v
[
10
]
=
false
;
boolean
val2
=
get1
();
c
.
v
[
10
]
=
false
;
boolean
val2
=
get1
();
assertEquals
(
val1
,
true
);
assertEquals
(
val1
,
true
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
true
:
false
));
}
}
{
{
...
@@ -220,19 +251,19 @@ public class TestStableBoolean {
...
@@ -220,19 +251,19 @@ public class TestStableBoolean {
c
.
v
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
[
0
][
0
]
=
false
;
boolean
val2
=
get
();
c
.
v
[
0
][
0
]
=
false
;
boolean
val2
=
get
();
assertEquals
(
val1
,
true
);
assertEquals
(
val1
,
true
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
]
=
false
;
boolean
val3
=
get
();
c
.
v
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
]
=
false
;
boolean
val3
=
get
();
assertEquals
(
val3
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
[
0
]
=
new
boolean
[
1
];
c
.
v
[
0
][
0
]
=
false
;
boolean
val4
=
get
();
c
.
v
[
0
]
=
new
boolean
[
1
];
c
.
v
[
0
][
0
]
=
false
;
boolean
val4
=
get
();
assertEquals
(
val4
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val4
,
(
isS
erverWithStable
?
true
:
false
));
}
}
{
{
c
.
v
=
new
boolean
[
1
][
1
];
boolean
[]
val1
=
get1
();
c
.
v
=
new
boolean
[
1
][
1
];
boolean
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
boolean
[
1
];
boolean
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
boolean
[
1
];
boolean
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -258,28 +289,28 @@ public class TestStableBoolean {
...
@@ -258,28 +289,28 @@ public class TestStableBoolean {
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val2
=
get
();
assertEquals
(
val1
,
true
);
assertEquals
(
val1
,
true
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val3
=
get
();
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val3
=
get
();
assertEquals
(
val3
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
[
0
]
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val4
=
get
();
c
.
v
[
0
]
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val4
=
get
();
assertEquals
(
val4
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val4
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
[
0
][
0
]
=
new
boolean
[
1
];
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
boolean
[
1
];
c
.
v
[
0
][
0
][
0
]
=
false
;
boolean
val5
=
get
();
assertEquals
(
val5
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val5
,
(
isS
erverWithStable
?
true
:
false
));
}
}
{
{
c
.
v
=
new
boolean
[
1
][
1
][
1
];
boolean
[]
val1
=
get1
();
c
.
v
=
new
boolean
[
1
][
1
][
1
];
boolean
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
boolean
[
1
];
boolean
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
boolean
[
1
];
boolean
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
boolean
[
1
][
1
][
1
];
boolean
[][]
val1
=
get2
();
c
.
v
=
new
boolean
[
1
][
1
][
1
];
boolean
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
boolean
[
1
][
1
];
boolean
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
boolean
[
1
][
1
];
boolean
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -306,37 +337,37 @@ public class TestStableBoolean {
...
@@ -306,37 +337,37 @@ public class TestStableBoolean {
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
true
;
boolean
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val2
=
get
();
assertEquals
(
val1
,
true
);
assertEquals
(
val1
,
true
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val3
=
get
();
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val3
=
get
();
assertEquals
(
val3
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
[
0
]
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val4
=
get
();
c
.
v
[
0
]
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val4
=
get
();
assertEquals
(
val4
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val4
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
[
0
][
0
]
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
boolean
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val5
=
get
();
assertEquals
(
val5
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val5
,
(
isS
erverWithStable
?
true
:
false
));
c
.
v
[
0
][
0
][
0
]
=
new
boolean
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
boolean
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
false
;
boolean
val6
=
get
();
assertEquals
(
val6
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val6
,
(
isS
erverWithStable
?
true
:
false
));
}
}
{
{
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
boolean
[]
val1
=
get1
();
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
boolean
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
boolean
[
1
];
boolean
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
boolean
[
1
];
boolean
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
boolean
[][]
val1
=
get2
();
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
boolean
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
boolean
[
1
][
1
];
boolean
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
boolean
[
1
][
1
];
boolean
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
boolean
[][][]
val1
=
get3
();
c
.
v
=
new
boolean
[
1
][
1
][
1
][
1
];
boolean
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
boolean
[
1
][
1
][
1
];
boolean
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
boolean
[
1
][
1
][
1
];
boolean
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -399,7 +430,7 @@ public class TestStableBoolean {
...
@@ -399,7 +430,7 @@ public class TestStableBoolean {
c
.
v
=
new
boolean
[
1
][
1
];
c
.
v
[
0
]
=
new
boolean
[
0
];
boolean
[]
val1
=
get1
();
c
.
v
=
new
boolean
[
1
][
1
];
c
.
v
[
0
]
=
new
boolean
[
0
];
boolean
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
boolean
[
0
];
boolean
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
boolean
[
0
];
boolean
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -435,14 +466,14 @@ public class TestStableBoolean {
...
@@ -435,14 +466,14 @@ public class TestStableBoolean {
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
boolean
[
0
];
boolean
[]
val1
=
get1
();
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
boolean
[
0
];
boolean
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
boolean
[
0
];
boolean
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
boolean
[
0
];
boolean
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
boolean
[
0
][
0
];
boolean
[][]
val1
=
get2
();
c
.
v
=
new
boolean
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
boolean
[
0
][
0
];
boolean
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
boolean
[
0
][
0
];
boolean
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
boolean
[
0
][
0
];
boolean
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -577,7 +608,7 @@ public class TestStableBoolean {
...
@@ -577,7 +608,7 @@ public class TestStableBoolean {
elem
.
a
=
false
;
boolean
val3
=
get
();
boolean
val4
=
get1
();
elem
.
a
=
false
;
boolean
val3
=
get
();
boolean
val4
=
get1
();
assertEquals
(
val1
,
true
);
assertEquals
(
val1
,
true
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
true
:
false
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
true
:
false
));
assertEquals
(
val2
,
true
);
assertEquals
(
val2
,
true
);
assertEquals
(
val4
,
false
);
assertEquals
(
val4
,
false
);
...
@@ -611,17 +642,4 @@ public class TestStableBoolean {
...
@@ -611,17 +642,4 @@ public class TestStableBoolean {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableByte.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableByte
* @test TestStableByte
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableByte.java
* @build TestStableByte StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableByte
* java/lang/invoke/TestStableByte
* java/lang/invoke/TestStableByte$ByteStable
* java/lang/invoke/TestStableByte$ByteStable
* java/lang/invoke/TestStableByte$StaticByteStable
* java/lang/invoke/TestStableByte$StaticByteStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableByte$NestedStableField3
* java/lang/invoke/TestStableByte$NestedStableField3
* java/lang/invoke/TestStableByte$NestedStableField3$A
* java/lang/invoke/TestStableByte$NestedStableField3$A
* java/lang/invoke/TestStableByte$DefaultValue
* java/lang/invoke/TestStableByte$DefaultValue
* java/lang/invoke/TestStableByte$DefaultStaticValue
* java/lang/invoke/TestStableByte$ObjectArrayLowerDim2
* java/lang/invoke/TestStableByte$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* java.lang.invoke.TestStableByte
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* java.lang.invoke.TestStableByte
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* java.lang.invoke.TestStableByte
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* java.lang.invoke.TestStableByte
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableByte
{
public
class
TestStableByte
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
ByteStable
.
class
);
run
(
ByteStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticByteStable
.
class
);
run
(
StaticByteStable
.
class
);
run
(
VolatileByteStable
.
class
);
run
(
VolatileByteStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableByte {
...
@@ -145,6 +161,21 @@ public class TestStableByte {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
byte
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
byte
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
byte
val1
=
get
();
c
.
v
=
1
;
byte
val2
=
get
();
assertEquals
(
val1
,
0
);
assertEquals
(
val2
,
1
);
}
}
/* ==================================================== */
static
class
StaticByteStable
{
static
class
StaticByteStable
{
public
static
@Stable
byte
v
;
public
static
@Stable
byte
v
;
...
@@ -188,20 +219,22 @@ public class TestStableByte {
...
@@ -188,20 +219,22 @@ public class TestStableByte {
c
.
v
=
new
byte
[
1
];
c
.
v
[
0
]
=
1
;
byte
val1
=
get
();
c
.
v
=
new
byte
[
1
];
c
.
v
[
0
]
=
1
;
byte
val1
=
get
();
c
.
v
[
0
]
=
2
;
byte
val2
=
get
();
c
.
v
[
0
]
=
2
;
byte
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
byte
[
1
];
c
.
v
[
0
]
=
3
;
byte
val3
=
get
();
c
.
v
=
new
byte
[
1
];
c
.
v
[
0
]
=
3
;
byte
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
c
.
v
=
new
byte
[
20
];
c
.
v
[
10
]
=
1
;
byte
val1
=
get1
();
c
.
v
=
new
byte
[
20
];
c
.
v
[
10
]
=
1
;
byte
val1
=
get1
();
c
.
v
[
10
]
=
2
;
byte
val2
=
get1
();
c
.
v
[
10
]
=
2
;
byte
val2
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
byte
[
20
];
c
.
v
[
10
]
=
3
;
byte
val3
=
get1
();
c
.
v
=
new
byte
[
20
];
c
.
v
[
10
]
=
3
;
byte
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
...
@@ -226,19 +259,21 @@ public class TestStableByte {
...
@@ -226,19 +259,21 @@ public class TestStableByte {
c
.
v
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
byte
val1
=
get
();
c
.
v
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
byte
val1
=
get
();
c
.
v
[
0
][
0
]
=
2
;
byte
val2
=
get
();
c
.
v
[
0
][
0
]
=
2
;
byte
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
byte
val3
=
get
();
c
.
v
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
byte
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
byte
[
1
];
c
.
v
[
0
][
0
]
=
4
;
byte
val4
=
get
();
c
.
v
[
0
]
=
new
byte
[
1
];
c
.
v
[
0
][
0
]
=
4
;
byte
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
}
}
{
{
c
.
v
=
new
byte
[
1
][
1
];
byte
[]
val1
=
get1
();
c
.
v
=
new
byte
[
1
][
1
];
byte
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
byte
[
1
];
byte
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
byte
[
1
];
byte
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -264,28 +299,31 @@ public class TestStableByte {
...
@@ -264,28 +299,31 @@ public class TestStableByte {
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
byte
val1
=
get
();
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
byte
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
byte
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
byte
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
byte
val3
=
get
();
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
byte
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
byte
val4
=
get
();
c
.
v
[
0
]
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
byte
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
byte
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
byte
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
byte
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
byte
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
}
}
{
{
c
.
v
=
new
byte
[
1
][
1
][
1
];
byte
[]
val1
=
get1
();
c
.
v
=
new
byte
[
1
][
1
][
1
];
byte
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
byte
[
1
];
byte
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
byte
[
1
];
byte
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
byte
[
1
][
1
][
1
];
byte
[][]
val1
=
get2
();
c
.
v
=
new
byte
[
1
][
1
][
1
];
byte
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
byte
[
1
][
1
];
byte
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
byte
[
1
][
1
];
byte
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -312,37 +350,41 @@ public class TestStableByte {
...
@@ -312,37 +350,41 @@ public class TestStableByte {
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
byte
val1
=
get
();
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
byte
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
byte
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
byte
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
byte
val3
=
get
();
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
byte
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
byte
val4
=
get
();
c
.
v
[
0
]
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
byte
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
byte
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
byte
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
byte
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
c
.
v
[
0
][
0
][
0
]
=
new
byte
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
byte
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
byte
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
byte
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
1
:
6
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
6
));
}
}
{
{
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
byte
[]
val1
=
get1
();
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
byte
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
byte
[
1
];
byte
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
byte
[
1
];
byte
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
byte
[][]
val1
=
get2
();
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
byte
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
byte
[
1
][
1
];
byte
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
byte
[
1
][
1
];
byte
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
byte
[][][]
val1
=
get3
();
c
.
v
=
new
byte
[
1
][
1
][
1
][
1
];
byte
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
byte
[
1
][
1
][
1
];
byte
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
byte
[
1
][
1
][
1
];
byte
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -404,7 +446,7 @@ public class TestStableByte {
...
@@ -404,7 +446,7 @@ public class TestStableByte {
c
.
v
=
new
byte
[
1
][
1
];
c
.
v
[
0
]
=
new
byte
[
0
];
byte
[]
val1
=
get1
();
c
.
v
=
new
byte
[
1
][
1
];
c
.
v
[
0
]
=
new
byte
[
0
];
byte
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
byte
[
0
];
byte
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
byte
[
0
];
byte
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -440,14 +482,14 @@ public class TestStableByte {
...
@@ -440,14 +482,14 @@ public class TestStableByte {
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
byte
[
0
];
byte
[]
val1
=
get1
();
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
byte
[
0
];
byte
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
byte
[
0
];
byte
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
byte
[
0
];
byte
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
byte
[
0
][
0
];
byte
[][]
val1
=
get2
();
c
.
v
=
new
byte
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
byte
[
0
][
0
];
byte
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
byte
[
0
][
0
];
byte
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
byte
[
0
][
0
];
byte
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -582,7 +624,7 @@ public class TestStableByte {
...
@@ -582,7 +624,7 @@ public class TestStableByte {
elem
.
a
=
2
;
byte
val3
=
get
();
byte
val4
=
get1
();
elem
.
a
=
2
;
byte
val3
=
get
();
byte
val4
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
1
:
2
));
assertEquals
(
val2
,
1
);
assertEquals
(
val2
,
1
);
assertEquals
(
val4
,
2
);
assertEquals
(
val4
,
2
);
...
@@ -616,17 +658,4 @@ public class TestStableByte {
...
@@ -616,17 +658,4 @@ public class TestStableByte {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableChar.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableChar
* @test TestStableChar
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableChar.java
* @build TestStableChar StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableChar
* java/lang/invoke/TestStableChar
* java/lang/invoke/TestStableChar$CharStable
* java/lang/invoke/TestStableChar$CharStable
* java/lang/invoke/TestStableChar$StaticCharStable
* java/lang/invoke/TestStableChar$StaticCharStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableChar$NestedStableField3
* java/lang/invoke/TestStableChar$NestedStableField3
* java/lang/invoke/TestStableChar$NestedStableField3$A
* java/lang/invoke/TestStableChar$NestedStableField3$A
* java/lang/invoke/TestStableChar$DefaultValue
* java/lang/invoke/TestStableChar$DefaultValue
* java/lang/invoke/TestStableChar$DefaultStaticValue
* java/lang/invoke/TestStableChar$ObjectArrayLowerDim2
* java/lang/invoke/TestStableChar$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* java.lang.invoke.TestStableChar
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* java.lang.invoke.TestStableChar
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* java.lang.invoke.TestStableChar
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* java.lang.invoke.TestStableChar
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableChar
{
public
class
TestStableChar
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
CharStable
.
class
);
run
(
CharStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticCharStable
.
class
);
run
(
StaticCharStable
.
class
);
run
(
VolatileCharStable
.
class
);
run
(
VolatileCharStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableChar {
...
@@ -145,6 +161,21 @@ public class TestStableChar {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
char
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
char
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
char
val1
=
get
();
c
.
v
=
'a'
;
char
val2
=
get
();
assertEquals
(
val1
,
0
);
assertEquals
(
val2
,
'a'
);
}
}
/* ==================================================== */
static
class
StaticCharStable
{
static
class
StaticCharStable
{
public
@Stable
char
v
;
public
@Stable
char
v
;
...
@@ -188,20 +219,22 @@ public class TestStableChar {
...
@@ -188,20 +219,22 @@ public class TestStableChar {
c
.
v
=
new
char
[
1
];
c
.
v
[
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
=
new
char
[
1
];
c
.
v
[
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
[
0
]
=
'b'
;
char
val2
=
get
();
c
.
v
[
0
]
=
'b'
;
char
val2
=
get
();
assertEquals
(
val1
,
'a'
);
assertEquals
(
val1
,
'a'
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
'a'
:
'b'
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
'a'
:
'b'
));
c
.
v
=
new
char
[
1
];
c
.
v
[
0
]
=
'c'
;
char
val3
=
get
();
c
.
v
=
new
char
[
1
];
c
.
v
[
0
]
=
'c'
;
char
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
'a'
:
'c'
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'c'
));
}
}
{
{
c
.
v
=
new
char
[
20
];
c
.
v
[
10
]
=
'a'
;
char
val1
=
get1
();
c
.
v
=
new
char
[
20
];
c
.
v
[
10
]
=
'a'
;
char
val1
=
get1
();
c
.
v
[
10
]
=
'b'
;
char
val2
=
get1
();
c
.
v
[
10
]
=
'b'
;
char
val2
=
get1
();
assertEquals
(
val1
,
'a'
);
assertEquals
(
val1
,
'a'
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
'a'
:
'b'
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
'a'
:
'b'
));
c
.
v
=
new
char
[
20
];
c
.
v
[
10
]
=
'c'
;
char
val3
=
get1
();
c
.
v
=
new
char
[
20
];
c
.
v
[
10
]
=
'c'
;
char
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
'a'
:
'c'
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'c'
));
}
}
{
{
...
@@ -226,19 +259,21 @@ public class TestStableChar {
...
@@ -226,19 +259,21 @@ public class TestStableChar {
c
.
v
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
[
0
][
0
]
=
'b'
;
char
val2
=
get
();
c
.
v
[
0
][
0
]
=
'b'
;
char
val2
=
get
();
assertEquals
(
val1
,
'a'
);
assertEquals
(
val1
,
'a'
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
'a'
:
'b'
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
'a'
:
'b'
));
c
.
v
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
]
=
'c'
;
char
val3
=
get
();
c
.
v
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
]
=
'c'
;
char
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
'a'
:
'c'
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'c'
));
c
.
v
[
0
]
=
new
char
[
1
];
c
.
v
[
0
][
0
]
=
'd'
;
char
val4
=
get
();
c
.
v
[
0
]
=
new
char
[
1
];
c
.
v
[
0
][
0
]
=
'd'
;
char
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
'a'
:
'd'
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'd'
));
}
}
{
{
c
.
v
=
new
char
[
1
][
1
];
char
[]
val1
=
get1
();
c
.
v
=
new
char
[
1
][
1
];
char
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
char
[
1
];
char
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
char
[
1
];
char
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -264,28 +299,31 @@ public class TestStableChar {
...
@@ -264,28 +299,31 @@ public class TestStableChar {
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
'b'
;
char
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
'b'
;
char
val2
=
get
();
assertEquals
(
val1
,
'a'
);
assertEquals
(
val1
,
'a'
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
'a'
:
'b'
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
'a'
:
'b'
));
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
'c'
;
char
val3
=
get
();
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
'c'
;
char
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
'a'
:
'c'
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'c'
));
c
.
v
[
0
]
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
'd'
;
char
val4
=
get
();
c
.
v
[
0
]
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
'd'
;
char
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
'a'
:
'd'
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'd'
));
c
.
v
[
0
][
0
]
=
new
char
[
1
];
c
.
v
[
0
][
0
][
0
]
=
'e'
;
char
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
char
[
1
];
c
.
v
[
0
][
0
][
0
]
=
'e'
;
char
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
'a'
:
'e'
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'e'
));
}
}
{
{
c
.
v
=
new
char
[
1
][
1
][
1
];
char
[]
val1
=
get1
();
c
.
v
=
new
char
[
1
][
1
][
1
];
char
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
char
[
1
];
char
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
char
[
1
];
char
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
char
[
1
][
1
][
1
];
char
[][]
val1
=
get2
();
c
.
v
=
new
char
[
1
][
1
][
1
];
char
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
char
[
1
][
1
];
char
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
char
[
1
][
1
];
char
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -312,37 +350,41 @@ public class TestStableChar {
...
@@ -312,37 +350,41 @@ public class TestStableChar {
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'a'
;
char
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
'b'
;
char
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
'b'
;
char
val2
=
get
();
assertEquals
(
val1
,
'a'
);
assertEquals
(
val1
,
'a'
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
'a'
:
'b'
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
'a'
:
'b'
));
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'c'
;
char
val3
=
get
();
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'c'
;
char
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
'a'
:
'c'
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'c'
));
c
.
v
[
0
]
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'd'
;
char
val4
=
get
();
c
.
v
[
0
]
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'd'
;
char
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
'a'
:
'd'
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'd'
));
c
.
v
[
0
][
0
]
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'e'
;
char
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
char
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'e'
;
char
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
'a'
:
'e'
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'e'
));
c
.
v
[
0
][
0
][
0
]
=
new
char
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'f'
;
char
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
char
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
'f'
;
char
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
'a'
:
'f'
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
'a'
:
'b'
)
:
'f'
));
}
}
{
{
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[]
val1
=
get1
();
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
char
[
1
];
char
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
char
[
1
];
char
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[][]
val1
=
get2
();
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
char
[
1
][
1
];
char
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
char
[
1
][
1
];
char
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[][][]
val1
=
get3
();
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
char
[
1
][
1
][
1
];
char
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
char
[
1
][
1
][
1
];
char
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -350,7 +392,6 @@ public class TestStableChar {
...
@@ -350,7 +392,6 @@ public class TestStableChar {
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[][][][]
val2
=
get4
();
c
.
v
=
new
char
[
1
][
1
][
1
][
1
];
char
[][][][]
val2
=
get4
();
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
}
}
}
}
...
@@ -403,7 +444,7 @@ public class TestStableChar {
...
@@ -403,7 +444,7 @@ public class TestStableChar {
c
.
v
=
new
char
[
1
][
1
];
c
.
v
[
0
]
=
new
char
[
0
];
char
[]
val1
=
get1
();
c
.
v
=
new
char
[
1
][
1
];
c
.
v
[
0
]
=
new
char
[
0
];
char
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
char
[
0
];
char
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
char
[
0
];
char
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -439,14 +480,14 @@ public class TestStableChar {
...
@@ -439,14 +480,14 @@ public class TestStableChar {
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
char
[
0
];
char
[]
val1
=
get1
();
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
char
[
0
];
char
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
char
[
0
];
char
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
char
[
0
];
char
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
char
[
0
][
0
];
char
[][]
val1
=
get2
();
c
.
v
=
new
char
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
char
[
0
][
0
];
char
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
char
[
0
][
0
];
char
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
char
[
0
][
0
];
char
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -581,7 +622,7 @@ public class TestStableChar {
...
@@ -581,7 +622,7 @@ public class TestStableChar {
elem
.
a
=
'b'
;
char
val3
=
get
();
char
val4
=
get1
();
elem
.
a
=
'b'
;
char
val3
=
get
();
char
val4
=
get1
();
assertEquals
(
val1
,
'a'
);
assertEquals
(
val1
,
'a'
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
'a'
:
'b'
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
'a'
:
'b'
));
assertEquals
(
val2
,
'a'
);
assertEquals
(
val2
,
'a'
);
assertEquals
(
val4
,
'b'
);
assertEquals
(
val4
,
'b'
);
...
@@ -615,17 +656,4 @@ public class TestStableChar {
...
@@ -615,17 +656,4 @@ public class TestStableChar {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableDouble.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableDouble
* @test TestStableDouble
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableDouble.java
* @build TestStableDouble StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableDouble
* java/lang/invoke/TestStableDouble
* java/lang/invoke/TestStableDouble$DoubleStable
* java/lang/invoke/TestStableDouble$DoubleStable
* java/lang/invoke/TestStableDouble$StaticDoubleStable
* java/lang/invoke/TestStableDouble$StaticDoubleStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableDouble$NestedStableField3
* java/lang/invoke/TestStableDouble$NestedStableField3
* java/lang/invoke/TestStableDouble$NestedStableField3$A
* java/lang/invoke/TestStableDouble$NestedStableField3$A
* java/lang/invoke/TestStableDouble$DefaultValue
* java/lang/invoke/TestStableDouble$DefaultValue
* java/lang/invoke/TestStableDouble$DefaultStaticValue
* java/lang/invoke/TestStableDouble$ObjectArrayLowerDim2
* java/lang/invoke/TestStableDouble$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* java.lang.invoke.TestStableDouble
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* java.lang.invoke.TestStableDouble
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* java.lang.invoke.TestStableDouble
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* java.lang.invoke.TestStableDouble
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableDouble
{
public
class
TestStableDouble
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
DoubleStable
.
class
);
run
(
DoubleStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticDoubleStable
.
class
);
run
(
StaticDoubleStable
.
class
);
run
(
VolatileDoubleStable
.
class
);
run
(
VolatileDoubleStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableDouble {
...
@@ -145,6 +161,21 @@ public class TestStableDouble {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
double
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
double
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
double
val1
=
get
();
c
.
v
=
1.0
;
double
val2
=
get
();
assertEquals
(
val1
,
0
);
assertEquals
(
val2
,
1.0
);
}
}
/* ==================================================== */
static
class
StaticDoubleStable
{
static
class
StaticDoubleStable
{
public
static
@Stable
double
v
;
public
static
@Stable
double
v
;
...
@@ -188,20 +219,22 @@ public class TestStableDouble {
...
@@ -188,20 +219,22 @@ public class TestStableDouble {
c
.
v
=
new
double
[
1
];
c
.
v
[
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
=
new
double
[
1
];
c
.
v
[
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
[
0
]
=
2.0
;
double
val2
=
get
();
c
.
v
[
0
]
=
2.0
;
double
val2
=
get
();
assertEquals
(
val1
,
1.0
);
assertEquals
(
val1
,
1.0
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
:
2.0
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
:
2.0
));
c
.
v
=
new
double
[
1
];
c
.
v
[
0
]
=
3.0
;
double
val3
=
get
();
c
.
v
=
new
double
[
1
];
c
.
v
[
0
]
=
3.0
;
double
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
:
3.0
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
3.0
));
}
}
{
{
c
.
v
=
new
double
[
20
];
c
.
v
[
10
]
=
1.0
;
double
val1
=
get1
();
c
.
v
=
new
double
[
20
];
c
.
v
[
10
]
=
1.0
;
double
val1
=
get1
();
c
.
v
[
10
]
=
2.0
;
double
val2
=
get1
();
c
.
v
[
10
]
=
2.0
;
double
val2
=
get1
();
assertEquals
(
val1
,
1.0
);
assertEquals
(
val1
,
1.0
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
:
2.0
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
:
2.0
));
c
.
v
=
new
double
[
20
];
c
.
v
[
10
]
=
3.0
;
double
val3
=
get1
();
c
.
v
=
new
double
[
20
];
c
.
v
[
10
]
=
3.0
;
double
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
:
3.0
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
3.0
));
}
}
{
{
...
@@ -226,19 +259,21 @@ public class TestStableDouble {
...
@@ -226,19 +259,21 @@ public class TestStableDouble {
c
.
v
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
[
0
][
0
]
=
2.0
;
double
val2
=
get
();
c
.
v
[
0
][
0
]
=
2.0
;
double
val2
=
get
();
assertEquals
(
val1
,
1.0
);
assertEquals
(
val1
,
1.0
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
:
2.0
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
:
2.0
));
c
.
v
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3.0
;
double
val3
=
get
();
c
.
v
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3.0
;
double
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
:
3.0
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
3.0
));
c
.
v
[
0
]
=
new
double
[
1
];
c
.
v
[
0
][
0
]
=
4.0
;
double
val4
=
get
();
c
.
v
[
0
]
=
new
double
[
1
];
c
.
v
[
0
][
0
]
=
4.0
;
double
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1.0
:
4.0
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
4.0
));
}
}
{
{
c
.
v
=
new
double
[
1
][
1
];
double
[]
val1
=
get1
();
c
.
v
=
new
double
[
1
][
1
];
double
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
double
[
1
];
double
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
double
[
1
];
double
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -264,28 +299,31 @@ public class TestStableDouble {
...
@@ -264,28 +299,31 @@ public class TestStableDouble {
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2.0
;
double
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2.0
;
double
val2
=
get
();
assertEquals
(
val1
,
1.0
);
assertEquals
(
val1
,
1.0
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
:
2.0
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
:
2.0
));
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3.0
;
double
val3
=
get
();
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3.0
;
double
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
:
3.0
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
3.0
));
c
.
v
[
0
]
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4.0
;
double
val4
=
get
();
c
.
v
[
0
]
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4.0
;
double
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1.0
:
4.0
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
4.0
));
c
.
v
[
0
][
0
]
=
new
double
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5.0
;
double
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
double
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5.0
;
double
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1.0
:
5.0
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
5.0
));
}
}
{
{
c
.
v
=
new
double
[
1
][
1
][
1
];
double
[]
val1
=
get1
();
c
.
v
=
new
double
[
1
][
1
][
1
];
double
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
double
[
1
];
double
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
double
[
1
];
double
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
double
[
1
][
1
][
1
];
double
[][]
val1
=
get2
();
c
.
v
=
new
double
[
1
][
1
][
1
];
double
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
double
[
1
][
1
];
double
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
double
[
1
][
1
];
double
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -312,37 +350,41 @@ public class TestStableDouble {
...
@@ -312,37 +350,41 @@ public class TestStableDouble {
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1.0
;
double
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2.0
;
double
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2.0
;
double
val2
=
get
();
assertEquals
(
val1
,
1.0
);
assertEquals
(
val1
,
1.0
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
:
2.0
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
:
2.0
));
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3.0
;
double
val3
=
get
();
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3.0
;
double
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
:
3.0
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
3.0
));
c
.
v
[
0
]
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4.0
;
double
val4
=
get
();
c
.
v
[
0
]
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4.0
;
double
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1.0
:
4.0
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
4.0
));
c
.
v
[
0
][
0
]
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5.0
;
double
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
double
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5.0
;
double
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1.0
:
5.0
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
5.0
));
c
.
v
[
0
][
0
][
0
]
=
new
double
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6.0
;
double
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
double
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6.0
;
double
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
1.0
:
6.0
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
:
2.0
)
:
6.0
));
}
}
{
{
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[]
val1
=
get1
();
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
double
[
1
];
double
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
double
[
1
];
double
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[][]
val1
=
get2
();
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
double
[
1
][
1
];
double
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
double
[
1
][
1
];
double
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[][][]
val1
=
get3
();
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
double
[
1
][
1
][
1
];
double
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
double
[
1
][
1
][
1
];
double
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -350,13 +392,11 @@ public class TestStableDouble {
...
@@ -350,13 +392,11 @@ public class TestStableDouble {
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[][][][]
val2
=
get4
();
c
.
v
=
new
double
[
1
][
1
][
1
][
1
];
double
[][][][]
val2
=
get4
();
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
}
}
}
}
/* ==================================================== */
/* ==================================================== */
// Dynamic Dim is higher than static
// Dynamic Dim is higher than static
static
class
ObjectArrayLowerDim0
{
static
class
ObjectArrayLowerDim0
{
public
@Stable
Object
v
;
public
@Stable
Object
v
;
...
@@ -404,7 +444,7 @@ public class TestStableDouble {
...
@@ -404,7 +444,7 @@ public class TestStableDouble {
c
.
v
=
new
double
[
1
][
1
];
c
.
v
[
0
]
=
new
double
[
0
];
double
[]
val1
=
get1
();
c
.
v
=
new
double
[
1
][
1
];
c
.
v
[
0
]
=
new
double
[
0
];
double
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
double
[
0
];
double
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
double
[
0
];
double
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -440,14 +480,14 @@ public class TestStableDouble {
...
@@ -440,14 +480,14 @@ public class TestStableDouble {
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
double
[
0
];
double
[]
val1
=
get1
();
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
double
[
0
];
double
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
double
[
0
];
double
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
double
[
0
];
double
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
double
[
0
][
0
];
double
[][]
val1
=
get2
();
c
.
v
=
new
double
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
double
[
0
][
0
];
double
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
double
[
0
][
0
];
double
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
double
[
0
][
0
];
double
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -582,7 +622,7 @@ public class TestStableDouble {
...
@@ -582,7 +622,7 @@ public class TestStableDouble {
elem
.
a
=
2.0
;
double
val3
=
get
();
double
val4
=
get1
();
elem
.
a
=
2.0
;
double
val3
=
get
();
double
val4
=
get1
();
assertEquals
(
val1
,
1.0
);
assertEquals
(
val1
,
1.0
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
1.0
:
2.0
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
1.0
:
2.0
));
assertEquals
(
val2
,
1.0
);
assertEquals
(
val2
,
1.0
);
assertEquals
(
val4
,
2.0
);
assertEquals
(
val4
,
2.0
);
...
@@ -616,17 +656,4 @@ public class TestStableDouble {
...
@@ -616,17 +656,4 @@ public class TestStableDouble {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableFloat.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableFloat
* @test TestStableFloat
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableFloat.java
* @build TestStableFloat StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableFloat
* java/lang/invoke/TestStableFloat
* java/lang/invoke/TestStableFloat$FloatStable
* java/lang/invoke/TestStableFloat$FloatStable
* java/lang/invoke/TestStableFloat$StaticFloatStable
* java/lang/invoke/TestStableFloat$StaticFloatStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableFloat$NestedStableField3
* java/lang/invoke/TestStableFloat$NestedStableField3
* java/lang/invoke/TestStableFloat$NestedStableField3$A
* java/lang/invoke/TestStableFloat$NestedStableField3$A
* java/lang/invoke/TestStableFloat$DefaultValue
* java/lang/invoke/TestStableFloat$DefaultValue
* java/lang/invoke/TestStableFloat$DefaultStaticValue
* java/lang/invoke/TestStableFloat$ObjectArrayLowerDim2
* java/lang/invoke/TestStableFloat$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* java.lang.invoke.TestStableFloat
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* java.lang.invoke.TestStableFloat
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* java.lang.invoke.TestStableFloat
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* java.lang.invoke.TestStableFloat
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableFloat
{
public
class
TestStableFloat
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
FloatStable
.
class
);
run
(
FloatStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticFloatStable
.
class
);
run
(
StaticFloatStable
.
class
);
run
(
VolatileFloatStable
.
class
);
run
(
VolatileFloatStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableFloat {
...
@@ -145,6 +161,21 @@ public class TestStableFloat {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
float
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
float
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
float
val1
=
get
();
c
.
v
=
1.0
F
;
float
val2
=
get
();
assertEquals
(
val1
,
0
F
);
assertEquals
(
val2
,
1.0
F
);
}
}
/* ==================================================== */
static
class
StaticFloatStable
{
static
class
StaticFloatStable
{
public
static
@Stable
float
v
;
public
static
@Stable
float
v
;
...
@@ -188,20 +219,22 @@ public class TestStableFloat {
...
@@ -188,20 +219,22 @@ public class TestStableFloat {
c
.
v
=
new
float
[
1
];
c
.
v
[
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
=
new
float
[
1
];
c
.
v
[
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
[
0
]
=
2.0
F
;
float
val2
=
get
();
c
.
v
[
0
]
=
2.0
F
;
float
val2
=
get
();
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
F
:
2.0
F
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
F
:
2.0
F
));
c
.
v
=
new
float
[
1
];
c
.
v
[
0
]
=
3.0
F
;
float
val3
=
get
();
c
.
v
=
new
float
[
1
];
c
.
v
[
0
]
=
3.0
F
;
float
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
F
:
3.0
F
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
3.0
F
));
}
}
{
{
c
.
v
=
new
float
[
20
];
c
.
v
[
10
]
=
1.0
F
;
float
val1
=
get1
();
c
.
v
=
new
float
[
20
];
c
.
v
[
10
]
=
1.0
F
;
float
val1
=
get1
();
c
.
v
[
10
]
=
2.0
F
;
float
val2
=
get1
();
c
.
v
[
10
]
=
2.0
F
;
float
val2
=
get1
();
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
F
:
2.0
F
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
F
:
2.0
F
));
c
.
v
=
new
float
[
20
];
c
.
v
[
10
]
=
3.0
F
;
float
val3
=
get1
();
c
.
v
=
new
float
[
20
];
c
.
v
[
10
]
=
3.0
F
;
float
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
F
:
3.0
F
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
3.0
F
));
}
}
{
{
...
@@ -226,19 +259,21 @@ public class TestStableFloat {
...
@@ -226,19 +259,21 @@ public class TestStableFloat {
c
.
v
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
[
0
][
0
]
=
2.0
F
;
float
val2
=
get
();
c
.
v
[
0
][
0
]
=
2.0
F
;
float
val2
=
get
();
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
F
:
2.0
F
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
F
:
2.0
F
));
c
.
v
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3.0
F
;
float
val3
=
get
();
c
.
v
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3.0
F
;
float
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
F
:
3.0
F
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
3.0
F
));
c
.
v
[
0
]
=
new
float
[
1
];
c
.
v
[
0
][
0
]
=
4.0
F
;
float
val4
=
get
();
c
.
v
[
0
]
=
new
float
[
1
];
c
.
v
[
0
][
0
]
=
4.0
F
;
float
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1.0
F
:
4.0
F
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
4.0
F
));
}
}
{
{
c
.
v
=
new
float
[
1
][
1
];
float
[]
val1
=
get1
();
c
.
v
=
new
float
[
1
][
1
];
float
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
float
[
1
];
float
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
float
[
1
];
float
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -264,28 +299,31 @@ public class TestStableFloat {
...
@@ -264,28 +299,31 @@ public class TestStableFloat {
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2.0
F
;
float
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2.0
F
;
float
val2
=
get
();
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
F
:
2.0
F
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
F
:
2.0
F
));
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3.0
F
;
float
val3
=
get
();
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3.0
F
;
float
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
F
:
3.0
F
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
3.0
F
));
c
.
v
[
0
]
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4.0
F
;
float
val4
=
get
();
c
.
v
[
0
]
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4.0
F
;
float
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1.0
F
:
4.0
F
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
4.0
F
));
c
.
v
[
0
][
0
]
=
new
float
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5.0
F
;
float
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
float
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5.0
F
;
float
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1.0
F
:
5.0
F
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
5.0
F
));
}
}
{
{
c
.
v
=
new
float
[
1
][
1
][
1
];
float
[]
val1
=
get1
();
c
.
v
=
new
float
[
1
][
1
][
1
];
float
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
float
[
1
];
float
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
float
[
1
];
float
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
float
[
1
][
1
][
1
];
float
[][]
val1
=
get2
();
c
.
v
=
new
float
[
1
][
1
][
1
];
float
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
float
[
1
][
1
];
float
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
float
[
1
][
1
];
float
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -312,37 +350,41 @@ public class TestStableFloat {
...
@@ -312,37 +350,41 @@ public class TestStableFloat {
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1.0
F
;
float
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2.0
F
;
float
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2.0
F
;
float
val2
=
get
();
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1.0
F
:
2.0
F
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1.0
F
:
2.0
F
));
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3.0
F
;
float
val3
=
get
();
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3.0
F
;
float
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1.0
F
:
3.0
F
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
3.0
F
));
c
.
v
[
0
]
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4.0
F
;
float
val4
=
get
();
c
.
v
[
0
]
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4.0
F
;
float
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1.0
F
:
4.0
F
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
4.0
F
));
c
.
v
[
0
][
0
]
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5.0
F
;
float
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
float
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5.0
F
;
float
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1.0
F
:
5.0
F
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
5.0
F
));
c
.
v
[
0
][
0
][
0
]
=
new
float
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6.0
F
;
float
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
float
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6.0
F
;
float
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
1.0
F
:
6.0
F
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
1.0
F
:
2.0
F
)
:
6.0
F
));
}
}
{
{
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[]
val1
=
get1
();
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
float
[
1
];
float
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
float
[
1
];
float
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[][]
val1
=
get2
();
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
float
[
1
][
1
];
float
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
float
[
1
][
1
];
float
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[][][]
val1
=
get3
();
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
float
[
1
][
1
][
1
];
float
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
float
[
1
][
1
][
1
];
float
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -350,13 +392,11 @@ public class TestStableFloat {
...
@@ -350,13 +392,11 @@ public class TestStableFloat {
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[][][][]
val2
=
get4
();
c
.
v
=
new
float
[
1
][
1
][
1
][
1
];
float
[][][][]
val2
=
get4
();
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
}
}
}
}
/* ==================================================== */
/* ==================================================== */
// Dynamic Dim is higher than static
// Dynamic Dim is higher than static
static
class
ObjectArrayLowerDim0
{
static
class
ObjectArrayLowerDim0
{
public
@Stable
Object
v
;
public
@Stable
Object
v
;
...
@@ -404,7 +444,7 @@ public class TestStableFloat {
...
@@ -404,7 +444,7 @@ public class TestStableFloat {
c
.
v
=
new
float
[
1
][
1
];
c
.
v
[
0
]
=
new
float
[
0
];
float
[]
val1
=
get1
();
c
.
v
=
new
float
[
1
][
1
];
c
.
v
[
0
]
=
new
float
[
0
];
float
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
float
[
0
];
float
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
float
[
0
];
float
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -440,14 +480,14 @@ public class TestStableFloat {
...
@@ -440,14 +480,14 @@ public class TestStableFloat {
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
float
[
0
];
float
[]
val1
=
get1
();
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
float
[
0
];
float
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
float
[
0
];
float
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
float
[
0
];
float
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
float
[
0
][
0
];
float
[][]
val1
=
get2
();
c
.
v
=
new
float
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
float
[
0
][
0
];
float
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
float
[
0
][
0
];
float
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
float
[
0
][
0
];
float
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -582,7 +622,7 @@ public class TestStableFloat {
...
@@ -582,7 +622,7 @@ public class TestStableFloat {
elem
.
a
=
2.0
F
;
float
val3
=
get
();
float
val4
=
get1
();
elem
.
a
=
2.0
F
;
float
val3
=
get
();
float
val4
=
get1
();
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val1
,
1.0
F
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
1.0
F
:
2.0
F
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
1.0
F
:
2.0
F
));
assertEquals
(
val2
,
1.0
F
);
assertEquals
(
val2
,
1.0
F
);
assertEquals
(
val4
,
2.0
F
);
assertEquals
(
val4
,
2.0
F
);
...
@@ -616,17 +656,4 @@ public class TestStableFloat {
...
@@ -616,17 +656,4 @@ public class TestStableFloat {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableInt.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableInt
* @test TestStableInt
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableInt.java
* @build TestStableInt StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableInt
* java/lang/invoke/TestStableInt
* java/lang/invoke/TestStableInt$IntStable
* java/lang/invoke/TestStableInt$IntStable
* java/lang/invoke/TestStableInt$StaticIntStable
* java/lang/invoke/TestStableInt$StaticIntStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableInt$NestedStableField3
* java/lang/invoke/TestStableInt$NestedStableField3
* java/lang/invoke/TestStableInt$NestedStableField3$A
* java/lang/invoke/TestStableInt$NestedStableField3$A
* java/lang/invoke/TestStableInt$DefaultValue
* java/lang/invoke/TestStableInt$DefaultValue
* java/lang/invoke/TestStableInt$DefaultStaticValue
* java/lang/invoke/TestStableInt$ObjectArrayLowerDim2
* java/lang/invoke/TestStableInt$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* java.lang.invoke.TestStableInt
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* java.lang.invoke.TestStableInt
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* java.lang.invoke.TestStableInt
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* java.lang.invoke.TestStableInt
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableInt
{
public
class
TestStableInt
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
IntStable
.
class
);
run
(
IntStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticIntStable
.
class
);
run
(
StaticIntStable
.
class
);
run
(
VolatileIntStable
.
class
);
run
(
VolatileIntStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableInt {
...
@@ -145,6 +161,21 @@ public class TestStableInt {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
int
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
int
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
int
val1
=
get
();
c
.
v
=
1
;
int
val2
=
get
();
assertEquals
(
val1
,
0
);
assertEquals
(
val2
,
1
);
}
}
/* ==================================================== */
static
class
StaticIntStable
{
static
class
StaticIntStable
{
public
static
@Stable
int
v
;
public
static
@Stable
int
v
;
...
@@ -188,20 +219,22 @@ public class TestStableInt {
...
@@ -188,20 +219,22 @@ public class TestStableInt {
c
.
v
=
new
int
[
1
];
c
.
v
[
0
]
=
1
;
int
val1
=
get
();
c
.
v
=
new
int
[
1
];
c
.
v
[
0
]
=
1
;
int
val1
=
get
();
c
.
v
[
0
]
=
2
;
int
val2
=
get
();
c
.
v
[
0
]
=
2
;
int
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
int
[
1
];
c
.
v
[
0
]
=
3
;
int
val3
=
get
();
c
.
v
=
new
int
[
1
];
c
.
v
[
0
]
=
3
;
int
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
c
.
v
=
new
int
[
20
];
c
.
v
[
10
]
=
1
;
int
val1
=
get1
();
c
.
v
=
new
int
[
20
];
c
.
v
[
10
]
=
1
;
int
val1
=
get1
();
c
.
v
[
10
]
=
2
;
int
val2
=
get1
();
c
.
v
[
10
]
=
2
;
int
val2
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
int
[
20
];
c
.
v
[
10
]
=
3
;
int
val3
=
get1
();
c
.
v
=
new
int
[
20
];
c
.
v
[
10
]
=
3
;
int
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
...
@@ -226,19 +259,21 @@ public class TestStableInt {
...
@@ -226,19 +259,21 @@ public class TestStableInt {
c
.
v
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
int
val1
=
get
();
c
.
v
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
int
val1
=
get
();
c
.
v
[
0
][
0
]
=
2
;
int
val2
=
get
();
c
.
v
[
0
][
0
]
=
2
;
int
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
int
val3
=
get
();
c
.
v
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
int
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
int
[
1
];
c
.
v
[
0
][
0
]
=
4
;
int
val4
=
get
();
c
.
v
[
0
]
=
new
int
[
1
];
c
.
v
[
0
][
0
]
=
4
;
int
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
}
}
{
{
c
.
v
=
new
int
[
1
][
1
];
int
[]
val1
=
get1
();
c
.
v
=
new
int
[
1
][
1
];
int
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
int
[
1
];
int
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
int
[
1
];
int
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -264,28 +299,31 @@ public class TestStableInt {
...
@@ -264,28 +299,31 @@ public class TestStableInt {
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
int
val1
=
get
();
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
int
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
int
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
int
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
int
val3
=
get
();
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
int
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
int
val4
=
get
();
c
.
v
[
0
]
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
int
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
int
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
int
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
int
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
int
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
}
}
{
{
c
.
v
=
new
int
[
1
][
1
][
1
];
int
[]
val1
=
get1
();
c
.
v
=
new
int
[
1
][
1
][
1
];
int
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
int
[
1
];
int
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
int
[
1
];
int
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
int
[
1
][
1
][
1
];
int
[][]
val1
=
get2
();
c
.
v
=
new
int
[
1
][
1
][
1
];
int
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
int
[
1
][
1
];
int
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
int
[
1
][
1
];
int
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -312,37 +350,41 @@ public class TestStableInt {
...
@@ -312,37 +350,41 @@ public class TestStableInt {
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
int
val1
=
get
();
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
int
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
int
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
int
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
int
val3
=
get
();
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
int
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
int
val4
=
get
();
c
.
v
[
0
]
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
int
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
int
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
int
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
int
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
c
.
v
[
0
][
0
][
0
]
=
new
int
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
int
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
int
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
int
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
1
:
6
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
6
));
}
}
{
{
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[]
val1
=
get1
();
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
int
[
1
];
int
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
int
[
1
];
int
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[][]
val1
=
get2
();
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
int
[
1
][
1
];
int
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
int
[
1
][
1
];
int
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[][][]
val1
=
get3
();
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
int
[
1
][
1
][
1
];
int
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
int
[
1
][
1
][
1
];
int
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -350,13 +392,11 @@ public class TestStableInt {
...
@@ -350,13 +392,11 @@ public class TestStableInt {
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[][][][]
val2
=
get4
();
c
.
v
=
new
int
[
1
][
1
][
1
][
1
];
int
[][][][]
val2
=
get4
();
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
}
}
}
}
/* ==================================================== */
/* ==================================================== */
// Dynamic Dim is higher than static
// Dynamic Dim is higher than static
static
class
ObjectArrayLowerDim0
{
static
class
ObjectArrayLowerDim0
{
public
@Stable
Object
v
;
public
@Stable
Object
v
;
...
@@ -404,7 +444,7 @@ public class TestStableInt {
...
@@ -404,7 +444,7 @@ public class TestStableInt {
c
.
v
=
new
int
[
1
][
1
];
c
.
v
[
0
]
=
new
int
[
0
];
int
[]
val1
=
get1
();
c
.
v
=
new
int
[
1
][
1
];
c
.
v
[
0
]
=
new
int
[
0
];
int
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
int
[
0
];
int
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
int
[
0
];
int
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -440,14 +480,14 @@ public class TestStableInt {
...
@@ -440,14 +480,14 @@ public class TestStableInt {
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
int
[
0
];
int
[]
val1
=
get1
();
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
int
[
0
];
int
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
int
[
0
];
int
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
int
[
0
];
int
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
int
[
0
][
0
];
int
[][]
val1
=
get2
();
c
.
v
=
new
int
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
int
[
0
][
0
];
int
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
int
[
0
][
0
];
int
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
int
[
0
][
0
];
int
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -582,7 +622,7 @@ public class TestStableInt {
...
@@ -582,7 +622,7 @@ public class TestStableInt {
elem
.
a
=
2
;
int
val3
=
get
();
int
val4
=
get1
();
elem
.
a
=
2
;
int
val3
=
get
();
int
val4
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
1
:
2
));
assertEquals
(
val2
,
1
);
assertEquals
(
val2
,
1
);
assertEquals
(
val4
,
2
);
assertEquals
(
val4
,
2
);
...
@@ -616,17 +656,4 @@ public class TestStableInt {
...
@@ -616,17 +656,4 @@ public class TestStableInt {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableLong.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableLong
* @test TestStableLong
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableLong.java
* @build TestStableLong StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableLong
* java/lang/invoke/TestStableLong
* java/lang/invoke/TestStableLong$LongStable
* java/lang/invoke/TestStableLong$LongStable
* java/lang/invoke/TestStableLong$StaticLongStable
* java/lang/invoke/TestStableLong$StaticLongStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableLong$NestedStableField3
* java/lang/invoke/TestStableLong$NestedStableField3
* java/lang/invoke/TestStableLong$NestedStableField3$A
* java/lang/invoke/TestStableLong$NestedStableField3$A
* java/lang/invoke/TestStableLong$DefaultValue
* java/lang/invoke/TestStableLong$DefaultValue
* java/lang/invoke/TestStableLong$DefaultStaticValue
* java/lang/invoke/TestStableLong$ObjectArrayLowerDim2
* java/lang/invoke/TestStableLong$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* java.lang.invoke.TestStableLong
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* java.lang.invoke.TestStableLong
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* java.lang.invoke.TestStableLong
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* java.lang.invoke.TestStableLong
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableLong
{
public
class
TestStableLong
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
LongStable
.
class
);
run
(
LongStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticLongStable
.
class
);
run
(
StaticLongStable
.
class
);
run
(
VolatileLongStable
.
class
);
run
(
VolatileLongStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableLong {
...
@@ -145,6 +161,21 @@ public class TestStableLong {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
long
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
long
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
long
val1
=
get
();
c
.
v
=
1L
;
long
val2
=
get
();
assertEquals
(
val1
,
0
);
assertEquals
(
val2
,
1L
);
}
}
/* ==================================================== */
static
class
StaticLongStable
{
static
class
StaticLongStable
{
public
static
@Stable
long
v
;
public
static
@Stable
long
v
;
...
@@ -188,20 +219,22 @@ public class TestStableLong {
...
@@ -188,20 +219,22 @@ public class TestStableLong {
c
.
v
=
new
long
[
1
];
c
.
v
[
0
]
=
1
;
long
val1
=
get
();
c
.
v
=
new
long
[
1
];
c
.
v
[
0
]
=
1
;
long
val1
=
get
();
c
.
v
[
0
]
=
2
;
long
val2
=
get
();
c
.
v
[
0
]
=
2
;
long
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
long
[
1
];
c
.
v
[
0
]
=
3
;
long
val3
=
get
();
c
.
v
=
new
long
[
1
];
c
.
v
[
0
]
=
3
;
long
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
c
.
v
=
new
long
[
20
];
c
.
v
[
10
]
=
1
;
long
val1
=
get1
();
c
.
v
=
new
long
[
20
];
c
.
v
[
10
]
=
1
;
long
val1
=
get1
();
c
.
v
[
10
]
=
2
;
long
val2
=
get1
();
c
.
v
[
10
]
=
2
;
long
val2
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
long
[
20
];
c
.
v
[
10
]
=
3
;
long
val3
=
get1
();
c
.
v
=
new
long
[
20
];
c
.
v
[
10
]
=
3
;
long
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
...
@@ -226,19 +259,21 @@ public class TestStableLong {
...
@@ -226,19 +259,21 @@ public class TestStableLong {
c
.
v
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
long
val1
=
get
();
c
.
v
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
long
val1
=
get
();
c
.
v
[
0
][
0
]
=
2
;
long
val2
=
get
();
c
.
v
[
0
][
0
]
=
2
;
long
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
long
val3
=
get
();
c
.
v
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
long
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
long
[
1
];
c
.
v
[
0
][
0
]
=
4
;
long
val4
=
get
();
c
.
v
[
0
]
=
new
long
[
1
];
c
.
v
[
0
][
0
]
=
4
;
long
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
}
}
{
{
c
.
v
=
new
long
[
1
][
1
];
long
[]
val1
=
get1
();
c
.
v
=
new
long
[
1
][
1
];
long
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
long
[
1
];
long
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
long
[
1
];
long
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -264,28 +299,31 @@ public class TestStableLong {
...
@@ -264,28 +299,31 @@ public class TestStableLong {
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
long
val1
=
get
();
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
long
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
long
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
long
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
long
val3
=
get
();
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
long
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
long
val4
=
get
();
c
.
v
[
0
]
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
long
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
long
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
long
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
long
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
long
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
}
}
{
{
c
.
v
=
new
long
[
1
][
1
][
1
];
long
[]
val1
=
get1
();
c
.
v
=
new
long
[
1
][
1
][
1
];
long
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
long
[
1
];
long
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
long
[
1
];
long
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
long
[
1
][
1
][
1
];
long
[][]
val1
=
get2
();
c
.
v
=
new
long
[
1
][
1
][
1
];
long
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
long
[
1
][
1
];
long
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
long
[
1
][
1
];
long
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -312,37 +350,41 @@ public class TestStableLong {
...
@@ -312,37 +350,41 @@ public class TestStableLong {
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
long
val1
=
get
();
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
long
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
long
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
long
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
long
val3
=
get
();
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
long
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
long
val4
=
get
();
c
.
v
[
0
]
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
long
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
long
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
long
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
long
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
c
.
v
[
0
][
0
][
0
]
=
new
long
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
long
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
long
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
long
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
1
:
6
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
6
));
}
}
{
{
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[]
val1
=
get1
();
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
long
[
1
];
long
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
long
[
1
];
long
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[][]
val1
=
get2
();
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
long
[
1
][
1
];
long
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
long
[
1
][
1
];
long
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[][][]
val1
=
get3
();
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
long
[
1
][
1
][
1
];
long
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
long
[
1
][
1
][
1
];
long
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -350,13 +392,11 @@ public class TestStableLong {
...
@@ -350,13 +392,11 @@ public class TestStableLong {
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[][][][]
val2
=
get4
();
c
.
v
=
new
long
[
1
][
1
][
1
][
1
];
long
[][][][]
val2
=
get4
();
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
}
}
}
}
/* ==================================================== */
/* ==================================================== */
// Dynamic Dim is higher than static
// Dynamic Dim is higher than static
static
class
ObjectArrayLowerDim0
{
static
class
ObjectArrayLowerDim0
{
public
@Stable
Object
v
;
public
@Stable
Object
v
;
...
@@ -404,7 +444,7 @@ public class TestStableLong {
...
@@ -404,7 +444,7 @@ public class TestStableLong {
c
.
v
=
new
long
[
1
][
1
];
c
.
v
[
0
]
=
new
long
[
0
];
long
[]
val1
=
get1
();
c
.
v
=
new
long
[
1
][
1
];
c
.
v
[
0
]
=
new
long
[
0
];
long
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
long
[
0
];
long
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
long
[
0
];
long
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -440,14 +480,14 @@ public class TestStableLong {
...
@@ -440,14 +480,14 @@ public class TestStableLong {
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
long
[
0
];
long
[]
val1
=
get1
();
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
long
[
0
];
long
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
long
[
0
];
long
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
long
[
0
];
long
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
long
[
0
][
0
];
long
[][]
val1
=
get2
();
c
.
v
=
new
long
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
long
[
0
][
0
];
long
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
long
[
0
][
0
];
long
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
long
[
0
][
0
];
long
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -582,7 +622,7 @@ public class TestStableLong {
...
@@ -582,7 +622,7 @@ public class TestStableLong {
elem
.
a
=
2
;
long
val3
=
get
();
long
val4
=
get1
();
elem
.
a
=
2
;
long
val3
=
get
();
long
val4
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
1
:
2
));
assertEquals
(
val2
,
1
);
assertEquals
(
val2
,
1
);
assertEquals
(
val4
,
2
);
assertEquals
(
val4
,
2
);
...
@@ -616,17 +656,4 @@ public class TestStableLong {
...
@@ -616,17 +656,4 @@ public class TestStableLong {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableObject.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableObject
* @test TestStableObject
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableObject.java
* @build TestStableObject StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableObject
* java/lang/invoke/TestStableObject
* java/lang/invoke/TestStableObject$ObjectStable
* java/lang/invoke/TestStableObject$ObjectStable
* java/lang/invoke/TestStableObject$StaticObjectStable
* java/lang/invoke/TestStableObject$StaticObjectStable
...
@@ -49,46 +51,60 @@
...
@@ -49,46 +51,60 @@
* java/lang/invoke/TestStableObject$NestedStableField3$A
* java/lang/invoke/TestStableObject$NestedStableField3$A
* java/lang/invoke/TestStableObject$Values
* java/lang/invoke/TestStableObject$Values
* java/lang/invoke/TestStableObject$DefaultValue
* java/lang/invoke/TestStableObject$DefaultValue
* java/lang/invoke/TestStableObject$DefaultStaticValue
* java/lang/invoke/TestStableObject$ObjectArrayLowerDim2
* java/lang/invoke/TestStableObject$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* java.lang.invoke.TestStableObject
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* java.lang.invoke.TestStableObject
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* java.lang.invoke.TestStableObject
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* java.lang.invoke.TestStableObject
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableObject
{
public
class
TestStableObject
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
ObjectStable
.
class
);
run
(
ObjectStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticObjectStable
.
class
);
run
(
StaticObjectStable
.
class
);
run
(
VolatileObjectStable
.
class
);
run
(
VolatileObjectStable
.
class
);
...
@@ -148,6 +164,21 @@ public class TestStableObject {
...
@@ -148,6 +164,21 @@ public class TestStableObject {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
Object
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
Object
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
Object
val1
=
get
();
c
.
v
=
Values
.
A
;
Object
val2
=
get
();
assertEquals
(
val1
,
null
);
assertEquals
(
val2
,
Values
.
A
);
}
}
/* ==================================================== */
static
class
StaticObjectStable
{
static
class
StaticObjectStable
{
public
static
@Stable
Values
v
;
public
static
@Stable
Values
v
;
...
@@ -191,20 +222,22 @@ public class TestStableObject {
...
@@ -191,20 +222,22 @@ public class TestStableObject {
c
.
v
=
new
Object
[
1
];
c
.
v
[
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
=
new
Object
[
1
];
c
.
v
[
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
[
0
]
=
Values
.
B
;
Object
val2
=
get
();
c
.
v
[
0
]
=
Values
.
B
;
Object
val2
=
get
();
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
Values
.
A
:
Values
.
B
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
Values
.
A
:
Values
.
B
));
c
.
v
=
new
Object
[
1
];
c
.
v
[
0
]
=
Values
.
C
;
Object
val3
=
get
();
c
.
v
=
new
Object
[
1
];
c
.
v
[
0
]
=
Values
.
C
;
Object
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
Values
.
A
:
Values
.
C
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
C
));
}
}
{
{
c
.
v
=
new
Object
[
20
];
c
.
v
[
10
]
=
Values
.
A
;
Object
val1
=
get1
();
c
.
v
=
new
Object
[
20
];
c
.
v
[
10
]
=
Values
.
A
;
Object
val1
=
get1
();
c
.
v
[
10
]
=
Values
.
B
;
Object
val2
=
get1
();
c
.
v
[
10
]
=
Values
.
B
;
Object
val2
=
get1
();
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
Values
.
A
:
Values
.
B
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
Values
.
A
:
Values
.
B
));
c
.
v
=
new
Object
[
20
];
c
.
v
[
10
]
=
Values
.
C
;
Object
val3
=
get1
();
c
.
v
=
new
Object
[
20
];
c
.
v
[
10
]
=
Values
.
C
;
Object
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
Values
.
A
:
Values
.
C
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
C
));
}
}
{
{
...
@@ -229,19 +262,21 @@ public class TestStableObject {
...
@@ -229,19 +262,21 @@ public class TestStableObject {
c
.
v
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
[
0
][
0
]
=
Values
.
B
;
Object
val2
=
get
();
c
.
v
[
0
][
0
]
=
Values
.
B
;
Object
val2
=
get
();
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
Values
.
A
:
Values
.
B
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
Values
.
A
:
Values
.
B
));
c
.
v
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
]
=
Values
.
C
;
Object
val3
=
get
();
c
.
v
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
]
=
Values
.
C
;
Object
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
Values
.
A
:
Values
.
C
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
C
));
c
.
v
[
0
]
=
new
Object
[
1
];
c
.
v
[
0
][
0
]
=
Values
.
D
;
Object
val4
=
get
();
c
.
v
[
0
]
=
new
Object
[
1
];
c
.
v
[
0
][
0
]
=
Values
.
D
;
Object
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
Values
.
A
:
Values
.
D
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
D
));
}
}
{
{
c
.
v
=
new
Object
[
1
][
1
];
Object
[]
val1
=
get1
();
c
.
v
=
new
Object
[
1
][
1
];
Object
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
Object
[
1
];
Object
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
Object
[
1
];
Object
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -267,28 +302,31 @@ public class TestStableObject {
...
@@ -267,28 +302,31 @@ public class TestStableObject {
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
Values
.
B
;
Object
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
Values
.
B
;
Object
val2
=
get
();
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
Values
.
A
:
Values
.
B
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
Values
.
A
:
Values
.
B
));
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
C
;
Object
val3
=
get
();
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
C
;
Object
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
Values
.
A
:
Values
.
C
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
C
));
c
.
v
[
0
]
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
D
;
Object
val4
=
get
();
c
.
v
[
0
]
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
D
;
Object
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
Values
.
A
:
Values
.
D
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
D
));
c
.
v
[
0
][
0
]
=
new
Object
[
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
E
;
Object
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
Object
[
1
];
c
.
v
[
0
][
0
][
0
]
=
Values
.
E
;
Object
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
Values
.
A
:
Values
.
E
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
E
));
}
}
{
{
c
.
v
=
new
Object
[
1
][
1
][
1
];
Object
[]
val1
=
get1
();
c
.
v
=
new
Object
[
1
][
1
][
1
];
Object
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
Object
[
1
];
Object
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
Object
[
1
];
Object
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
Object
[
1
][
1
][
1
];
Object
[][]
val1
=
get2
();
c
.
v
=
new
Object
[
1
][
1
][
1
];
Object
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
Object
[
1
][
1
];
Object
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
Object
[
1
][
1
];
Object
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -315,37 +353,41 @@ public class TestStableObject {
...
@@ -315,37 +353,41 @@ public class TestStableObject {
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
A
;
Object
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
B
;
Object
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
B
;
Object
val2
=
get
();
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
Values
.
A
:
Values
.
B
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
Values
.
A
:
Values
.
B
));
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
C
;
Object
val3
=
get
();
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
C
;
Object
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
Values
.
A
:
Values
.
C
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
C
));
c
.
v
[
0
]
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
D
;
Object
val4
=
get
();
c
.
v
[
0
]
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
D
;
Object
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
Values
.
A
:
Values
.
D
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
D
));
c
.
v
[
0
][
0
]
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
E
;
Object
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
Object
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
E
;
Object
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
Values
.
A
:
Values
.
E
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
E
));
c
.
v
[
0
][
0
][
0
]
=
new
Object
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
F
;
Object
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
Object
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
Values
.
F
;
Object
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
Values
.
A
:
Values
.
F
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
Values
.
A
:
Values
.
B
)
:
Values
.
F
));
}
}
{
{
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[]
val1
=
get1
();
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
Object
[
1
];
Object
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
Object
[
1
];
Object
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[][]
val1
=
get2
();
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
Object
[
1
][
1
];
Object
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
Object
[
1
][
1
];
Object
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[][][]
val1
=
get3
();
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
Object
[
1
][
1
][
1
];
Object
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
Object
[
1
][
1
][
1
];
Object
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -353,13 +395,11 @@ public class TestStableObject {
...
@@ -353,13 +395,11 @@ public class TestStableObject {
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[][][][]
val2
=
get4
();
c
.
v
=
new
Object
[
1
][
1
][
1
][
1
];
Object
[][][][]
val2
=
get4
();
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
}
}
}
}
/* ==================================================== */
/* ==================================================== */
// Dynamic Dim is higher than static
// Dynamic Dim is higher than static
static
class
ObjectArrayLowerDim0
{
static
class
ObjectArrayLowerDim0
{
public
@Stable
Object
v
;
public
@Stable
Object
v
;
...
@@ -407,7 +447,7 @@ public class TestStableObject {
...
@@ -407,7 +447,7 @@ public class TestStableObject {
c
.
v
=
new
Object
[
1
][
1
];
c
.
v
[
0
]
=
new
Object
[
0
];
Object
[]
val1
=
get1
();
c
.
v
=
new
Object
[
1
][
1
];
c
.
v
[
0
]
=
new
Object
[
0
];
Object
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
Object
[
0
];
Object
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
Object
[
0
];
Object
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -443,14 +483,14 @@ public class TestStableObject {
...
@@ -443,14 +483,14 @@ public class TestStableObject {
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
Object
[
0
];
Object
[]
val1
=
get1
();
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
Object
[
0
];
Object
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
Object
[
0
];
Object
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
Object
[
0
];
Object
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
Object
[
0
][
0
];
Object
[][]
val1
=
get2
();
c
.
v
=
new
Object
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
Object
[
0
][
0
];
Object
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
Object
[
0
][
0
];
Object
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
Object
[
0
][
0
];
Object
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -585,7 +625,7 @@ public class TestStableObject {
...
@@ -585,7 +625,7 @@ public class TestStableObject {
elem
.
a
=
Values
.
B
;
Object
val3
=
get
();
Object
val4
=
get1
();
elem
.
a
=
Values
.
B
;
Object
val3
=
get
();
Object
val4
=
get1
();
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val1
,
Values
.
A
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
Values
.
A
:
Values
.
B
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
Values
.
A
:
Values
.
B
));
assertEquals
(
val2
,
Values
.
A
);
assertEquals
(
val2
,
Values
.
A
);
assertEquals
(
val4
,
Values
.
B
);
assertEquals
(
val4
,
Values
.
B
);
...
@@ -619,17 +659,4 @@ public class TestStableObject {
...
@@ -619,17 +659,4 @@ public class TestStableObject {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
test/compiler/stable/TestStableShort.java
浏览文件 @
55695a9d
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
/*
/*
* @test TestStableShort
* @test TestStableShort
* @summary tests on stable fields and arrays
* @summary tests on stable fields and arrays
* @library /testlibrary
* @library /testlibrary /testlibrary/whitebox
* @compile -XDignore.symbol.file TestStableShort.java
* @build TestStableShort StableConfiguration sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller
* @run main ClassFileInstaller
* java/lang/invoke/StableConfiguration
* java/lang/invoke/TestStableShort
* java/lang/invoke/TestStableShort
* java/lang/invoke/TestStableShort$ShortStable
* java/lang/invoke/TestStableShort$ShortStable
* java/lang/invoke/TestStableShort$StaticShortStable
* java/lang/invoke/TestStableShort$StaticShortStable
...
@@ -48,46 +50,60 @@
...
@@ -48,46 +50,60 @@
* java/lang/invoke/TestStableShort$NestedStableField3
* java/lang/invoke/TestStableShort$NestedStableField3
* java/lang/invoke/TestStableShort$NestedStableField3$A
* java/lang/invoke/TestStableShort$NestedStableField3$A
* java/lang/invoke/TestStableShort$DefaultValue
* java/lang/invoke/TestStableShort$DefaultValue
* java/lang/invoke/TestStableShort$DefaultStaticValue
* java/lang/invoke/TestStableShort$ObjectArrayLowerDim2
* java/lang/invoke/TestStableShort$ObjectArrayLowerDim2
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* java.lang.invoke.TestStableShort
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* java.lang.invoke.TestStableShort
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* java.lang.invoke.TestStableShort
*
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* java.lang.invoke.TestStableShort
*/
*/
package
java.lang.invoke
;
package
java.lang.invoke
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
sun.management.ManagementFactoryHelper
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TestStableShort
{
public
class
TestStableShort
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
static
final
boolean
isStableEnabled
=
StableConfiguration
.
isStableEnabled
;
System
.
out
.
println
(
"@Stable enabled: "
+
isStableEnabled
);
static
final
boolean
isServerWithStable
=
StableConfiguration
.
isServerWithStable
;
System
.
out
.
println
();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
run
(
DefaultValue
.
class
);
run
(
DefaultValue
.
class
);
run
(
ShortStable
.
class
);
run
(
ShortStable
.
class
);
run
(
DefaultStaticValue
.
class
);
run
(
StaticShortStable
.
class
);
run
(
StaticShortStable
.
class
);
run
(
VolatileShortStable
.
class
);
run
(
VolatileShortStable
.
class
);
...
@@ -145,6 +161,21 @@ public class TestStableShort {
...
@@ -145,6 +161,21 @@ public class TestStableShort {
/* ==================================================== */
/* ==================================================== */
static
class
DefaultStaticValue
{
public
static
@Stable
short
v
;
public
static
final
DefaultStaticValue
c
=
new
DefaultStaticValue
();
public
static
short
get
()
{
return
c
.
v
;
}
public
static
void
test
()
throws
Exception
{
short
val1
=
get
();
c
.
v
=
1
;
short
val2
=
get
();
assertEquals
(
val1
,
0
);
assertEquals
(
val2
,
1
);
}
}
/* ==================================================== */
static
class
StaticShortStable
{
static
class
StaticShortStable
{
public
static
@Stable
short
v
;
public
static
@Stable
short
v
;
...
@@ -188,20 +219,22 @@ public class TestStableShort {
...
@@ -188,20 +219,22 @@ public class TestStableShort {
c
.
v
=
new
short
[
1
];
c
.
v
[
0
]
=
1
;
short
val1
=
get
();
c
.
v
=
new
short
[
1
];
c
.
v
[
0
]
=
1
;
short
val1
=
get
();
c
.
v
[
0
]
=
2
;
short
val2
=
get
();
c
.
v
[
0
]
=
2
;
short
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
short
[
1
];
c
.
v
[
0
]
=
3
;
short
val3
=
get
();
c
.
v
=
new
short
[
1
];
c
.
v
[
0
]
=
3
;
short
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
c
.
v
=
new
short
[
20
];
c
.
v
[
10
]
=
1
;
short
val1
=
get1
();
c
.
v
=
new
short
[
20
];
c
.
v
[
10
]
=
1
;
short
val1
=
get1
();
c
.
v
[
10
]
=
2
;
short
val2
=
get1
();
c
.
v
[
10
]
=
2
;
short
val2
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
short
[
20
];
c
.
v
[
10
]
=
3
;
short
val3
=
get1
();
c
.
v
=
new
short
[
20
];
c
.
v
[
10
]
=
3
;
short
val3
=
get1
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
}
}
{
{
...
@@ -226,19 +259,21 @@ public class TestStableShort {
...
@@ -226,19 +259,21 @@ public class TestStableShort {
c
.
v
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
short
val1
=
get
();
c
.
v
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
]
=
1
;
short
val1
=
get
();
c
.
v
[
0
][
0
]
=
2
;
short
val2
=
get
();
c
.
v
[
0
][
0
]
=
2
;
short
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
short
val3
=
get
();
c
.
v
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
]
=
3
;
short
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
short
[
1
];
c
.
v
[
0
][
0
]
=
4
;
short
val4
=
get
();
c
.
v
[
0
]
=
new
short
[
1
];
c
.
v
[
0
][
0
]
=
4
;
short
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
}
}
{
{
c
.
v
=
new
short
[
1
][
1
];
short
[]
val1
=
get1
();
c
.
v
=
new
short
[
1
][
1
];
short
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
short
[
1
];
short
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
short
[
1
];
short
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -264,28 +299,31 @@ public class TestStableShort {
...
@@ -264,28 +299,31 @@ public class TestStableShort {
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
short
val1
=
get
();
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
1
;
short
val1
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
short
val2
=
get
();
c
.
v
[
0
][
0
][
0
]
=
2
;
short
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
short
val3
=
get
();
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
3
;
short
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
short
val4
=
get
();
c
.
v
[
0
]
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
][
0
]
=
4
;
short
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
short
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
short
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
short
[
1
];
c
.
v
[
0
][
0
][
0
]
=
5
;
short
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
}
}
{
{
c
.
v
=
new
short
[
1
][
1
][
1
];
short
[]
val1
=
get1
();
c
.
v
=
new
short
[
1
][
1
][
1
];
short
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
short
[
1
];
short
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
short
[
1
];
short
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
short
[
1
][
1
][
1
];
short
[][]
val1
=
get2
();
c
.
v
=
new
short
[
1
][
1
][
1
];
short
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
short
[
1
][
1
];
short
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
short
[
1
][
1
];
short
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -312,37 +350,41 @@ public class TestStableShort {
...
@@ -312,37 +350,41 @@ public class TestStableShort {
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
short
val1
=
get
();
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
1
;
short
val1
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
short
val2
=
get
();
c
.
v
[
0
][
0
][
0
][
0
]
=
2
;
short
val2
=
get
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val2
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val2
,
(
isS
erverWithStable
?
1
:
2
));
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
short
val3
=
get
();
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
3
;
short
val3
=
get
();
assertEquals
(
val3
,
(
isStableEnabled
?
1
:
3
));
assertEquals
(
val3
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
3
));
c
.
v
[
0
]
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
short
val4
=
get
();
c
.
v
[
0
]
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
4
;
short
val4
=
get
();
assertEquals
(
val4
,
(
isStableEnabled
?
1
:
4
));
assertEquals
(
val4
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
4
));
c
.
v
[
0
][
0
]
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
short
val5
=
get
();
c
.
v
[
0
][
0
]
=
new
short
[
1
][
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
5
;
short
val5
=
get
();
assertEquals
(
val5
,
(
isStableEnabled
?
1
:
5
));
assertEquals
(
val5
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
5
));
c
.
v
[
0
][
0
][
0
]
=
new
short
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
short
val6
=
get
();
c
.
v
[
0
][
0
][
0
]
=
new
short
[
1
];
c
.
v
[
0
][
0
][
0
][
0
]
=
6
;
short
val6
=
get
();
assertEquals
(
val6
,
(
isStableEnabled
?
1
:
6
));
assertEquals
(
val6
,
(
isStableEnabled
?
(
isServerWithStable
?
1
:
2
)
:
6
));
}
}
{
{
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[]
val1
=
get1
();
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[]
val1
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
short
[
1
];
short
[]
val2
=
get1
();
c
.
v
[
0
][
0
][
0
]
=
new
short
[
1
];
short
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[][]
val1
=
get2
();
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[][]
val1
=
get2
();
c
.
v
[
0
][
0
]
=
new
short
[
1
][
1
];
short
[][]
val2
=
get2
();
c
.
v
[
0
][
0
]
=
new
short
[
1
][
1
];
short
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[][][]
val1
=
get3
();
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[][][]
val1
=
get3
();
c
.
v
[
0
]
=
new
short
[
1
][
1
][
1
];
short
[][][]
val2
=
get3
();
c
.
v
[
0
]
=
new
short
[
1
][
1
][
1
];
short
[][][]
val2
=
get3
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -350,13 +392,11 @@ public class TestStableShort {
...
@@ -350,13 +392,11 @@ public class TestStableShort {
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[][][][]
val2
=
get4
();
c
.
v
=
new
short
[
1
][
1
][
1
][
1
];
short
[][][][]
val2
=
get4
();
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isStableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
}
}
}
}
/* ==================================================== */
/* ==================================================== */
// Dynamic Dim is higher than static
// Dynamic Dim is higher than static
static
class
ObjectArrayLowerDim0
{
static
class
ObjectArrayLowerDim0
{
public
@Stable
Object
v
;
public
@Stable
Object
v
;
...
@@ -404,7 +444,7 @@ public class TestStableShort {
...
@@ -404,7 +444,7 @@ public class TestStableShort {
c
.
v
=
new
short
[
1
][
1
];
c
.
v
[
0
]
=
new
short
[
0
];
short
[]
val1
=
get1
();
c
.
v
=
new
short
[
1
][
1
];
c
.
v
[
0
]
=
new
short
[
0
];
short
[]
val1
=
get1
();
c
.
v
[
0
]
=
new
short
[
0
];
short
[]
val2
=
get1
();
c
.
v
[
0
]
=
new
short
[
0
];
short
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -440,14 +480,14 @@ public class TestStableShort {
...
@@ -440,14 +480,14 @@ public class TestStableShort {
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
short
[
0
];
short
[]
val1
=
get1
();
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
][
0
]
=
new
short
[
0
];
short
[]
val1
=
get1
();
c
.
v
[
0
][
0
]
=
new
short
[
0
];
short
[]
val2
=
get1
();
c
.
v
[
0
][
0
]
=
new
short
[
0
];
short
[]
val2
=
get1
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
short
[
0
][
0
];
short
[][]
val1
=
get2
();
c
.
v
=
new
short
[
1
][
1
][
1
];
c
.
v
[
0
]
=
new
short
[
0
][
0
];
short
[][]
val1
=
get2
();
c
.
v
[
0
]
=
new
short
[
0
][
0
];
short
[][]
val2
=
get2
();
c
.
v
[
0
]
=
new
short
[
0
][
0
];
short
[][]
val2
=
get2
();
assertTrue
((
isS
tableEnabled
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
assertTrue
((
isS
erverWithStable
?
(
val1
==
val2
)
:
(
val1
!=
val2
)));
}
}
{
{
...
@@ -582,7 +622,7 @@ public class TestStableShort {
...
@@ -582,7 +622,7 @@ public class TestStableShort {
elem
.
a
=
2
;
short
val3
=
get
();
short
val4
=
get1
();
elem
.
a
=
2
;
short
val3
=
get
();
short
val4
=
get1
();
assertEquals
(
val1
,
1
);
assertEquals
(
val1
,
1
);
assertEquals
(
val3
,
(
isS
tableEnabled
?
1
:
2
));
assertEquals
(
val3
,
(
isS
erverWithStable
?
1
:
2
));
assertEquals
(
val2
,
1
);
assertEquals
(
val2
,
1
);
assertEquals
(
val4
,
2
);
assertEquals
(
val4
,
2
);
...
@@ -616,17 +656,4 @@ public class TestStableShort {
...
@@ -616,17 +656,4 @@ public class TestStableShort {
}
}
}
}
}
}
static
final
boolean
isStableEnabled
;
static
{
HotSpotDiagnosticMXBean
diagnostic
=
ManagementFactoryHelper
.
getDiagnosticMXBean
();
VMOption
tmp
;
try
{
tmp
=
diagnostic
.
getVMOption
(
"FoldStableValues"
);
}
catch
(
IllegalArgumentException
e
)
{
tmp
=
null
;
}
isStableEnabled
=
(
tmp
==
null
?
false
:
Boolean
.
parseBoolean
(
tmp
.
getValue
()));
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录