Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
b28c7401
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看板
提交
b28c7401
编写于
5月 17, 2013
作者:
D
dcubed
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
c9e1e2d9
17949333
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
553 addition
and
65 deletion
+553
-65
agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java
...sses/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java
+4
-4
agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java
...vm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java
+15
-8
agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java
...un/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java
+15
-8
make/sa.files
make/sa.files
+2
-2
src/share/vm/classfile/classFileParser.cpp
src/share/vm/classfile/classFileParser.cpp
+21
-8
src/share/vm/prims/jvmtiExport.cpp
src/share/vm/prims/jvmtiExport.cpp
+6
-2
test/runtime/7158804/Test7158804.sh
test/runtime/7158804/Test7158804.sh
+0
-31
test/runtime/CommandLine/ConfigFileParsing.java
test/runtime/CommandLine/ConfigFileParsing.java
+55
-0
test/runtime/RedefineObject/TestRedefineObject.java
test/runtime/RedefineObject/TestRedefineObject.java
+2
-2
test/runtime/contended/DefaultValue.java
test/runtime/contended/DefaultValue.java
+185
-0
test/runtime/contended/Inheritance1.java
test/runtime/contended/Inheritance1.java
+248
-0
未找到文件。
agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java
浏览文件 @
b28c7401
...
...
@@ -28,10 +28,10 @@ import java.io.*;
import
java.util.*
;
import
sun.jvm.hotspot.debugger.*
;
import
sun.jvm.hotspot.debugger.cdbg.*
;
import
sun.jvm.hotspot.debugger.cdbg.basic.x86.*
;
import
sun.jvm.hotspot.debugger.cdbg.basic.amd64.*
;
import
sun.jvm.hotspot.debugger.x86.*
;
import
sun.jvm.hotspot.debugger.amd64.*
;
import
sun.jvm.hotspot.debugger.windows.x86.*
;
import
sun.jvm.hotspot.debugger.windows.amd64.*
;
import
sun.jvm.hotspot.utilities.AddressOps
;
class
WindbgCDebugger
implements
CDebugger
{
...
...
@@ -75,14 +75,14 @@ class WindbgCDebugger implements CDebugger {
if
(
ebp
==
null
)
return
null
;
Address
pc
=
context
.
getRegisterAsAddress
(
X86ThreadContext
.
EIP
);
if
(
pc
==
null
)
return
null
;
return
new
X86CFrame
(
this
,
ebp
,
pc
);
return
new
WindowsX86CFrame
(
dbg
,
ebp
,
pc
);
}
else
if
(
dbg
.
getCPU
().
equals
(
"amd64"
))
{
AMD64ThreadContext
context
=
(
AMD64ThreadContext
)
thread
.
getContext
();
Address
rbp
=
context
.
getRegisterAsAddress
(
AMD64ThreadContext
.
RBP
);
if
(
rbp
==
null
)
return
null
;
Address
pc
=
context
.
getRegisterAsAddress
(
AMD64ThreadContext
.
RIP
);
if
(
pc
==
null
)
return
null
;
return
new
AMD64CFrame
(
this
,
rbp
,
pc
);
return
new
WindowsAMD64CFrame
(
dbg
,
rbp
,
pc
);
}
else
{
// unsupported CPU!
return
null
;
...
...
agent/src/share/classes/sun/jvm/hotspot/debugger/
cdbg/basic/amd64/
AMD64CFrame.java
→
agent/src/share/classes/sun/jvm/hotspot/debugger/
windows/amd64/Windows
AMD64CFrame.java
浏览文件 @
b28c7401
...
...
@@ -22,26 +22,26 @@
*
*/
package
sun.jvm.hotspot.debugger.
cdbg.basic
.amd64
;
package
sun.jvm.hotspot.debugger.
windows
.amd64
;
import
sun.jvm.hotspot.debugger.*
;
import
sun.jvm.hotspot.debugger.amd64.*
;
import
sun.jvm.hotspot.debugger.cdbg.*
;
import
sun.jvm.hotspot.debugger.cdbg.basic.*
;
import
sun.jvm.hotspot.debugger.windbg.*
;
/** Basic AMD64 frame functionality providing sender() functionality. */
public
class
AMD64CFrame
extends
BasicCFrame
{
public
class
WindowsAMD64CFrame
extends
BasicCFrame
{
private
Address
rbp
;
private
Address
pc
;
private
static
final
int
ADDRESS_SIZE
=
8
;
/** Constructor for topmost frame */
public
AMD64CFrame
(
C
Debugger
dbg
,
Address
rbp
,
Address
pc
)
{
super
(
dbg
);
public
WindowsAMD64CFrame
(
Windbg
Debugger
dbg
,
Address
rbp
,
Address
pc
)
{
super
(
dbg
.
getCDebugger
()
);
this
.
rbp
=
rbp
;
this
.
pc
=
pc
;
this
.
dbg
=
dbg
;
}
public
CFrame
sender
(
ThreadProxy
thread
)
{
...
...
@@ -52,15 +52,20 @@ public class AMD64CFrame extends BasicCFrame {
return
null
;
}
// Check alignment of rbp
if
(
dbg
.
getAddressValue
(
rbp
)
%
ADDRESS_SIZE
!=
0
)
{
return
null
;
}
Address
nextRBP
=
rbp
.
getAddressAt
(
0
*
ADDRESS_SIZE
);
if
(
nextRBP
==
null
)
{
if
(
nextRBP
==
null
||
nextRBP
.
lessThanOrEqual
(
rbp
)
)
{
return
null
;
}
Address
nextPC
=
rbp
.
getAddressAt
(
1
*
ADDRESS_SIZE
);
if
(
nextPC
==
null
)
{
return
null
;
}
return
new
AMD64CFrame
(
dbg
()
,
nextRBP
,
nextPC
);
return
new
WindowsAMD64CFrame
(
dbg
,
nextRBP
,
nextPC
);
}
public
Address
pc
()
{
...
...
@@ -70,4 +75,6 @@ public class AMD64CFrame extends BasicCFrame {
public
Address
localVariableBase
()
{
return
rbp
;
}
private
WindbgDebugger
dbg
;
}
agent/src/share/classes/sun/jvm/hotspot/debugger/
cdbg/basic/x86/
X86CFrame.java
→
agent/src/share/classes/sun/jvm/hotspot/debugger/
windows/x86/Windows
X86CFrame.java
浏览文件 @
b28c7401
...
...
@@ -22,26 +22,26 @@
*
*/
package
sun.jvm.hotspot.debugger.
cdbg.basic
.x86
;
package
sun.jvm.hotspot.debugger.
windows
.x86
;
import
sun.jvm.hotspot.debugger.*
;
import
sun.jvm.hotspot.debugger.x86.*
;
import
sun.jvm.hotspot.debugger.cdbg.*
;
import
sun.jvm.hotspot.debugger.cdbg.basic.*
;
import
sun.jvm.hotspot.debugger.windbg.*
;
/** Basic X86 frame functionality providing sender() functionality. */
public
class
X86CFrame
extends
BasicCFrame
{
public
class
WindowsX86CFrame
extends
BasicCFrame
{
private
Address
ebp
;
private
Address
pc
;
private
static
final
int
ADDRESS_SIZE
=
4
;
/** Constructor for topmost frame */
public
X86CFrame
(
C
Debugger
dbg
,
Address
ebp
,
Address
pc
)
{
super
(
dbg
);
public
WindowsX86CFrame
(
Windbg
Debugger
dbg
,
Address
ebp
,
Address
pc
)
{
super
(
dbg
.
getCDebugger
()
);
this
.
ebp
=
ebp
;
this
.
pc
=
pc
;
this
.
dbg
=
dbg
;
}
public
CFrame
sender
(
ThreadProxy
thread
)
{
...
...
@@ -52,15 +52,20 @@ public class X86CFrame extends BasicCFrame {
return
null
;
}
// Check alignment of ebp
if
(
dbg
.
getAddressValue
(
ebp
)
%
ADDRESS_SIZE
!=
0
)
{
return
null
;
}
Address
nextEBP
=
ebp
.
getAddressAt
(
0
*
ADDRESS_SIZE
);
if
(
nextEBP
==
null
)
{
if
(
nextEBP
==
null
||
nextEBP
.
lessThanOrEqual
(
ebp
)
)
{
return
null
;
}
Address
nextPC
=
ebp
.
getAddressAt
(
1
*
ADDRESS_SIZE
);
if
(
nextPC
==
null
)
{
return
null
;
}
return
new
X86CFrame
(
dbg
()
,
nextEBP
,
nextPC
);
return
new
WindowsX86CFrame
(
dbg
,
nextEBP
,
nextPC
);
}
public
Address
pc
()
{
...
...
@@ -70,4 +75,6 @@ public class X86CFrame extends BasicCFrame {
public
Address
localVariableBase
()
{
return
ebp
;
}
private
WindbgDebugger
dbg
;
}
make/sa.files
浏览文件 @
b28c7401
...
...
@@ -48,8 +48,6 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/amd64/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/x86/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \
...
...
@@ -70,6 +68,8 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/win32/coff/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/amd64/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/x86/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/x86/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/amd64/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/x86/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/g1/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/parallelScavenge/*.java \
...
...
src/share/vm/classfile/classFileParser.cpp
浏览文件 @
b28c7401
...
...
@@ -1719,15 +1719,28 @@ void ClassFileParser::parse_annotations(u1* buffer, int limit,
coll
->
set_annotation
(
id
);
if
(
id
==
AnnotationCollector
::
_sun_misc_Contended
)
{
// @Contended can optionally specify the contention group.
//
// Contended group defines the equivalence class over the fields:
// the fields within the same contended group are not treated distinct.
// The only exception is default group, which does not incur the
// equivalence. Naturally, contention group for classes is meaningless.
//
// While the contention group is specified as String, annotation
// values are already interned, and we might as well use the constant
// pool index as the group tag.
//
u2
group_index
=
0
;
// default contended group
if
(
count
==
1
&&
s_size
==
(
index
-
index0
)
// match size
&&
s_tag_val
==
*
(
abase
+
tag_off
)
&&
member
==
vmSymbols
::
value_name
())
{
u2
group_index
=
Bytes
::
get_Java_u2
(
abase
+
s_con_off
);
coll
->
set_contended_group
(
group_index
);
}
else
{
coll
->
set_contended_group
(
0
);
// default contended group
group_index
=
Bytes
::
get_Java_u2
(
abase
+
s_con_off
);
if
(
_cp
->
symbol_at
(
group_index
)
->
utf8_length
()
==
0
)
{
group_index
=
0
;
// default contended group
}
}
coll
->
set_contended_group
(
group_index
);
}
}
}
...
...
@@ -3165,13 +3178,13 @@ void ClassFileParser::layout_fields(Handle class_loader,
first_nonstatic_field_offset
=
instanceOopDesc
::
base_offset_in_bytes
()
+
nonstatic_field_size
*
heapOopSize
;
next_nonstatic_field_offset
=
first_nonstatic_field_offset
;
// class is contended, pad before all the fields
if
(
parsed_annotations
->
is_contended
())
{
firs
t_nonstatic_field_offset
+=
pad_size
;
nex
t_nonstatic_field_offset
+=
pad_size
;
}
next_nonstatic_field_offset
=
first_nonstatic_field_offset
;
unsigned
int
nonstatic_double_count
=
fac
->
count
[
NONSTATIC_DOUBLE
]
-
fac_contended
.
count
[
NONSTATIC_DOUBLE
];
unsigned
int
nonstatic_word_count
=
fac
->
count
[
NONSTATIC_WORD
]
-
fac_contended
.
count
[
NONSTATIC_WORD
];
unsigned
int
nonstatic_short_count
=
fac
->
count
[
NONSTATIC_SHORT
]
-
fac_contended
.
count
[
NONSTATIC_SHORT
];
...
...
@@ -3562,7 +3575,7 @@ void ClassFileParser::layout_fields(Handle class_loader,
int
instance_size
=
align_object_size
(
next_nonstatic_type_offset
/
wordSize
);
assert
(
instance_size
==
align_object_size
(
align_size_up
(
(
instanceOopDesc
::
base_offset_in_bytes
()
+
nonstatic_field_size
*
heapOopSize
+
((
parsed_annotations
->
is_contended
())
?
pad_size
:
0
)
),
(
instanceOopDesc
::
base_offset_in_bytes
()
+
nonstatic_field_size
*
heapOopSize
),
wordSize
)
/
wordSize
),
"consistent layout helper value"
);
// Number of non-static oop map blocks allocated at end of klass.
...
...
src/share/vm/prims/jvmtiExport.cpp
浏览文件 @
b28c7401
...
...
@@ -1624,15 +1624,19 @@ void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method
}
}
assert
(
sig_type
!=
'['
,
"array should have sig_type == 'L'"
);
bool
handle_created
=
false
;
// convert oop to JNI handle.
if
(
sig_type
==
'L'
||
sig_type
==
'['
)
{
if
(
sig_type
==
'L'
)
{
handle_created
=
true
;
value
->
l
=
(
jobject
)
JNIHandles
::
make_local
(
thread
,
(
oop
)
value
->
l
);
}
post_field_modification
(
thread
,
method
,
location
,
field_klass
,
object
,
field
,
sig_type
,
value
);
// Destroy the JNI handle allocated above.
if
(
sig_type
==
'L'
)
{
if
(
handle_created
)
{
JNIHandles
::
destroy_local
(
value
->
l
);
}
}
...
...
test/runtime/7158804/Test7158804.sh
已删除
100644 → 0
浏览文件 @
c9e1e2d9
#!/bin/sh
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
##
## @test Test7158804.sh
## @bug 7158804
## @summary Improve config file parsing
## @run shell Test7158804.sh
##
if
[
"
${
TESTSRC
}
"
=
""
]
then
TESTSRC
=
${
PWD
}
echo
"TESTSRC not set. Using "
${
TESTSRC
}
" as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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>
.hotspotrc
${
TESTJAVA
}
/bin/java
${
TESTVMOPTS
}
-XX
:+IgnoreUnrecognizedVMOptions
-XX
:Flags
=
.hotspotrc
-version
if
[
$?
-ne
0
]
then
echo
"Test Failed"
exit
1
fi
rm
-f
.hotspotrc
exit
0
test/runtime/CommandLine/ConfigFileParsing.java
0 → 100644
浏览文件 @
b28c7401
/*
* Copyright (c) 2013, 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.
*
* 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.
*/
/*
* @test ConfigFileParsing
* @bug 7158804
* @summary Improve config file parsing
* @library /testlibrary
*/
import
java.io.PrintWriter
;
import
com.oracle.java.testlibrary.*
;
public
class
ConfigFileParsing
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
testFileName
=
".hotspotrc"
;
// Create really long invalid option
String
reallyLongInvalidOption
=
""
;
for
(
int
i
=
0
;
i
<
5000
;
i
++)
reallyLongInvalidOption
+=
'a'
;
// Populate the options file with really long string
PrintWriter
pw
=
new
PrintWriter
(
testFileName
);
pw
.
println
(
"-XX:+"
+
reallyLongInvalidOption
);
pw
.
close
();
// start VM
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+IgnoreUnrecognizedVMOptions"
,
"-XX:Flags=.hotspotrc"
,
"-version"
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldHaveExitValue
(
0
);
}
}
test/runtime/RedefineObject/TestRedefineObject.java
浏览文件 @
b28c7401
...
...
@@ -32,10 +32,10 @@ import com.oracle.java.testlibrary.*;
* @library /testlibrary
* @build Agent
* @run main ClassFileInstaller Agent
* @run main Test
* @run main Test
RedefineObject
* @run main/othervm -javaagent:agent.jar Agent
*/
public
class
Test
{
public
class
Test
RedefineObject
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
PrintWriter
pw
=
new
PrintWriter
(
"MANIFEST.MF"
);
...
...
test/runtime/contended/DefaultValue.java
0 → 100644
浏览文件 @
b28c7401
/*
* Copyright (c) 2013, 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.
*
* 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.
*/
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.lang.Class
;
import
java.lang.String
;
import
java.lang.System
;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.RuntimeMXBean
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.CyclicBarrier
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
sun.misc.Unsafe
;
import
sun.misc.Contended
;
/*
* @test
* @bug 8014509
* @summary \@Contended: explicit default value behaves differently from the implicit value
*
* @run main/othervm -XX:-RestrictContended DefaultValue
*/
public
class
DefaultValue
{
private
static
final
Unsafe
U
;
private
static
int
ADDRESS_SIZE
;
private
static
int
HEADER_SIZE
;
static
{
// steal Unsafe
try
{
Field
unsafe
=
Unsafe
.
class
.
getDeclaredField
(
"theUnsafe"
);
unsafe
.
setAccessible
(
true
);
U
=
(
Unsafe
)
unsafe
.
get
(
null
);
}
catch
(
NoSuchFieldException
|
IllegalAccessException
e
)
{
throw
new
IllegalStateException
(
e
);
}
// When running with CompressedOops on 64-bit platform, the address size
// reported by Unsafe is still 8, while the real reference fields are 4 bytes long.
// Try to guess the reference field size with this naive trick.
try
{
long
off1
=
U
.
objectFieldOffset
(
CompressedOopsClass
.
class
.
getField
(
"obj1"
));
long
off2
=
U
.
objectFieldOffset
(
CompressedOopsClass
.
class
.
getField
(
"obj2"
));
ADDRESS_SIZE
=
(
int
)
Math
.
abs
(
off2
-
off1
);
HEADER_SIZE
=
(
int
)
Math
.
min
(
off1
,
off2
);
}
catch
(
NoSuchFieldException
e
)
{
ADDRESS_SIZE
=
-
1
;
}
}
static
class
CompressedOopsClass
{
public
Object
obj1
;
public
Object
obj2
;
}
public
static
boolean
arePaddedPairwise
(
Class
klass
,
String
field1
,
String
field2
)
throws
Exception
{
Field
f1
=
klass
.
getField
(
field1
);
Field
f2
=
klass
.
getField
(
field2
);
int
diff
=
offset
(
f1
)
-
offset
(
f2
);
if
(
diff
<
0
)
{
// f1 is first
return
(
offset
(
f2
)
-
(
offset
(
f1
)
+
getSize
(
f1
)))
>
64
;
}
else
{
// f2 is first
return
(
offset
(
f1
)
-
(
offset
(
f2
)
+
getSize
(
f2
)))
>
64
;
}
}
public
static
boolean
sameLayout
(
Class
klass1
,
Class
klass2
)
throws
Exception
{
for
(
Field
f1
:
klass1
.
getDeclaredFields
())
{
Field
f2
=
klass2
.
getDeclaredField
(
f1
.
getName
());
if
(
offset
(
f1
)
!=
offset
(
f2
))
{
return
false
;
}
}
for
(
Field
f2
:
klass1
.
getDeclaredFields
())
{
Field
f1
=
klass2
.
getDeclaredField
(
f2
.
getName
());
if
(
offset
(
f1
)
!=
offset
(
f2
))
{
return
false
;
}
}
return
true
;
}
public
static
boolean
isStatic
(
Field
field
)
{
return
Modifier
.
isStatic
(
field
.
getModifiers
());
}
public
static
int
offset
(
Field
field
)
{
if
(
isStatic
(
field
))
{
return
(
int
)
U
.
staticFieldOffset
(
field
);
}
else
{
return
(
int
)
U
.
objectFieldOffset
(
field
);
}
}
public
static
int
getSize
(
Field
field
)
{
Class
type
=
field
.
getType
();
if
(
type
==
byte
.
class
)
{
return
1
;
}
if
(
type
==
boolean
.
class
)
{
return
1
;
}
if
(
type
==
short
.
class
)
{
return
2
;
}
if
(
type
==
char
.
class
)
{
return
2
;
}
if
(
type
==
int
.
class
)
{
return
4
;
}
if
(
type
==
float
.
class
)
{
return
4
;
}
if
(
type
==
long
.
class
)
{
return
8
;
}
if
(
type
==
double
.
class
)
{
return
8
;
}
return
ADDRESS_SIZE
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
boolean
endResult
=
true
;
if
(!
arePaddedPairwise
(
R1
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"R1 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
R2
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"R2 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
R3
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"R3 failed"
);
endResult
&=
false
;
}
System
.
out
.
println
(
endResult
?
"Test PASSES"
:
"Test FAILS"
);
if
(!
endResult
)
{
throw
new
Error
(
"Test failed"
);
}
}
public
static
class
R1
{
@Contended
public
int
int1
;
@Contended
public
int
int2
;
}
public
static
class
R2
{
@Contended
(
""
)
public
int
int1
;
@Contended
(
""
)
public
int
int2
;
}
public
static
class
R3
{
@Contended
()
public
int
int1
;
@Contended
()
public
int
int2
;
}
}
test/runtime/contended/Inheritance1.java
0 → 100644
浏览文件 @
b28c7401
/*
* Copyright (c) 2013, 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.
*
* 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.
*/
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.lang.Class
;
import
java.lang.String
;
import
java.lang.System
;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.RuntimeMXBean
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.CyclicBarrier
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
sun.misc.Unsafe
;
import
sun.misc.Contended
;
/*
* @test
* @bug 8012939
* @summary \@Contended doesn't work correctly with inheritance
*
* @run main/othervm -XX:-RestrictContended Inheritance1
*/
public
class
Inheritance1
{
private
static
final
Unsafe
U
;
private
static
int
ADDRESS_SIZE
;
private
static
int
HEADER_SIZE
;
static
{
// steal Unsafe
try
{
Field
unsafe
=
Unsafe
.
class
.
getDeclaredField
(
"theUnsafe"
);
unsafe
.
setAccessible
(
true
);
U
=
(
Unsafe
)
unsafe
.
get
(
null
);
}
catch
(
NoSuchFieldException
|
IllegalAccessException
e
)
{
throw
new
IllegalStateException
(
e
);
}
// When running with CompressedOops on 64-bit platform, the address size
// reported by Unsafe is still 8, while the real reference fields are 4 bytes long.
// Try to guess the reference field size with this naive trick.
try
{
long
off1
=
U
.
objectFieldOffset
(
CompressedOopsClass
.
class
.
getField
(
"obj1"
));
long
off2
=
U
.
objectFieldOffset
(
CompressedOopsClass
.
class
.
getField
(
"obj2"
));
ADDRESS_SIZE
=
(
int
)
Math
.
abs
(
off2
-
off1
);
HEADER_SIZE
=
(
int
)
Math
.
min
(
off1
,
off2
);
}
catch
(
NoSuchFieldException
e
)
{
ADDRESS_SIZE
=
-
1
;
}
}
static
class
CompressedOopsClass
{
public
Object
obj1
;
public
Object
obj2
;
}
public
static
boolean
arePaddedPairwise
(
Class
klass
,
String
field1
,
String
field2
)
throws
Exception
{
Field
f1
=
klass
.
getField
(
field1
);
Field
f2
=
klass
.
getField
(
field2
);
int
diff
=
offset
(
f1
)
-
offset
(
f2
);
if
(
diff
<
0
)
{
// f1 is first
return
(
offset
(
f2
)
-
(
offset
(
f1
)
+
getSize
(
f1
)))
>
64
;
}
else
{
// f2 is first
return
(
offset
(
f1
)
-
(
offset
(
f2
)
+
getSize
(
f2
)))
>
64
;
}
}
public
static
boolean
sameLayout
(
Class
klass1
,
Class
klass2
)
throws
Exception
{
for
(
Field
f1
:
klass1
.
getDeclaredFields
())
{
Field
f2
=
klass2
.
getDeclaredField
(
f1
.
getName
());
if
(
offset
(
f1
)
!=
offset
(
f2
))
{
return
false
;
}
}
for
(
Field
f2
:
klass1
.
getDeclaredFields
())
{
Field
f1
=
klass2
.
getDeclaredField
(
f2
.
getName
());
if
(
offset
(
f1
)
!=
offset
(
f2
))
{
return
false
;
}
}
return
true
;
}
public
static
boolean
isStatic
(
Field
field
)
{
return
Modifier
.
isStatic
(
field
.
getModifiers
());
}
public
static
int
offset
(
Field
field
)
{
if
(
isStatic
(
field
))
{
return
(
int
)
U
.
staticFieldOffset
(
field
);
}
else
{
return
(
int
)
U
.
objectFieldOffset
(
field
);
}
}
public
static
int
getSize
(
Field
field
)
{
Class
type
=
field
.
getType
();
if
(
type
==
byte
.
class
)
{
return
1
;
}
if
(
type
==
boolean
.
class
)
{
return
1
;
}
if
(
type
==
short
.
class
)
{
return
2
;
}
if
(
type
==
char
.
class
)
{
return
2
;
}
if
(
type
==
int
.
class
)
{
return
4
;
}
if
(
type
==
float
.
class
)
{
return
4
;
}
if
(
type
==
long
.
class
)
{
return
8
;
}
if
(
type
==
double
.
class
)
{
return
8
;
}
return
ADDRESS_SIZE
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
boolean
endResult
=
true
;
// --------------- INSTANCE FIELDS ---------------------
if
(!
arePaddedPairwise
(
A2_R1
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A2_R1 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
A3_R1
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A3_R1 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
A1_R2
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A1_R2 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
A2_R2
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A2_R2 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
A3_R2
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A3_R2 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
A1_R3
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A1_R3 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
A2_R3
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A2_R3 failed"
);
endResult
&=
false
;
}
if
(!
arePaddedPairwise
(
A3_R3
.
class
,
"int1"
,
"int2"
))
{
System
.
err
.
println
(
"A3_R3 failed"
);
endResult
&=
false
;
}
System
.
out
.
println
(
endResult
?
"Test PASSES"
:
"Test FAILS"
);
if
(!
endResult
)
{
throw
new
Error
(
"Test failed"
);
}
}
public
static
class
R1
{
public
int
int1
;
}
public
static
class
R2
{
@Contended
public
int
int1
;
}
@Contended
public
static
class
R3
{
public
int
int1
;
}
public
static
class
A1_R1
extends
R1
{
public
int
int2
;
}
public
static
class
A2_R1
extends
R1
{
@Contended
public
int
int2
;
}
@Contended
public
static
class
A3_R1
extends
R1
{
public
int
int2
;
}
public
static
class
A1_R2
extends
R2
{
public
int
int2
;
}
public
static
class
A2_R2
extends
R2
{
@Contended
public
int
int2
;
}
@Contended
public
static
class
A3_R2
extends
R2
{
public
int
int2
;
}
public
static
class
A1_R3
extends
R3
{
public
int
int2
;
}
public
static
class
A2_R3
extends
R3
{
@Contended
public
int
int2
;
}
@Contended
public
static
class
A3_R3
extends
R3
{
public
int
int2
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录