Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
ab66766f
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ab66766f
编写于
11月 11, 2014
作者:
S
shade
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8015272: Make @Contended within the same group to use the same oop map
Reviewed-by: coleenp, dholmes
上级
5eaebf71
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
117 addition
and
10 deletion
+117
-10
hotspot/src/share/vm/classfile/classFileParser.cpp
hotspot/src/share/vm/classfile/classFileParser.cpp
+22
-10
hotspot/test/runtime/contended/OopMapsSameGroup.java
hotspot/test/runtime/contended/OopMapsSameGroup.java
+95
-0
未找到文件。
hotspot/src/share/vm/classfile/classFileParser.cpp
浏览文件 @
ab66766f
...
...
@@ -3492,17 +3492,18 @@ void ClassFileParser::layout_fields(Handle class_loader,
real_offset
=
next_nonstatic_oop_offset
;
next_nonstatic_oop_offset
+=
heapOopSize
;
}
// Update oop maps
// Record this oop in the oop maps
if
(
nonstatic_oop_map_count
>
0
&&
nonstatic_oop_offsets
[
nonstatic_oop_map_count
-
1
]
==
real_offset
-
int
(
nonstatic_oop_counts
[
nonstatic_oop_map_count
-
1
])
*
heapOopSize
)
{
//
Extend
current oop map
//
This oop is adjacent to the previous one, add to
current oop map
assert
(
nonstatic_oop_map_count
-
1
<
max_nonstatic_oop_maps
,
"range check"
);
nonstatic_oop_counts
[
nonstatic_oop_map_count
-
1
]
+=
1
;
}
else
{
//
C
reate new oop map
//
This oop is not adjacent to the previous one, c
reate new oop map
assert
(
nonstatic_oop_map_count
<
max_nonstatic_oop_maps
,
"range check"
);
nonstatic_oop_offsets
[
nonstatic_oop_map_count
]
=
real_offset
;
nonstatic_oop_counts
[
nonstatic_oop_map_count
]
=
1
;
...
...
@@ -3624,13 +3625,24 @@ void ClassFileParser::layout_fields(Handle class_loader,
real_offset
=
next_nonstatic_padded_offset
;
next_nonstatic_padded_offset
+=
heapOopSize
;
// Create new oop map
assert
(
nonstatic_oop_map_count
<
max_nonstatic_oop_maps
,
"range check"
);
nonstatic_oop_offsets
[
nonstatic_oop_map_count
]
=
real_offset
;
nonstatic_oop_counts
[
nonstatic_oop_map_count
]
=
1
;
nonstatic_oop_map_count
+=
1
;
if
(
first_nonstatic_oop_offset
==
0
)
{
// Undefined
first_nonstatic_oop_offset
=
real_offset
;
// Record this oop in the oop maps
if
(
nonstatic_oop_map_count
>
0
&&
nonstatic_oop_offsets
[
nonstatic_oop_map_count
-
1
]
==
real_offset
-
int
(
nonstatic_oop_counts
[
nonstatic_oop_map_count
-
1
])
*
heapOopSize
)
{
// This oop is adjacent to the previous one, add to current oop map
assert
(
nonstatic_oop_map_count
-
1
<
max_nonstatic_oop_maps
,
"range check"
);
nonstatic_oop_counts
[
nonstatic_oop_map_count
-
1
]
+=
1
;
}
else
{
// This oop is not adjacent to the previous one, create new oop map
assert
(
nonstatic_oop_map_count
<
max_nonstatic_oop_maps
,
"range check"
);
nonstatic_oop_offsets
[
nonstatic_oop_map_count
]
=
real_offset
;
nonstatic_oop_counts
[
nonstatic_oop_map_count
]
=
1
;
nonstatic_oop_map_count
+=
1
;
if
(
first_nonstatic_oop_offset
==
0
)
{
// Undefined
first_nonstatic_oop_offset
=
real_offset
;
}
}
break
;
...
...
hotspot/test/runtime/contended/OopMapsSameGroup.java
0 → 100644
浏览文件 @
ab66766f
/*
* 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 8015272
* @summary \@Contended within the same group to use the same oop map
*
* @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMapsSameGroup
*/
public
class
OopMapsSameGroup
{
public
static
final
int
COUNT
=
10000
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Object
o01
=
new
Object
();
Object
o02
=
new
Object
();
Object
o03
=
new
Object
();
Object
o04
=
new
Object
();
R
[]
rs
=
new
R
[
COUNT
];
for
(
int
i
=
0
;
i
<
COUNT
;
i
++)
{
R
r
=
new
R
();
r
.
o01
=
o01
;
r
.
o02
=
o02
;
r
.
o03
=
o03
;
r
.
o04
=
o04
;
rs
[
i
]
=
r
;
}
System
.
gc
();
for
(
int
i
=
0
;
i
<
COUNT
;
i
++)
{
R
r
=
rs
[
i
];
if
(
r
.
o01
!=
o01
)
throw
new
Error
(
"Test Error: o01"
);
if
(
r
.
o02
!=
o02
)
throw
new
Error
(
"Test Error: o02"
);
if
(
r
.
o03
!=
o03
)
throw
new
Error
(
"Test Error: o03"
);
if
(
r
.
o04
!=
o04
)
throw
new
Error
(
"Test Error: o04"
);
}
}
public
static
class
R
{
@Contended
(
"group1"
)
Object
o01
;
@Contended
(
"group1"
)
Object
o02
;
@Contended
(
"group2"
)
Object
o03
;
@Contended
(
"group2"
)
Object
o04
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录