Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
91e4f7e3
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看板
提交
91e4f7e3
编写于
9月 11, 2013
作者:
T
tschatzl
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
43403012
137d0024
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
132 addition
and
6 deletion
+132
-6
src/os/windows/vm/os_windows.cpp
src/os/windows/vm/os_windows.cpp
+65
-3
src/share/vm/gc_implementation/g1/concurrentMark.cpp
src/share/vm/gc_implementation/g1/concurrentMark.cpp
+2
-3
test/gc/TestObjectAlignment.java
test/gc/TestObjectAlignment.java
+65
-0
未找到文件。
src/os/windows/vm/os_windows.cpp
浏览文件 @
91e4f7e3
...
...
@@ -3189,9 +3189,12 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* addr, boo
return
p_buf
;
}
else
{
if
(
TracePageSizes
&&
Verbose
)
{
tty
->
print_cr
(
"Reserving large pages in a single large chunk."
);
}
// normal policy just allocate it all at once
DWORD
flag
=
MEM_RESERVE
|
MEM_COMMIT
|
MEM_LARGE_PAGES
;
char
*
res
=
(
char
*
)
VirtualAlloc
(
NULL
,
bytes
,
flag
,
prot
);
char
*
res
=
(
char
*
)
VirtualAlloc
(
addr
,
bytes
,
flag
,
prot
);
if
(
res
!=
NULL
)
{
address
pc
=
CALLER_PC
;
MemTracker
::
record_virtual_memory_reserve_and_commit
((
address
)
res
,
bytes
,
mtNone
,
pc
);
...
...
@@ -5714,7 +5717,66 @@ BOOL os::Advapi32Dll::AdvapiAvailable() {
#endif
#ifndef PRODUCT
// test the code path in reserve_memory_special() that tries to allocate memory in a single
// contiguous memory block at a particular address.
// The test first tries to find a good approximate address to allocate at by using the same
// method to allocate some memory at any address. The test then tries to allocate memory in
// the vicinity (not directly after it to avoid possible by-chance use of that location)
// This is of course only some dodgy assumption, there is no guarantee that the vicinity of
// the previously allocated memory is available for allocation. The only actual failure
// that is reported is when the test tries to allocate at a particular location but gets a
// different valid one. A NULL return value at this point is not considered an error but may
// be legitimate.
// If -XX:+VerboseInternalVMTests is enabled, print some explanatory messages.
void
TestReserveMemorySpecial_test
()
{
// No tests available for this platform
if
(
!
UseLargePages
)
{
if
(
VerboseInternalVMTests
)
{
gclog_or_tty
->
print
(
"Skipping test because large pages are disabled"
);
}
return
;
}
// save current value of globals
bool
old_use_large_pages_individual_allocation
=
UseLargePagesIndividualAllocation
;
bool
old_use_numa_interleaving
=
UseNUMAInterleaving
;
// set globals to make sure we hit the correct code path
UseLargePagesIndividualAllocation
=
UseNUMAInterleaving
=
false
;
// do an allocation at an address selected by the OS to get a good one.
const
size_t
large_allocation_size
=
os
::
large_page_size
()
*
4
;
char
*
result
=
os
::
reserve_memory_special
(
large_allocation_size
,
os
::
large_page_size
(),
NULL
,
false
);
if
(
result
==
NULL
)
{
if
(
VerboseInternalVMTests
)
{
gclog_or_tty
->
print
(
"Failed to allocate control block with size "
SIZE_FORMAT
". Skipping remainder of test."
,
large_allocation_size
);
}
}
else
{
os
::
release_memory_special
(
result
,
large_allocation_size
);
// allocate another page within the recently allocated memory area which seems to be a good location. At least
// we managed to get it once.
const
size_t
expected_allocation_size
=
os
::
large_page_size
();
char
*
expected_location
=
result
+
os
::
large_page_size
();
char
*
actual_location
=
os
::
reserve_memory_special
(
expected_allocation_size
,
os
::
large_page_size
(),
expected_location
,
false
);
if
(
actual_location
==
NULL
)
{
if
(
VerboseInternalVMTests
)
{
gclog_or_tty
->
print
(
"Failed to allocate any memory at "
PTR_FORMAT
" size "
SIZE_FORMAT
". Skipping remainder of test."
,
expected_location
,
large_allocation_size
);
}
}
else
{
// release memory
os
::
release_memory_special
(
actual_location
,
expected_allocation_size
);
// only now check, after releasing any memory to avoid any leaks.
assert
(
actual_location
==
expected_location
,
err_msg
(
"Failed to allocate memory at requested location "
PTR_FORMAT
" of size "
SIZE_FORMAT
", is "
PTR_FORMAT
" instead"
,
expected_location
,
expected_allocation_size
,
actual_location
));
}
}
// restore globals
UseLargePagesIndividualAllocation
=
old_use_large_pages_individual_allocation
;
UseNUMAInterleaving
=
old_use_numa_interleaving
;
}
#endif
#endif // PRODUCT
src/share/vm/gc_implementation/g1/concurrentMark.cpp
浏览文件 @
91e4f7e3
...
...
@@ -481,9 +481,8 @@ uint ConcurrentMark::scale_parallel_threads(uint n_par_threads) {
ConcurrentMark
::
ConcurrentMark
(
G1CollectedHeap
*
g1h
,
ReservedSpace
heap_rs
)
:
_g1h
(
g1h
),
_markBitMap1
(
MinObjAlignment
-
1
),
_markBitMap2
(
MinObjAlignment
-
1
),
_markBitMap1
(
log2_intptr
(
MinObjAlignment
)),
_markBitMap2
(
log2_intptr
(
MinObjAlignment
)),
_parallel_marking_threads
(
0
),
_max_parallel_marking_threads
(
0
),
_sleep_factor
(
0.0
),
...
...
test/gc/TestObjectAlignment.java
0 → 100644
浏览文件 @
91e4f7e3
/*
* 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 TestObjectAlignment
* @key gc
* @bug 8021823
* @summary G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
* @library /testlibrary
* @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8
* @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16
* @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32
* @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=64
* @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=128
* @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=256
* @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8
* @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16
* @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32
* @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=64
* @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=128
* @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=256
*/
import
com.oracle.java.testlibrary.ProcessTools
;
import
com.oracle.java.testlibrary.OutputAnalyzer
;
public
class
TestObjectAlignment
{
public
static
byte
[]
garbage
;
private
static
boolean
runsOn32bit
()
{
return
System
.
getProperty
(
"sun.arch.data.model"
).
equals
(
"32"
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
runsOn32bit
())
{
// 32 bit VMs do not allow setting ObjectAlignmentInBytes, so there is nothing to test. We still get called.
return
;
}
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
garbage
=
new
byte
[
1000
];
System
.
gc
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录