Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
0d19cf96
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看板
提交
0d19cf96
编写于
2月 12, 2019
作者:
S
shade
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8211926: Catastrophic size_t underflow in BitMap::*_large methods
Reviewed-by: kbarrett, stuefe
上级
4012d550
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
6 deletion
+28
-6
src/share/vm/utilities/bitMap.cpp
src/share/vm/utilities/bitMap.cpp
+20
-6
src/share/vm/utilities/bitMap.hpp
src/share/vm/utilities/bitMap.hpp
+6
-0
src/share/vm/utilities/bitMap.inline.hpp
src/share/vm/utilities/bitMap.inline.hpp
+2
-0
未找到文件。
src/share/vm/utilities/bitMap.cpp
浏览文件 @
0d19cf96
...
...
@@ -154,14 +154,24 @@ void BitMap::clear_range(idx_t beg, idx_t end) {
}
}
bool
BitMap
::
is_small_range_of_words
(
idx_t
beg_full_word
,
idx_t
end_full_word
)
{
// There is little point to call large version on small ranges.
// Need to check carefully, keeping potential idx_t underflow in mind.
// The threshold should be at least one word.
STATIC_ASSERT
(
small_range_words
>=
1
);
return
(
beg_full_word
+
small_range_words
>=
end_full_word
);
}
void
BitMap
::
set_large_range
(
idx_t
beg
,
idx_t
end
)
{
verify_range
(
beg
,
end
);
idx_t
beg_full_word
=
word_index_round_up
(
beg
);
idx_t
end_full_word
=
word_index
(
end
);
assert
(
end_full_word
-
beg_full_word
>=
32
,
"the range must include at least 32 bytes"
);
if
(
is_small_range_of_words
(
beg_full_word
,
end_full_word
))
{
set_range
(
beg
,
end
);
return
;
}
// The range includes at least one full word.
set_range_within_word
(
beg
,
bit_index
(
beg_full_word
));
...
...
@@ -175,8 +185,10 @@ void BitMap::clear_large_range(idx_t beg, idx_t end) {
idx_t
beg_full_word
=
word_index_round_up
(
beg
);
idx_t
end_full_word
=
word_index
(
end
);
assert
(
end_full_word
-
beg_full_word
>=
32
,
"the range must include at least 32 bytes"
);
if
(
is_small_range_of_words
(
beg_full_word
,
end_full_word
))
{
clear_range
(
beg
,
end
);
return
;
}
// The range includes at least one full word.
clear_range_within_word
(
beg
,
bit_index
(
beg_full_word
));
...
...
@@ -264,8 +276,10 @@ void BitMap::par_at_put_large_range(idx_t beg, idx_t end, bool value) {
idx_t
beg_full_word
=
word_index_round_up
(
beg
);
idx_t
end_full_word
=
word_index
(
end
);
assert
(
end_full_word
-
beg_full_word
>=
32
,
"the range must include at least 32 bytes"
);
if
(
is_small_range_of_words
(
beg_full_word
,
end_full_word
))
{
par_at_put_range
(
beg
,
end
,
value
);
return
;
}
// The range includes at least one full word.
par_put_range_within_word
(
beg
,
bit_index
(
beg_full_word
),
value
);
...
...
src/share/vm/utilities/bitMap.hpp
浏览文件 @
0d19cf96
...
...
@@ -56,6 +56,10 @@ class BitMap VALUE_OBJ_CLASS_SPEC {
// the bitmap appropriately if needed using factor-of-two expansion.
void
at_put_grow
(
idx_t
index
,
bool
value
);
// Threshold for performing small range operation, even when large range
// operation was requested. Measured in words.
static
const
size_t
small_range_words
=
32
;
protected:
// Return the position of bit within the word that contains it (e.g., if
// bitmap words are 32 bits, return a number 0 <= n <= 31).
...
...
@@ -97,6 +101,8 @@ class BitMap VALUE_OBJ_CLASS_SPEC {
void
set_large_range_of_words
(
idx_t
beg
,
idx_t
end
);
void
clear_large_range_of_words
(
idx_t
beg
,
idx_t
end
);
static
bool
is_small_range_of_words
(
idx_t
beg_full_word
,
idx_t
end_full_word
);
// The index of the first full word in a range.
idx_t
word_index_round_up
(
idx_t
bit
)
const
;
...
...
src/share/vm/utilities/bitMap.inline.hpp
浏览文件 @
0d19cf96
...
...
@@ -321,10 +321,12 @@ BitMap::inverted_bit_mask_for_range(idx_t beg, idx_t end) const {
}
inline
void
BitMap
::
set_large_range_of_words
(
idx_t
beg
,
idx_t
end
)
{
assert
(
beg
<=
end
,
"underflow"
);
memset
(
_map
+
beg
,
~
(
unsigned
char
)
0
,
(
end
-
beg
)
*
sizeof
(
uintptr_t
));
}
inline
void
BitMap
::
clear_large_range_of_words
(
idx_t
beg
,
idx_t
end
)
{
assert
(
beg
<=
end
,
"underflow"
);
memset
(
_map
+
beg
,
0
,
(
end
-
beg
)
*
sizeof
(
uintptr_t
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录