Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
a6739905
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看板
提交
a6739905
编写于
1月 03, 2018
作者:
M
mchinnathamb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8170358: [REDO] 8k class metaspace chunks misallocated from 4k chunk Freelist
Reviewed-by: dholmes, kevinw
上级
01f9442d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
20 deletion
+58
-20
src/share/vm/memory/metaspace.cpp
src/share/vm/memory/metaspace.cpp
+55
-19
src/share/vm/prims/jni.cpp
src/share/vm/prims/jni.cpp
+3
-1
未找到文件。
src/share/vm/memory/metaspace.cpp
浏览文件 @
a6739905
/*
* Copyright (c) 2011, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
8
, 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
...
...
@@ -154,7 +154,7 @@ class ChunkManager : public CHeapObj<mtInternal> {
// Map a size to a list index assuming that there are lists
// for special, small, medium, and humongous chunks.
static
ChunkIndex
list_index
(
size_t
size
);
ChunkIndex
list_index
(
size_t
size
);
// Remove the chunk from its freelist. It is
// expected to be on one of the _free_chunks[] lists.
...
...
@@ -1752,7 +1752,11 @@ void ChunkManager::locked_print_sum_free_chunks(outputStream* st) {
st
->
print_cr
(
"Sum free chunk total "
SIZE_FORMAT
" count "
SIZE_FORMAT
,
sum_free_chunks
(),
sum_free_chunks_count
());
}
ChunkList
*
ChunkManager
::
free_chunks
(
ChunkIndex
index
)
{
assert
(
index
==
SpecializedIndex
||
index
==
SmallIndex
||
index
==
MediumIndex
,
err_msg
(
"Bad index: %d"
,
(
int
)
index
));
return
&
_free_chunks
[
index
];
}
...
...
@@ -1864,7 +1868,7 @@ Metachunk* ChunkManager::chunk_freelist_allocate(size_t word_size) {
}
assert
((
word_size
<=
chunk
->
word_size
())
||
list_index
(
chunk
->
word_size
(
)
==
HumongousIndex
),
(
list_index
(
chunk
->
word_size
()
)
==
HumongousIndex
),
"Non-humongous variable sized chunk"
);
if
(
TraceMetadataChunkAllocation
)
{
size_t
list_count
;
...
...
@@ -2358,22 +2362,18 @@ const char* SpaceManager::chunk_size_name(ChunkIndex index) const {
}
ChunkIndex
ChunkManager
::
list_index
(
size_t
size
)
{
switch
(
size
)
{
case
SpecializedChunk
:
assert
(
SpecializedChunk
==
ClassSpecializedChunk
,
"Need branch for ClassSpecializedChunk"
);
return
SpecializedIndex
;
case
SmallChunk
:
case
ClassSmallChunk
:
return
SmallIndex
;
case
MediumChunk
:
case
ClassMediumChunk
:
return
MediumIndex
;
default:
assert
(
size
>
MediumChunk
||
size
>
ClassMediumChunk
,
"Not a humongous chunk"
);
return
HumongousIndex
;
if
(
free_chunks
(
SpecializedIndex
)
->
size
()
==
size
)
{
return
SpecializedIndex
;
}
if
(
free_chunks
(
SmallIndex
)
->
size
()
==
size
)
{
return
SmallIndex
;
}
if
(
free_chunks
(
MediumIndex
)
->
size
()
==
size
)
{
return
MediumIndex
;
}
assert
(
size
>
free_chunks
(
MediumIndex
)
->
size
(),
"Not a humongous chunk"
);
return
HumongousIndex
;
}
void
SpaceManager
::
deallocate
(
MetaWord
*
p
,
size_t
word_size
)
{
...
...
@@ -2395,7 +2395,7 @@ void SpaceManager::add_chunk(Metachunk* new_chunk, bool make_current) {
// Find the correct list and and set the current
// chunk for that list.
ChunkIndex
index
=
ChunkManager
::
list_index
(
new_chunk
->
word_size
());
ChunkIndex
index
=
chunk_manager
()
->
list_index
(
new_chunk
->
word_size
());
if
(
index
!=
HumongousIndex
)
{
retire_current_chunk
();
...
...
@@ -4031,4 +4031,40 @@ void SpaceManager_test_adjust_initial_chunk_size() {
SpaceManagerTest
::
test_adjust_initial_chunk_size
();
}
// The following test is placed here instead of a gtest / unittest file
// because the ChunkManager class is only available in this file.
void
ChunkManager_test_list_index
()
{
ChunkManager
manager
(
ClassSpecializedChunk
,
ClassSmallChunk
,
ClassMediumChunk
);
// Test previous bug where a query for a humongous class metachunk,
// incorrectly matched the non-class medium metachunk size.
{
assert
(
MediumChunk
>
ClassMediumChunk
,
"Precondition for test"
);
ChunkIndex
index
=
manager
.
list_index
(
MediumChunk
);
assert
(
index
==
HumongousIndex
,
err_msg
(
"Requested size is larger than ClassMediumChunk,"
" so should return HumongousIndex. Got index: %d"
,
(
int
)
index
));
}
// Check the specified sizes as well.
{
ChunkIndex
index
=
manager
.
list_index
(
ClassSpecializedChunk
);
assert
(
index
==
SpecializedIndex
,
err_msg
(
"Wrong index returned. Got index: %d"
,
(
int
)
index
));
}
{
ChunkIndex
index
=
manager
.
list_index
(
ClassSmallChunk
);
assert
(
index
==
SmallIndex
,
err_msg
(
"Wrong index returned. Got index: %d"
,
(
int
)
index
));
}
{
ChunkIndex
index
=
manager
.
list_index
(
ClassMediumChunk
);
assert
(
index
==
MediumIndex
,
err_msg
(
"Wrong index returned. Got index: %d"
,
(
int
)
index
));
}
{
ChunkIndex
index
=
manager
.
list_index
(
ClassMediumChunk
+
1
);
assert
(
index
==
HumongousIndex
,
err_msg
(
"Wrong index returned. Got index: %d"
,
(
int
)
index
));
}
}
#endif
src/share/vm/prims/jni.cpp
浏览文件 @
a6739905
/*
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
...
...
@@ -5106,6 +5106,7 @@ void TestG1BiasedArray_test();
void
TestBufferingOopClosure_test
();
void
TestCodeCacheRemSet_test
();
void
FreeRegionList_test
();
void
ChunkManager_test_list_index
();
#endif
void
execute_internal_vm_tests
()
{
...
...
@@ -5139,6 +5140,7 @@ void execute_internal_vm_tests() {
run_unit_test
(
TestG1BiasedArray_test
());
run_unit_test
(
HeapRegionRemSet
::
test_prt
());
run_unit_test
(
SpaceManager_test_adjust_initial_chunk_size
());
run_unit_test
(
ChunkManager_test_list_index
());
run_unit_test
(
TestBufferingOopClosure_test
());
run_unit_test
(
TestCodeCacheRemSet_test
());
if
(
UseG1GC
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录