Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
ab0c41c5
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看板
提交
ab0c41c5
编写于
8月 26, 2014
作者:
T
tschatzl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8054819: Rename HeapRegionSeq to HeapRegionManager
Reviewed-by: jwilhelm, jmasa
上级
e11edb65
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
206 addition
and
206 deletion
+206
-206
agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java
...sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java
+10
-10
agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionManager.java
...n/jvm/hotspot/gc_implementation/g1/HeapRegionManager.java
+5
-5
src/share/vm/gc_implementation/g1/concurrentMark.cpp
src/share/vm/gc_implementation/g1/concurrentMark.cpp
+8
-8
src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp
src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp
+1
-1
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+63
-63
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+12
-12
src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
+5
-5
src/share/vm/gc_implementation/g1/g1RemSet.cpp
src/share/vm/gc_implementation/g1/g1RemSet.cpp
+1
-1
src/share/vm/gc_implementation/g1/heapRegion.cpp
src/share/vm/gc_implementation/g1/heapRegion.cpp
+3
-3
src/share/vm/gc_implementation/g1/heapRegion.hpp
src/share/vm/gc_implementation/g1/heapRegion.hpp
+9
-9
src/share/vm/gc_implementation/g1/heapRegionManager.cpp
src/share/vm/gc_implementation/g1/heapRegionManager.cpp
+27
-27
src/share/vm/gc_implementation/g1/heapRegionManager.hpp
src/share/vm/gc_implementation/g1/heapRegionManager.hpp
+12
-12
src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp
...hare/vm/gc_implementation/g1/heapRegionManager.inline.hpp
+9
-9
src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
+16
-16
src/share/vm/gc_implementation/g1/heapRegionSet.cpp
src/share/vm/gc_implementation/g1/heapRegionSet.cpp
+10
-10
src/share/vm/gc_implementation/g1/heapRegionSet.hpp
src/share/vm/gc_implementation/g1/heapRegionSet.hpp
+2
-2
src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp
src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp
+2
-2
src/share/vm/gc_implementation/g1/sparsePRT.cpp
src/share/vm/gc_implementation/g1/sparsePRT.cpp
+2
-2
src/share/vm/gc_implementation/g1/vmStructs_g1.hpp
src/share/vm/gc_implementation/g1/vmStructs_g1.hpp
+5
-5
src/share/vm/oops/instanceKlass.cpp
src/share/vm/oops/instanceKlass.cpp
+1
-1
src/share/vm/oops/instanceMirrorKlass.cpp
src/share/vm/oops/instanceMirrorKlass.cpp
+1
-1
src/share/vm/oops/instanceRefKlass.cpp
src/share/vm/oops/instanceRefKlass.cpp
+1
-1
src/share/vm/oops/objArrayKlass.cpp
src/share/vm/oops/objArrayKlass.cpp
+1
-1
未找到文件。
agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java
浏览文件 @
ab0c41c5
...
...
@@ -43,8 +43,8 @@ import sun.jvm.hotspot.types.TypeDataBase;
// Mirror class for G1CollectedHeap.
public
class
G1CollectedHeap
extends
SharedHeap
{
// HeapRegion
Seq _seq
;
static
private
long
hr
s
FieldOffset
;
// HeapRegion
Manager _hrm
;
static
private
long
hr
m
FieldOffset
;
// MemRegion _g1_reserved;
static
private
long
g1ReservedFieldOffset
;
// size_t _summary_bytes_used;
...
...
@@ -67,7 +67,7 @@ public class G1CollectedHeap extends SharedHeap {
static
private
synchronized
void
initialize
(
TypeDataBase
db
)
{
Type
type
=
db
.
lookupType
(
"G1CollectedHeap"
);
hr
sFieldOffset
=
type
.
getField
(
"_hrs
"
).
getOffset
();
hr
mFieldOffset
=
type
.
getField
(
"_hrm
"
).
getOffset
();
summaryBytesUsedField
=
type
.
getCIntegerField
(
"_summary_bytes_used"
);
g1mmField
=
type
.
getAddressField
(
"_g1mm"
);
oldSetFieldOffset
=
type
.
getField
(
"_old_set"
).
getOffset
();
...
...
@@ -75,7 +75,7 @@ public class G1CollectedHeap extends SharedHeap {
}
public
long
capacity
()
{
return
hr
s
().
capacity
();
return
hr
m
().
capacity
();
}
public
long
used
()
{
...
...
@@ -83,13 +83,13 @@ public class G1CollectedHeap extends SharedHeap {
}
public
long
n_regions
()
{
return
hr
s
().
length
();
return
hr
m
().
length
();
}
private
HeapRegion
Seq
hrs
()
{
Address
hr
sAddr
=
addr
.
addOffsetTo
(
hrs
FieldOffset
);
return
(
HeapRegion
Seq
)
VMObjectFactory
.
newObject
(
HeapRegionSeq
.
class
,
hr
s
Addr
);
private
HeapRegion
Manager
hrm
()
{
Address
hr
mAddr
=
addr
.
addOffsetTo
(
hrm
FieldOffset
);
return
(
HeapRegion
Manager
)
VMObjectFactory
.
newObject
(
HeapRegionManager
.
class
,
hr
m
Addr
);
}
public
G1MonitoringSupport
g1mm
()
{
...
...
@@ -110,7 +110,7 @@ public class G1CollectedHeap extends SharedHeap {
}
private
Iterator
<
HeapRegion
>
heapRegionIterator
()
{
return
hr
s
().
heapRegionIterator
();
return
hr
m
().
heapRegionIterator
();
}
public
void
heapRegionIterate
(
SpaceClosure
scl
)
{
...
...
agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegion
Seq
.java
→
agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegion
Manager
.java
浏览文件 @
ab0c41c5
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -37,9 +37,9 @@ import sun.jvm.hotspot.types.CIntegerField;
import
sun.jvm.hotspot.types.Type
;
import
sun.jvm.hotspot.types.TypeDataBase
;
// Mirror class for HeapRegion
Seq. It essentially encapsulates the G1HeapRegionTable
.
// Mirror class for HeapRegion
Manager
.
public
class
HeapRegion
Seq
extends
VMObject
{
public
class
HeapRegion
Manager
extends
VMObject
{
// G1HeapRegionTable _regions
static
private
long
regionsFieldOffset
;
// uint _committed_length
...
...
@@ -54,7 +54,7 @@ public class HeapRegionSeq extends VMObject {
}
static
private
synchronized
void
initialize
(
TypeDataBase
db
)
{
Type
type
=
db
.
lookupType
(
"HeapRegion
Seq
"
);
Type
type
=
db
.
lookupType
(
"HeapRegion
Manager
"
);
regionsFieldOffset
=
type
.
getField
(
"_regions"
).
getOffset
();
numCommittedField
=
type
.
getCIntegerField
(
"_num_committed"
);
...
...
@@ -82,7 +82,7 @@ public class HeapRegionSeq extends VMObject {
return
regions
().
heapRegionIterator
(
length
());
}
public
HeapRegion
Seq
(
Address
addr
)
{
public
HeapRegion
Manager
(
Address
addr
)
{
super
(
addr
);
}
}
src/share/vm/gc_implementation/g1/concurrentMark.cpp
浏览文件 @
ab0c41c5
...
...
@@ -34,8 +34,8 @@
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.hpp"
#include "gc_implementation/g1/heapRegion.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
#include "gc_implementation/shared/vmGCOperations.hpp"
#include "gc_implementation/shared/gcTimer.hpp"
...
...
@@ -1408,7 +1408,7 @@ protected:
void
set_bit_for_region
(
HeapRegion
*
hr
)
{
assert
(
!
hr
->
continuesHumongous
(),
"should have filtered those out"
);
BitMap
::
idx_t
index
=
(
BitMap
::
idx_t
)
hr
->
hr
s
_index
();
BitMap
::
idx_t
index
=
(
BitMap
::
idx_t
)
hr
->
hr
m
_index
();
if
(
!
hr
->
startsHumongous
())
{
// Normal (non-humongous) case: just set the bit.
_region_bm
->
par_at_put
(
index
,
true
);
...
...
@@ -1596,7 +1596,7 @@ public:
if
(
_verbose
)
{
gclog_or_tty
->
print_cr
(
"Region %u: marked bytes mismatch: "
"expected: "
SIZE_FORMAT
", actual: "
SIZE_FORMAT
,
hr
->
hr
s
_index
(),
exp_marked_bytes
,
act_marked_bytes
);
hr
->
hr
m
_index
(),
exp_marked_bytes
,
act_marked_bytes
);
}
failures
+=
1
;
}
...
...
@@ -1605,7 +1605,7 @@ public:
// (which was just calculated) region bit maps.
// We're not OK if the bit in the calculated expected region
// bitmap is set and the bit in the actual region bitmap is not.
BitMap
::
idx_t
index
=
(
BitMap
::
idx_t
)
hr
->
hr
s
_index
();
BitMap
::
idx_t
index
=
(
BitMap
::
idx_t
)
hr
->
hr
m
_index
();
bool
expected
=
_exp_region_bm
->
at
(
index
);
bool
actual
=
_region_bm
->
at
(
index
);
...
...
@@ -1613,7 +1613,7 @@ public:
if
(
_verbose
)
{
gclog_or_tty
->
print_cr
(
"Region %u: region bitmap mismatch: "
"expected: %s, actual: %s"
,
hr
->
hr
s
_index
(),
hr
->
hr
m
_index
(),
BOOL_TO_STR
(
expected
),
BOOL_TO_STR
(
actual
));
}
failures
+=
1
;
...
...
@@ -1634,7 +1634,7 @@ public:
if
(
_verbose
)
{
gclog_or_tty
->
print_cr
(
"Region %u: card bitmap mismatch at "
SIZE_FORMAT
": "
"expected: %s, actual: %s"
,
hr
->
hr
s
_index
(),
i
,
hr
->
hr
m
_index
(),
i
,
BOOL_TO_STR
(
expected
),
BOOL_TO_STR
(
actual
));
}
failures
+=
1
;
...
...
@@ -3254,7 +3254,7 @@ class AggregateCountDataHRClosure: public HeapRegionClosure {
assert
(
limit_idx
<=
end_idx
,
"or else use atomics"
);
// Aggregate the "stripe" in the count data associated with hr.
uint
hr
s_index
=
hr
->
hrs
_index
();
uint
hr
m_index
=
hr
->
hrm
_index
();
size_t
marked_bytes
=
0
;
for
(
uint
i
=
0
;
i
<
_max_worker_id
;
i
+=
1
)
{
...
...
@@ -3263,7 +3263,7 @@ class AggregateCountDataHRClosure: public HeapRegionClosure {
// Fetch the marked_bytes in this region for task i and
// add it to the running total for this region.
marked_bytes
+=
marked_bytes_array
[
hr
s
_index
];
marked_bytes
+=
marked_bytes_array
[
hr
m
_index
];
// Now union the bitmaps[0,max_worker_id)[start_idx..limit_idx)
// into the global card bitmap.
...
...
src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp
浏览文件 @
ab0c41c5
...
...
@@ -86,7 +86,7 @@ inline void ConcurrentMark::count_region(MemRegion mr, HeapRegion* hr,
HeapWord
*
start
=
mr
.
start
();
HeapWord
*
end
=
mr
.
end
();
size_t
region_size_bytes
=
mr
.
byte_size
();
uint
index
=
hr
->
hr
s
_index
();
uint
index
=
hr
->
hr
m
_index
();
assert
(
!
hr
->
continuesHumongous
(),
"should not be HC region"
);
assert
(
hr
==
g1h
->
heap_region_containing
(
start
),
"sanity"
);
...
...
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
浏览文件 @
ab0c41c5
...
...
@@ -528,9 +528,9 @@ G1CollectedHeap::new_region_try_secondary_free_list(bool is_old) {
// again to allocate from it.
append_secondary_free_list
();
assert
(
_hr
s
.
num_free_regions
()
>
0
,
"if the secondary_free_list was not "
assert
(
_hr
m
.
num_free_regions
()
>
0
,
"if the secondary_free_list was not "
"empty we should have moved at least one entry to the free_list"
);
HeapRegion
*
res
=
_hr
s
.
allocate_free_region
(
is_old
);
HeapRegion
*
res
=
_hr
m
.
allocate_free_region
(
is_old
);
if
(
G1ConcRegionFreeingVerbose
)
{
gclog_or_tty
->
print_cr
(
"G1ConcRegionFreeing [region alloc] : "
"allocated "
HR_FORMAT
" from secondary_free_list"
,
...
...
@@ -571,7 +571,7 @@ HeapRegion* G1CollectedHeap::new_region(size_t word_size, bool is_old, bool do_e
}
}
res
=
_hr
s
.
allocate_free_region
(
is_old
);
res
=
_hr
m
.
allocate_free_region
(
is_old
);
if
(
res
==
NULL
)
{
if
(
G1ConcRegionFreeingVerbose
)
{
...
...
@@ -597,7 +597,7 @@ HeapRegion* G1CollectedHeap::new_region(size_t word_size, bool is_old, bool do_e
// always expand the heap by an amount aligned to the heap
// region size, the free list should in theory not be empty.
// In either case allocate_free_region() will check for NULL.
res
=
_hr
s
.
allocate_free_region
(
is_old
);
res
=
_hr
m
.
allocate_free_region
(
is_old
);
}
else
{
_expand_heap_after_alloc_failure
=
false
;
}
...
...
@@ -609,7 +609,7 @@ HeapWord*
G1CollectedHeap
::
humongous_obj_allocate_initialize_regions
(
uint
first
,
uint
num_regions
,
size_t
word_size
)
{
assert
(
first
!=
G1_NO_HR
S
_INDEX
,
"pre-condition"
);
assert
(
first
!=
G1_NO_HR
M
_INDEX
,
"pre-condition"
);
assert
(
isHumongous
(
word_size
),
"word_size should be humongous"
);
assert
(
num_regions
*
HeapRegion
::
GrainWords
>=
word_size
,
"pre-condition"
);
...
...
@@ -747,7 +747,7 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
verify_region_sets_optional
();
uint
first
=
G1_NO_HR
S
_INDEX
;
uint
first
=
G1_NO_HR
M
_INDEX
;
uint
obj_regions
=
(
uint
)(
align_size_up_
(
word_size
,
HeapRegion
::
GrainWords
)
/
HeapRegion
::
GrainWords
);
if
(
obj_regions
==
1
)
{
...
...
@@ -756,7 +756,7 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
// later.
HeapRegion
*
hr
=
new_region
(
word_size
,
true
/* is_old */
,
false
/* do_expand */
);
if
(
hr
!=
NULL
)
{
first
=
hr
->
hr
s
_index
();
first
=
hr
->
hr
m
_index
();
}
}
else
{
// We can't allocate humongous regions spanning more than one region while
...
...
@@ -772,18 +772,18 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
// Policy: Try only empty regions (i.e. already committed first). Maybe we
// are lucky enough to find some.
first
=
_hr
s
.
find_contiguous_only_empty
(
obj_regions
);
if
(
first
!=
G1_NO_HR
S
_INDEX
)
{
_hr
s
.
allocate_free_regions_starting_at
(
first
,
obj_regions
);
first
=
_hr
m
.
find_contiguous_only_empty
(
obj_regions
);
if
(
first
!=
G1_NO_HR
M
_INDEX
)
{
_hr
m
.
allocate_free_regions_starting_at
(
first
,
obj_regions
);
}
}
if
(
first
==
G1_NO_HR
S
_INDEX
)
{
if
(
first
==
G1_NO_HR
M
_INDEX
)
{
// Policy: We could not find enough regions for the humongous object in the
// free list. Look through the heap to find a mix of free and uncommitted regions.
// If so, try expansion.
first
=
_hr
s
.
find_contiguous_empty_or_unavailable
(
obj_regions
);
if
(
first
!=
G1_NO_HR
S
_INDEX
)
{
first
=
_hr
m
.
find_contiguous_empty_or_unavailable
(
obj_regions
);
if
(
first
!=
G1_NO_HR
M
_INDEX
)
{
// We found something. Make sure these regions are committed, i.e. expand
// the heap. Alternatively we could do a defragmentation GC.
ergo_verbose1
(
ErgoHeapSizing
,
...
...
@@ -792,7 +792,7 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
ergo_format_byte
(
"allocation request"
),
word_size
*
HeapWordSize
);
_hr
s
.
expand_at
(
first
,
obj_regions
);
_hr
m
.
expand_at
(
first
,
obj_regions
);
g1_policy
()
->
record_new_heap_size
(
num_regions
());
#ifdef ASSERT
...
...
@@ -802,14 +802,14 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
assert
(
is_on_master_free_list
(
hr
),
"sanity"
);
}
#endif
_hr
s
.
allocate_free_regions_starting_at
(
first
,
obj_regions
);
_hr
m
.
allocate_free_regions_starting_at
(
first
,
obj_regions
);
}
else
{
// Policy: Potentially trigger a defragmentation GC.
}
}
HeapWord
*
result
=
NULL
;
if
(
first
!=
G1_NO_HR
S
_INDEX
)
{
if
(
first
!=
G1_NO_HR
M
_INDEX
)
{
result
=
humongous_obj_allocate_initialize_regions
(
first
,
obj_regions
,
word_size
);
assert
(
result
!=
NULL
,
"it should always return a valid result"
);
...
...
@@ -1244,7 +1244,7 @@ public:
:
_hr_printer
(
hr_printer
)
{
}
};
void
G1CollectedHeap
::
print_hr
s
_post_compaction
()
{
void
G1CollectedHeap
::
print_hr
m
_post_compaction
()
{
PostCompactionPrinterClosure
cl
(
hr_printer
());
heap_region_iterate
(
&
cl
);
}
...
...
@@ -1413,7 +1413,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
// that all the COMMIT / UNCOMMIT events are generated before
// the end GC event.
print_hr
s
_post_compaction
();
print_hr
m
_post_compaction
();
_hr_printer
.
end_gc
(
true
/* full */
,
(
size_t
)
total_collections
());
}
...
...
@@ -1486,7 +1486,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
// Update the number of full collections that have been completed.
increment_old_marking_cycles_completed
(
false
/* concurrent */
);
_hr
s
.
verify_optional
();
_hr
m
.
verify_optional
();
verify_region_sets_optional
();
verify_after_gc
();
...
...
@@ -1730,7 +1730,7 @@ HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {
ergo_format_byte
(
"allocation request"
),
word_size
*
HeapWordSize
);
if
(
expand
(
expand_bytes
))
{
_hr
s
.
verify_optional
();
_hr
m
.
verify_optional
();
verify_region_sets_optional
();
return
attempt_allocation_at_safepoint
(
word_size
,
false
/* expect_null_mutator_alloc_region */
);
...
...
@@ -1758,7 +1758,7 @@ bool G1CollectedHeap::expand(size_t expand_bytes) {
uint
regions_to_expand
=
(
uint
)(
aligned_expand_bytes
/
HeapRegion
::
GrainBytes
);
assert
(
regions_to_expand
>
0
,
"Must expand by at least one region"
);
uint
expanded_by
=
_hr
s
.
expand_by
(
regions_to_expand
);
uint
expanded_by
=
_hr
m
.
expand_by
(
regions_to_expand
);
if
(
expanded_by
>
0
)
{
size_t
actual_expand_bytes
=
expanded_by
*
HeapRegion
::
GrainBytes
;
...
...
@@ -1771,7 +1771,7 @@ bool G1CollectedHeap::expand(size_t expand_bytes) {
// The expansion of the virtual storage space was unsuccessful.
// Let's see if it was because we ran out of swap.
if
(
G1ExitOnExpansionFailure
&&
_hr
s
.
available
()
>=
regions_to_expand
)
{
_hr
m
.
available
()
>=
regions_to_expand
)
{
// We had head room...
vm_exit_out_of_memory
(
aligned_expand_bytes
,
OOM_MMAP_ERROR
,
"G1 heap expansion"
);
}
...
...
@@ -1786,7 +1786,7 @@ void G1CollectedHeap::shrink_helper(size_t shrink_bytes) {
HeapRegion
::
GrainBytes
);
uint
num_regions_to_remove
=
(
uint
)(
shrink_bytes
/
HeapRegion
::
GrainBytes
);
uint
num_regions_removed
=
_hr
s
.
shrink_by
(
num_regions_to_remove
);
uint
num_regions_removed
=
_hr
m
.
shrink_by
(
num_regions_to_remove
);
size_t
shrunk_bytes
=
num_regions_removed
*
HeapRegion
::
GrainBytes
;
ergo_verbose3
(
ErgoHeapSizing
,
...
...
@@ -1819,7 +1819,7 @@ void G1CollectedHeap::shrink(size_t shrink_bytes) {
shrink_helper
(
shrink_bytes
);
rebuild_region_sets
(
true
/* free_list_only */
);
_hr
s
.
verify_optional
();
_hr
m
.
verify_optional
();
verify_region_sets_optional
();
}
...
...
@@ -2028,7 +2028,7 @@ jint G1CollectedHeap::initialize() {
CMBitMap
::
mark_distance
(),
mtGC
);
_hr
s
.
initialize
(
heap_storage
,
prev_bitmap_storage
,
next_bitmap_storage
,
bot_storage
,
cardtable_storage
,
card_counts_storage
);
_hr
m
.
initialize
(
heap_storage
,
prev_bitmap_storage
,
next_bitmap_storage
,
bot_storage
,
cardtable_storage
,
card_counts_storage
);
g1_barrier_set
()
->
initialize
(
cardtable_storage
);
// Do later initialization work for concurrent refinement.
_cg1r
->
init
(
card_counts_storage
);
...
...
@@ -2049,8 +2049,8 @@ jint G1CollectedHeap::initialize() {
_g1h
=
this
;
_in_cset_fast_test
.
initialize
(
_hr
s
.
reserved
().
start
(),
_hrs
.
reserved
().
end
(),
HeapRegion
::
GrainBytes
);
_humongous_is_live
.
initialize
(
_hr
s
.
reserved
().
start
(),
_hrs
.
reserved
().
end
(),
HeapRegion
::
GrainBytes
);
_in_cset_fast_test
.
initialize
(
_hr
m
.
reserved
().
start
(),
_hrm
.
reserved
().
end
(),
HeapRegion
::
GrainBytes
);
_humongous_is_live
.
initialize
(
_hr
m
.
reserved
().
start
(),
_hrm
.
reserved
().
end
(),
HeapRegion
::
GrainBytes
);
// Create the ConcurrentMark data structure and thread.
// (Must do this late, so that "max_regions" is defined.)
...
...
@@ -2111,7 +2111,7 @@ jint G1CollectedHeap::initialize() {
// Here we allocate the dummy HeapRegion that is required by the
// G1AllocRegion class.
HeapRegion
*
dummy_region
=
_hr
s
.
get_dummy_region
();
HeapRegion
*
dummy_region
=
_hr
m
.
get_dummy_region
();
// We'll re-use the same region whether the alloc region will
// require BOT updates or not and, if it doesn't, then a non-young
...
...
@@ -2228,14 +2228,14 @@ void G1CollectedHeap::ref_processing_init() {
}
size_t
G1CollectedHeap
::
capacity
()
const
{
return
_hr
s
.
length
()
*
HeapRegion
::
GrainBytes
;
return
_hr
m
.
length
()
*
HeapRegion
::
GrainBytes
;
}
void
G1CollectedHeap
::
reset_gc_time_stamps
(
HeapRegion
*
hr
)
{
assert
(
!
hr
->
continuesHumongous
(),
"pre-condition"
);
hr
->
reset_gc_time_stamp
();
if
(
hr
->
startsHumongous
())
{
uint
first_index
=
hr
->
hr
s
_index
()
+
1
;
uint
first_index
=
hr
->
hr
m
_index
()
+
1
;
uint
last_index
=
hr
->
last_hc_index
();
for
(
uint
i
=
first_index
;
i
<
last_index
;
i
+=
1
)
{
HeapRegion
*
chr
=
region_at
(
i
);
...
...
@@ -2533,7 +2533,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
}
bool
G1CollectedHeap
::
is_in
(
const
void
*
p
)
const
{
if
(
_hr
s
.
reserved
().
contains
(
p
))
{
if
(
_hr
m
.
reserved
().
contains
(
p
))
{
// Given that we know that p is in the reserved space,
// heap_region_containing_raw() should successfully
// return the containing region.
...
...
@@ -2547,7 +2547,7 @@ bool G1CollectedHeap::is_in(const void* p) const {
#ifdef ASSERT
bool
G1CollectedHeap
::
is_in_exact
(
const
void
*
p
)
const
{
bool
contains
=
reserved_region
().
contains
(
p
);
bool
available
=
_hr
s
.
is_available
(
addr_to_region
((
HeapWord
*
)
p
));
bool
available
=
_hr
m
.
is_available
(
addr_to_region
((
HeapWord
*
)
p
));
if
(
contains
&&
available
)
{
return
true
;
}
else
{
...
...
@@ -2614,7 +2614,7 @@ void G1CollectedHeap::space_iterate(SpaceClosure* cl) {
}
void
G1CollectedHeap
::
heap_region_iterate
(
HeapRegionClosure
*
cl
)
const
{
_hr
s
.
iterate
(
cl
);
_hr
m
.
iterate
(
cl
);
}
void
...
...
@@ -2622,7 +2622,7 @@ G1CollectedHeap::heap_region_par_iterate_chunked(HeapRegionClosure* cl,
uint
worker_id
,
uint
num_workers
,
jint
claim_value
)
const
{
_hr
s
.
par_iterate
(
cl
,
worker_id
,
num_workers
,
claim_value
);
_hr
m
.
par_iterate
(
cl
,
worker_id
,
num_workers
,
claim_value
);
}
class
ResetClaimValuesClosure
:
public
HeapRegionClosure
{
...
...
@@ -2842,9 +2842,9 @@ void G1CollectedHeap::collection_set_iterate_from(HeapRegion* r,
}
HeapRegion
*
G1CollectedHeap
::
next_compaction_region
(
const
HeapRegion
*
from
)
const
{
HeapRegion
*
result
=
_hr
s
.
next_region_in_heap
(
from
);
HeapRegion
*
result
=
_hr
m
.
next_region_in_heap
(
from
);
while
(
result
!=
NULL
&&
result
->
isHumongous
())
{
result
=
_hr
s
.
next_region_in_heap
(
result
);
result
=
_hr
m
.
next_region_in_heap
(
result
);
}
return
result
;
}
...
...
@@ -2904,7 +2904,7 @@ size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
}
size_t
G1CollectedHeap
::
max_capacity
()
const
{
return
_hr
s
.
reserved
().
byte_size
();
return
_hr
m
.
reserved
().
byte_size
();
}
jlong
G1CollectedHeap
::
millis_since_last_gc
()
{
...
...
@@ -3433,9 +3433,9 @@ void G1CollectedHeap::print_on(outputStream* st) const {
st
->
print
(
" total "
SIZE_FORMAT
"K, used "
SIZE_FORMAT
"K"
,
capacity
()
/
K
,
used_unlocked
()
/
K
);
st
->
print
(
" ["
INTPTR_FORMAT
", "
INTPTR_FORMAT
", "
INTPTR_FORMAT
")"
,
_hr
s
.
reserved
().
start
(),
_hr
s
.
reserved
().
start
()
+
_hrs
.
length
()
+
HeapRegion
::
GrainWords
,
_hr
s
.
reserved
().
end
());
_hr
m
.
reserved
().
start
(),
_hr
m
.
reserved
().
start
()
+
_hrm
.
length
()
+
HeapRegion
::
GrainWords
,
_hr
m
.
reserved
().
end
());
st
->
cr
();
st
->
print
(
" region size "
SIZE_FORMAT
"K, "
,
HeapRegion
::
GrainBytes
/
K
);
uint
young_regions
=
_young_list
->
length
();
...
...
@@ -3678,7 +3678,7 @@ class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
}
G1CollectedHeap
*
g1h
=
G1CollectedHeap
::
heap
();
uint
region_idx
=
r
->
hr
s
_index
();
uint
region_idx
=
r
->
hr
m
_index
();
bool
is_candidate
=
!
g1h
->
humongous_region_is_always_live
(
region_idx
);
// Is_candidate already filters out humongous regions with some remembered set.
// This will not lead to humongous object that we mistakenly keep alive because
...
...
@@ -4200,7 +4200,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
// output from the concurrent mark thread interfering with this
// logging output either.
_hr
s
.
verify_optional
();
_hr
m
.
verify_optional
();
verify_region_sets_optional
();
TASKQUEUE_STATS_ONLY
(
if
(
ParallelGCVerbose
)
print_taskqueue_stats
());
...
...
@@ -6019,7 +6019,7 @@ void G1CollectedHeap::free_region(HeapRegion* hr,
bool
locked
)
{
assert
(
!
hr
->
isHumongous
(),
"this is only for non-humongous regions"
);
assert
(
!
hr
->
is_empty
(),
"the region should not be empty"
);
assert
(
_hr
s
.
is_available
(
hr
->
hrs
_index
()),
"region should be committed"
);
assert
(
_hr
m
.
is_available
(
hr
->
hrm
_index
()),
"region should be committed"
);
assert
(
free_list
!=
NULL
,
"pre-condition"
);
if
(
G1VerifyBitmaps
)
{
...
...
@@ -6050,7 +6050,7 @@ void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
hr
->
set_notHumongous
();
free_region
(
hr
,
free_list
,
par
);
uint
i
=
hr
->
hr
s
_index
()
+
1
;
uint
i
=
hr
->
hr
m
_index
()
+
1
;
while
(
i
<
last_index
)
{
HeapRegion
*
curr_hr
=
region_at
(
i
);
assert
(
curr_hr
->
continuesHumongous
(),
"invariant"
);
...
...
@@ -6074,7 +6074,7 @@ void G1CollectedHeap::prepend_to_freelist(FreeRegionList* list) {
assert
(
list
!=
NULL
,
"list can't be null"
);
if
(
!
list
->
is_empty
())
{
MutexLockerEx
x
(
FreeList_lock
,
Mutex
::
_no_safepoint_check_flag
);
_hr
s
.
insert_list_into_free_list
(
list
);
_hr
m
.
insert_list_into_free_list
(
list
);
}
}
...
...
@@ -6443,7 +6443,7 @@ class G1FreeHumongousRegionClosure : public HeapRegionClosure {
// While this cleanup is not strictly necessary to be done (or done instantly),
// given that their occurrence is very low, this saves us this additional
// complexity.
uint
region_idx
=
r
->
hr
s
_index
();
uint
region_idx
=
r
->
hr
m
_index
();
if
(
g1h
->
humongous_is_live
(
region_idx
)
||
g1h
->
humongous_region_is_always_live
(
region_idx
))
{
...
...
@@ -6682,22 +6682,22 @@ void G1CollectedHeap::tear_down_region_sets(bool free_list_only) {
// this is that during a full GC string deduplication needs to know if
// a collected region was young or old when the full GC was initiated.
}
_hr
s
.
remove_all_free_regions
();
_hr
m
.
remove_all_free_regions
();
}
class
RebuildRegionSetsClosure
:
public
HeapRegionClosure
{
private:
bool
_free_list_only
;
HeapRegionSet
*
_old_set
;
HeapRegion
Seq
*
_hrs
;
HeapRegion
Manager
*
_hrm
;
size_t
_total_used
;
public:
RebuildRegionSetsClosure
(
bool
free_list_only
,
HeapRegionSet
*
old_set
,
HeapRegion
Seq
*
hrs
)
:
HeapRegionSet
*
old_set
,
HeapRegion
Manager
*
hrm
)
:
_free_list_only
(
free_list_only
),
_old_set
(
old_set
),
_hr
s
(
hrs
),
_total_used
(
0
)
{
assert
(
_hr
s
->
num_free_regions
()
==
0
,
"pre-condition"
);
_old_set
(
old_set
),
_hr
m
(
hrm
),
_total_used
(
0
)
{
assert
(
_hr
m
->
num_free_regions
()
==
0
,
"pre-condition"
);
if
(
!
free_list_only
)
{
assert
(
_old_set
->
is_empty
(),
"pre-condition"
);
}
...
...
@@ -6710,7 +6710,7 @@ public:
if
(
r
->
is_empty
())
{
// Add free regions to the free list
_hr
s
->
insert_into_free_list
(
r
);
_hr
m
->
insert_into_free_list
(
r
);
}
else
if
(
!
_free_list_only
)
{
assert
(
!
r
->
is_young
(),
"we should not come across young regions"
);
...
...
@@ -6738,7 +6738,7 @@ void G1CollectedHeap::rebuild_region_sets(bool free_list_only) {
_young_list
->
empty_list
();
}
RebuildRegionSetsClosure
cl
(
free_list_only
,
&
_old_set
,
&
_hr
s
);
RebuildRegionSetsClosure
cl
(
free_list_only
,
&
_old_set
,
&
_hr
m
);
heap_region_iterate
(
&
cl
);
if
(
!
free_list_only
)
{
...
...
@@ -6928,7 +6928,7 @@ class VerifyRegionListsClosure : public HeapRegionClosure {
private:
HeapRegionSet
*
_old_set
;
HeapRegionSet
*
_humongous_set
;
HeapRegion
Seq
*
_hrs
;
HeapRegion
Manager
*
_hrm
;
public:
HeapRegionSetCount
_old_count
;
...
...
@@ -6937,8 +6937,8 @@ public:
VerifyRegionListsClosure
(
HeapRegionSet
*
old_set
,
HeapRegionSet
*
humongous_set
,
HeapRegion
Seq
*
hrs
)
:
_old_set
(
old_set
),
_humongous_set
(
humongous_set
),
_hr
s
(
hrs
),
HeapRegion
Manager
*
hrm
)
:
_old_set
(
old_set
),
_humongous_set
(
humongous_set
),
_hr
m
(
hrm
),
_old_count
(),
_humongous_count
(),
_free_count
(){
}
bool
doHeapRegion
(
HeapRegion
*
hr
)
{
...
...
@@ -6949,19 +6949,19 @@ public:
if
(
hr
->
is_young
())
{
// TODO
}
else
if
(
hr
->
startsHumongous
())
{
assert
(
hr
->
containing_set
()
==
_humongous_set
,
err_msg
(
"Heap region %u is starts humongous but not in humongous set."
,
hr
->
hr
s
_index
()));
assert
(
hr
->
containing_set
()
==
_humongous_set
,
err_msg
(
"Heap region %u is starts humongous but not in humongous set."
,
hr
->
hr
m
_index
()));
_humongous_count
.
increment
(
1u
,
hr
->
capacity
());
}
else
if
(
hr
->
is_empty
())
{
assert
(
_hr
s
->
is_free
(
hr
),
err_msg
(
"Heap region %u is empty but not on the free list."
,
hr
->
hrs
_index
()));
assert
(
_hr
m
->
is_free
(
hr
),
err_msg
(
"Heap region %u is empty but not on the free list."
,
hr
->
hrm
_index
()));
_free_count
.
increment
(
1u
,
hr
->
capacity
());
}
else
{
assert
(
hr
->
containing_set
()
==
_old_set
,
err_msg
(
"Heap region %u is old but not in the old set."
,
hr
->
hr
s
_index
()));
assert
(
hr
->
containing_set
()
==
_old_set
,
err_msg
(
"Heap region %u is old but not in the old set."
,
hr
->
hr
m
_index
()));
_old_count
.
increment
(
1u
,
hr
->
capacity
());
}
return
false
;
}
void
verify_counts
(
HeapRegionSet
*
old_set
,
HeapRegionSet
*
humongous_set
,
HeapRegion
Seq
*
free_list
)
{
void
verify_counts
(
HeapRegionSet
*
old_set
,
HeapRegionSet
*
humongous_set
,
HeapRegion
Manager
*
free_list
)
{
guarantee
(
old_set
->
length
()
==
_old_count
.
length
(),
err_msg
(
"Old set count mismatch. Expected %u, actual %u."
,
old_set
->
length
(),
_old_count
.
length
()));
guarantee
(
old_set
->
total_capacity_bytes
()
==
_old_count
.
capacity
(),
err_msg
(
"Old set capacity mismatch. Expected "
SIZE_FORMAT
", actual "
SIZE_FORMAT
,
old_set
->
total_capacity_bytes
(),
_old_count
.
capacity
()));
...
...
@@ -6980,7 +6980,7 @@ void G1CollectedHeap::verify_region_sets() {
assert_heap_locked_or_at_safepoint
(
true
/* should_be_vm_thread */
);
// First, check the explicit lists.
_hr
s
.
verify
();
_hr
m
.
verify
();
{
// Given that a concurrent operation might be adding regions to
// the secondary free list we have to take the lock before
...
...
@@ -7011,9 +7011,9 @@ void G1CollectedHeap::verify_region_sets() {
// Finally, make sure that the region accounting in the lists is
// consistent with what we see in the heap.
VerifyRegionListsClosure
cl
(
&
_old_set
,
&
_humongous_set
,
&
_hr
s
);
VerifyRegionListsClosure
cl
(
&
_old_set
,
&
_humongous_set
,
&
_hr
m
);
heap_region_iterate
(
&
cl
);
cl
.
verify_counts
(
&
_old_set
,
&
_humongous_set
,
&
_hr
s
);
cl
.
verify_counts
(
&
_old_set
,
&
_humongous_set
,
&
_hr
m
);
}
// Optimized nmethod scanning
...
...
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
浏览文件 @
ab0c41c5
...
...
@@ -33,7 +33,7 @@
#include "gc_implementation/g1/g1MonitoringSupport.hpp"
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#include "gc_implementation/g1/g1YCTypes.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.hpp"
#include "gc_implementation/g1/heapRegionSet.hpp"
#include "gc_implementation/shared/hSpaceCounters.hpp"
#include "gc_implementation/shared/parGCAllocBuffer.hpp"
...
...
@@ -291,7 +291,7 @@ private:
G1RegionMappingChangedListener
_listener
;
// The sequence of all heap regions in the heap.
HeapRegion
Seq
_hrs
;
HeapRegion
Manager
_hrm
;
// Alloc region used to satisfy mutator allocation requests.
MutatorAllocRegion
_mutator_alloc_region
;
...
...
@@ -429,7 +429,7 @@ private:
// If the HR printer is active, dump the state of the regions in the
// heap after a compaction.
void
print_hr
s
_post_compaction
();
void
print_hr
m
_post_compaction
();
double
verify
(
bool
guard
,
const
char
*
msg
);
void
verify_before_gc
();
...
...
@@ -715,7 +715,7 @@ public:
// We register a region with the fast "in collection set" test. We
// simply set to true the array slot corresponding to this region.
void
register_region_with_in_cset_fast_test
(
HeapRegion
*
r
)
{
_in_cset_fast_test
.
set_in_cset
(
r
->
hr
s
_index
());
_in_cset_fast_test
.
set_in_cset
(
r
->
hr
m
_index
());
}
// This is a fast test on whether a reference points into the
...
...
@@ -1171,17 +1171,17 @@ public:
// But G1CollectedHeap doesn't yet support this.
virtual
bool
is_maximal_no_gc
()
const
{
return
_hr
s
.
available
()
==
0
;
return
_hr
m
.
available
()
==
0
;
}
// The current number of regions in the heap.
uint
num_regions
()
const
{
return
_hr
s
.
length
();
}
uint
num_regions
()
const
{
return
_hr
m
.
length
();
}
// The max number of regions in the heap.
uint
max_regions
()
const
{
return
_hr
s
.
max_length
();
}
uint
max_regions
()
const
{
return
_hr
m
.
max_length
();
}
// The number of regions that are completely free.
uint
num_free_regions
()
const
{
return
_hr
s
.
num_free_regions
();
}
uint
num_free_regions
()
const
{
return
_hr
m
.
num_free_regions
();
}
// The number of regions that are not completely free.
uint
num_used_regions
()
const
{
return
num_regions
()
-
num_free_regions
();
}
...
...
@@ -1233,7 +1233,7 @@ public:
#ifdef ASSERT
bool
is_on_master_free_list
(
HeapRegion
*
hr
)
{
return
_hr
s
.
is_free
(
hr
);
return
_hr
m
.
is_free
(
hr
);
}
#endif // ASSERT
...
...
@@ -1245,7 +1245,7 @@ public:
}
void
append_secondary_free_list
()
{
_hr
s
.
insert_list_into_free_list
(
&
_secondary_free_list
);
_hr
m
.
insert_list_into_free_list
(
&
_secondary_free_list
);
}
void
append_secondary_free_list_if_not_empty_with_lock
()
{
...
...
@@ -1356,13 +1356,13 @@ public:
// Return "TRUE" iff the given object address is in the reserved
// region of g1.
bool
is_in_g1_reserved
(
const
void
*
p
)
const
{
return
_hr
s
.
reserved
().
contains
(
p
);
return
_hr
m
.
reserved
().
contains
(
p
);
}
// Returns a MemRegion that corresponds to the space that has been
// reserved for the heap
MemRegion
g1_reserved
()
const
{
return
_hr
s
.
reserved
();
return
_hr
m
.
reserved
();
}
virtual
bool
is_in_closed_subset
(
const
void
*
p
)
const
;
...
...
src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
浏览文件 @
ab0c41c5
...
...
@@ -30,15 +30,15 @@
#include "gc_implementation/g1/g1AllocRegion.inline.hpp"
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "utilities/taskqueue.hpp"
// Inline functions for G1CollectedHeap
// Return the region with the given index. It assumes the index is valid.
inline
HeapRegion
*
G1CollectedHeap
::
region_at
(
uint
index
)
const
{
return
_hr
s
.
at
(
index
);
}
inline
HeapRegion
*
G1CollectedHeap
::
region_at
(
uint
index
)
const
{
return
_hr
m
.
at
(
index
);
}
inline
uint
G1CollectedHeap
::
addr_to_region
(
HeapWord
*
addr
)
const
{
assert
(
is_in_reserved
(
addr
),
...
...
@@ -48,7 +48,7 @@ inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
}
inline
HeapWord
*
G1CollectedHeap
::
bottom_addr_for_region
(
uint
index
)
const
{
return
_hr
s
.
reserved
().
start
()
+
index
*
HeapRegion
::
GrainWords
;
return
_hr
m
.
reserved
().
start
()
+
index
*
HeapRegion
::
GrainWords
;
}
template
<
class
T
>
...
...
@@ -57,7 +57,7 @@ inline HeapRegion* G1CollectedHeap::heap_region_containing_raw(const T addr) con
assert
(
is_in_g1_reserved
((
const
void
*
)
addr
),
err_msg
(
"Address "
PTR_FORMAT
" is outside of the heap ranging from ["
PTR_FORMAT
" to "
PTR_FORMAT
")"
,
p2i
((
void
*
)
addr
),
p2i
(
g1_reserved
().
start
()),
p2i
(
g1_reserved
().
end
())));
return
_hr
s
.
addr_to_region
((
HeapWord
*
)
addr
);
return
_hr
m
.
addr_to_region
((
HeapWord
*
)
addr
);
}
template
<
class
T
>
...
...
@@ -87,7 +87,7 @@ inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
}
inline
bool
G1CollectedHeap
::
obj_in_cs
(
oop
obj
)
{
HeapRegion
*
r
=
_hr
s
.
addr_to_region
((
HeapWord
*
)
obj
);
HeapRegion
*
r
=
_hr
m
.
addr_to_region
((
HeapWord
*
)
obj
);
return
r
!=
NULL
&&
r
->
in_collection_set
();
}
...
...
src/share/vm/gc_implementation/g1/g1RemSet.cpp
浏览文件 @
ab0c41c5
...
...
@@ -32,7 +32,7 @@
#include "gc_implementation/g1/g1GCPhaseTimes.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "memory/iterator.hpp"
#include "oops/oop.inline.hpp"
...
...
src/share/vm/gc_implementation/g1/heapRegion.cpp
浏览文件 @
ab0c41c5
...
...
@@ -29,7 +29,7 @@
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/heapRegion.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/shared/liveRange.hpp"
#include "memory/genOopClosures.inline.hpp"
#include "memory/iterator.hpp"
...
...
@@ -344,11 +344,11 @@ HeapWord* HeapRegion::next_block_start_careful(HeapWord* addr) {
return
low
;
}
HeapRegion
::
HeapRegion
(
uint
hr
s
_index
,
HeapRegion
::
HeapRegion
(
uint
hr
m
_index
,
G1BlockOffsetSharedArray
*
sharedOffsetArray
,
MemRegion
mr
)
:
G1OffsetTableContigSpace
(
sharedOffsetArray
,
mr
),
_hr
s_index
(
hrs
_index
),
_hr
m_index
(
hrm
_index
),
_humongous_type
(
NotHumongous
),
_humongous_start_region
(
NULL
),
_in_collection_set
(
false
),
_next_in_special_set
(
NULL
),
_orig_end
(
NULL
),
...
...
src/share/vm/gc_implementation/g1/heapRegion.hpp
浏览文件 @
ab0c41c5
...
...
@@ -54,15 +54,15 @@ class nmethod;
#define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
#define HR_FORMAT_PARAMS(_hr_) \
(_hr_)->hr
s
_index(), \
(_hr_)->hr
m
_index(), \
(_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \
(_hr_)->startsHumongous() ? "HS" : \
(_hr_)->continuesHumongous() ? "HC" : \
!(_hr_)->is_empty() ? "O" : "F", \
p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
// sentinel value for hr
s
_index
#define G1_NO_HR
S
_INDEX ((uint) -1)
// sentinel value for hr
m
_index
#define G1_NO_HR
M
_INDEX ((uint) -1)
// A dirty card to oop closure for heap regions. It
// knows how to get the G1 heap and how to use the bitmap
...
...
@@ -234,7 +234,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
protected:
// The index of this region in the heap region sequence.
uint
_hr
s
_index
;
uint
_hr
m
_index
;
HumongousType
_humongous_type
;
// For a humongous region, region in which it starts.
...
...
@@ -330,7 +330,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
size_t
_predicted_bytes_to_copy
;
public:
HeapRegion
(
uint
hr
s
_index
,
HeapRegion
(
uint
hr
m
_index
,
G1BlockOffsetSharedArray
*
sharedOffsetArray
,
MemRegion
mr
);
...
...
@@ -385,9 +385,9 @@ class HeapRegion: public G1OffsetTableContigSpace {
inline
HeapWord
*
par_allocate_no_bot_updates
(
size_t
word_size
);
inline
HeapWord
*
allocate_no_bot_updates
(
size_t
word_size
);
// If this region is a member of a HeapRegion
Seq
, the index in that
// If this region is a member of a HeapRegion
Manager
, the index in that
// sequence, otherwise -1.
uint
hr
s_index
()
const
{
return
_hrs
_index
;
}
uint
hr
m_index
()
const
{
return
_hrm
_index
;
}
// The number of bytes marked live in the region in the last marking phase.
size_t
marked_bytes
()
{
return
_prev_marked_bytes
;
}
...
...
@@ -458,7 +458,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
// with this HS region.
uint
last_hc_index
()
const
{
assert
(
startsHumongous
(),
"don't call this otherwise"
);
return
hr
s
_index
()
+
region_num
();
return
hr
m
_index
()
+
region_num
();
}
// Same as Space::is_in_reserved, but will use the original size of the region.
...
...
@@ -813,7 +813,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
// HeapRegionClosure is used for iterating over regions.
// Terminates the iteration when the "doHeapRegion" method returns "true".
class
HeapRegionClosure
:
public
StackObj
{
friend
class
HeapRegion
Seq
;
friend
class
HeapRegion
Manager
;
friend
class
G1CollectedHeap
;
bool
_complete
;
...
...
src/share/vm/gc_implementation/g1/heapRegion
Seq
.cpp
→
src/share/vm/gc_implementation/g1/heapRegion
Manager
.cpp
浏览文件 @
ab0c41c5
...
...
@@ -24,13 +24,13 @@
#include "precompiled.hpp"
#include "gc_implementation/g1/heapRegion.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/concurrentG1Refine.hpp"
#include "memory/allocation.hpp"
void
HeapRegion
Seq
::
initialize
(
G1RegionToSpaceMapper
*
heap_storage
,
void
HeapRegion
Manager
::
initialize
(
G1RegionToSpaceMapper
*
heap_storage
,
G1RegionToSpaceMapper
*
prev_bitmap
,
G1RegionToSpaceMapper
*
next_bitmap
,
G1RegionToSpaceMapper
*
bot
,
...
...
@@ -55,24 +55,24 @@ void HeapRegionSeq::initialize(G1RegionToSpaceMapper* heap_storage,
_available_map
.
clear
();
}
bool
HeapRegion
Seq
::
is_available
(
uint
region
)
const
{
bool
HeapRegion
Manager
::
is_available
(
uint
region
)
const
{
return
_available_map
.
at
(
region
);
}
#ifdef ASSERT
bool
HeapRegion
Seq
::
is_free
(
HeapRegion
*
hr
)
const
{
bool
HeapRegion
Manager
::
is_free
(
HeapRegion
*
hr
)
const
{
return
_free_list
.
contains
(
hr
);
}
#endif
HeapRegion
*
HeapRegion
Seq
::
new_heap_region
(
uint
hrs
_index
)
{
HeapWord
*
bottom
=
G1CollectedHeap
::
heap
()
->
bottom_addr_for_region
(
hr
s
_index
);
HeapRegion
*
HeapRegion
Manager
::
new_heap_region
(
uint
hrm
_index
)
{
HeapWord
*
bottom
=
G1CollectedHeap
::
heap
()
->
bottom_addr_for_region
(
hr
m
_index
);
MemRegion
mr
(
bottom
,
bottom
+
HeapRegion
::
GrainWords
);
assert
(
reserved
().
contains
(
mr
),
"invariant"
);
return
new
HeapRegion
(
hr
s
_index
,
G1CollectedHeap
::
heap
()
->
bot_shared
(),
mr
);
return
new
HeapRegion
(
hr
m
_index
,
G1CollectedHeap
::
heap
()
->
bot_shared
(),
mr
);
}
void
HeapRegion
Seq
::
commit_regions
(
uint
index
,
size_t
num_regions
)
{
void
HeapRegion
Manager
::
commit_regions
(
uint
index
,
size_t
num_regions
)
{
guarantee
(
num_regions
>
0
,
"Must commit more than zero regions"
);
guarantee
(
_num_committed
+
num_regions
<=
max_length
(),
"Cannot commit more than the maximum amount of regions"
);
...
...
@@ -90,7 +90,7 @@ void HeapRegionSeq::commit_regions(uint index, size_t num_regions) {
_card_counts_mapper
->
commit_regions
(
index
,
num_regions
);
}
void
HeapRegion
Seq
::
uncommit_regions
(
uint
start
,
size_t
num_regions
)
{
void
HeapRegion
Manager
::
uncommit_regions
(
uint
start
,
size_t
num_regions
)
{
guarantee
(
num_regions
>=
1
,
err_msg
(
"Need to specify at least one region to uncommit, tried to uncommit zero regions at %u"
,
start
));
guarantee
(
_num_committed
>=
num_regions
,
"pre-condition"
);
...
...
@@ -117,7 +117,7 @@ void HeapRegionSeq::uncommit_regions(uint start, size_t num_regions) {
_card_counts_mapper
->
uncommit_regions
(
start
,
num_regions
);
}
void
HeapRegion
Seq
::
make_regions_available
(
uint
start
,
uint
num_regions
)
{
void
HeapRegion
Manager
::
make_regions_available
(
uint
start
,
uint
num_regions
)
{
guarantee
(
num_regions
>
0
,
"No point in calling this for zero regions"
);
commit_regions
(
start
,
num_regions
);
for
(
uint
i
=
start
;
i
<
start
+
num_regions
;
i
++
)
{
...
...
@@ -144,11 +144,11 @@ void HeapRegionSeq::make_regions_available(uint start, uint num_regions) {
}
}
uint
HeapRegion
Seq
::
expand_by
(
uint
num_regions
)
{
uint
HeapRegion
Manager
::
expand_by
(
uint
num_regions
)
{
return
expand_at
(
0
,
num_regions
);
}
uint
HeapRegion
Seq
::
expand_at
(
uint
start
,
uint
num_regions
)
{
uint
HeapRegion
Manager
::
expand_at
(
uint
start
,
uint
num_regions
)
{
if
(
num_regions
==
0
)
{
return
0
;
}
...
...
@@ -171,7 +171,7 @@ uint HeapRegionSeq::expand_at(uint start, uint num_regions) {
return
expanded
;
}
uint
HeapRegion
Seq
::
find_contiguous
(
size_t
num
,
bool
empty_only
)
{
uint
HeapRegion
Manager
::
find_contiguous
(
size_t
num
,
bool
empty_only
)
{
uint
found
=
0
;
size_t
length_found
=
0
;
uint
cur
=
0
;
...
...
@@ -199,14 +199,14 @@ uint HeapRegionSeq::find_contiguous(size_t num, bool empty_only) {
}
return
found
;
}
else
{
return
G1_NO_HR
S
_INDEX
;
return
G1_NO_HR
M
_INDEX
;
}
}
HeapRegion
*
HeapRegion
Seq
::
next_region_in_heap
(
const
HeapRegion
*
r
)
const
{
HeapRegion
*
HeapRegion
Manager
::
next_region_in_heap
(
const
HeapRegion
*
r
)
const
{
guarantee
(
r
!=
NULL
,
"Start region must be a valid region"
);
guarantee
(
is_available
(
r
->
hr
s_index
()),
err_msg
(
"Trying to iterate starting from region %u which is not in the heap"
,
r
->
hrs
_index
()));
for
(
uint
i
=
r
->
hr
s
_index
()
+
1
;
i
<
_allocated_heapregions_length
;
i
++
)
{
guarantee
(
is_available
(
r
->
hr
m_index
()),
err_msg
(
"Trying to iterate starting from region %u which is not in the heap"
,
r
->
hrm
_index
()));
for
(
uint
i
=
r
->
hr
m
_index
()
+
1
;
i
<
_allocated_heapregions_length
;
i
++
)
{
HeapRegion
*
hr
=
_regions
.
get_by_index
(
i
);
if
(
is_available
(
i
))
{
return
hr
;
...
...
@@ -215,7 +215,7 @@ HeapRegion* HeapRegionSeq::next_region_in_heap(const HeapRegion* r) const {
return
NULL
;
}
void
HeapRegion
Seq
::
iterate
(
HeapRegionClosure
*
blk
)
const
{
void
HeapRegion
Manager
::
iterate
(
HeapRegionClosure
*
blk
)
const
{
uint
len
=
max_length
();
for
(
uint
i
=
0
;
i
<
len
;
i
++
)
{
...
...
@@ -231,7 +231,7 @@ void HeapRegionSeq::iterate(HeapRegionClosure* blk) const {
}
}
uint
HeapRegion
Seq
::
find_unavailable_from_idx
(
uint
start_idx
,
uint
*
res_idx
)
const
{
uint
HeapRegion
Manager
::
find_unavailable_from_idx
(
uint
start_idx
,
uint
*
res_idx
)
const
{
guarantee
(
res_idx
!=
NULL
,
"checking"
);
guarantee
(
start_idx
<=
(
max_length
()
+
1
),
"checking"
);
...
...
@@ -259,11 +259,11 @@ uint HeapRegionSeq::find_unavailable_from_idx(uint start_idx, uint* res_idx) con
return
num_regions
;
}
uint
HeapRegion
Seq
::
start_region_for_worker
(
uint
worker_i
,
uint
num_workers
,
uint
num_regions
)
const
{
uint
HeapRegion
Manager
::
start_region_for_worker
(
uint
worker_i
,
uint
num_workers
,
uint
num_regions
)
const
{
return
num_regions
*
worker_i
/
num_workers
;
}
void
HeapRegion
Seq
::
par_iterate
(
HeapRegionClosure
*
blk
,
uint
worker_id
,
uint
num_workers
,
jint
claim_value
)
const
{
void
HeapRegion
Manager
::
par_iterate
(
HeapRegionClosure
*
blk
,
uint
worker_id
,
uint
num_workers
,
jint
claim_value
)
const
{
const
uint
start_index
=
start_region_for_worker
(
worker_id
,
num_workers
,
_allocated_heapregions_length
);
// Every worker will actually look at all regions, skipping over regions that
...
...
@@ -334,7 +334,7 @@ void HeapRegionSeq::par_iterate(HeapRegionClosure* blk, uint worker_id, uint num
}
}
uint
HeapRegion
Seq
::
shrink_by
(
uint
num_regions_to_remove
)
{
uint
HeapRegion
Manager
::
shrink_by
(
uint
num_regions_to_remove
)
{
assert
(
length
()
>
0
,
"the region sequence should not be empty"
);
assert
(
length
()
<=
_allocated_heapregions_length
,
"invariant"
);
assert
(
_allocated_heapregions_length
>
0
,
"we should have at least one region committed"
);
...
...
@@ -368,7 +368,7 @@ uint HeapRegionSeq::shrink_by(uint num_regions_to_remove) {
return
removed
;
}
uint
HeapRegion
Seq
::
find_empty_from_idx_reverse
(
uint
start_idx
,
uint
*
res_idx
)
const
{
uint
HeapRegion
Manager
::
find_empty_from_idx_reverse
(
uint
start_idx
,
uint
*
res_idx
)
const
{
guarantee
(
start_idx
<
_allocated_heapregions_length
,
"checking"
);
guarantee
(
res_idx
!=
NULL
,
"checking"
);
...
...
@@ -397,7 +397,7 @@ uint HeapRegionSeq::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) c
return
num_regions_found
;
}
void
HeapRegion
Seq
::
verify
()
{
void
HeapRegion
Manager
::
verify
()
{
guarantee
(
length
()
<=
_allocated_heapregions_length
,
err_msg
(
"invariant: _length: %u _allocated_length: %u"
,
length
(),
_allocated_heapregions_length
));
...
...
@@ -419,8 +419,8 @@ void HeapRegionSeq::verify() {
guarantee
(
!
prev_committed
||
hr
->
bottom
()
==
prev_end
,
err_msg
(
"invariant i: %u "
HR_FORMAT
" prev_end: "
PTR_FORMAT
,
i
,
HR_FORMAT_PARAMS
(
hr
),
p2i
(
prev_end
)));
guarantee
(
hr
->
hr
s
_index
()
==
i
,
err_msg
(
"invariant: i: %u hr
s_index(): %u"
,
i
,
hr
->
hrs
_index
()));
guarantee
(
hr
->
hr
m
_index
()
==
i
,
err_msg
(
"invariant: i: %u hr
m_index(): %u"
,
i
,
hr
->
hrm
_index
()));
// Asserts will fire if i is >= _length
HeapWord
*
addr
=
hr
->
bottom
();
guarantee
(
addr_to_region
(
addr
)
==
hr
,
"sanity"
);
...
...
@@ -443,7 +443,7 @@ void HeapRegionSeq::verify() {
}
#ifndef PRODUCT
void
HeapRegion
Seq
::
verify_optional
()
{
void
HeapRegion
Manager
::
verify_optional
()
{
verify
();
}
#endif // PRODUCT
...
...
src/share/vm/gc_implementation/g1/heapRegion
Seq
.hpp
→
src/share/vm/gc_implementation/g1/heapRegion
Manager
.hpp
浏览文件 @
ab0c41c5
...
...
@@ -22,8 +22,8 @@
*
*/
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
SEQ
_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
SEQ
_HPP
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
MANAGER
_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
MANAGER
_HPP
#include "gc_implementation/g1/g1BiasedArray.hpp"
#include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
...
...
@@ -64,7 +64,7 @@ class G1HeapRegionTable : public G1BiasedMappedArray<HeapRegion*> {
// * max_length() returns the maximum number of regions the heap can have.
//
class
HeapRegion
Seq
:
public
CHeapObj
<
mtGC
>
{
class
HeapRegion
Manager
:
public
CHeapObj
<
mtGC
>
{
friend
class
VMStructs
;
G1HeapRegionTable
_regions
;
...
...
@@ -104,7 +104,7 @@ class HeapRegionSeq: public CHeapObj<mtGC> {
uint
start_region_for_worker
(
uint
worker_i
,
uint
num_workers
,
uint
num_regions
)
const
;
// Find a contiguous set of empty or uncommitted regions of length num and return
// the index of the first region or G1_NO_HR
S
_INDEX if the search was unsuccessful.
// the index of the first region or G1_NO_HR
M
_INDEX if the search was unsuccessful.
// If only_empty is true, only empty regions are considered.
// Searches from bottom to top of the heap, doing a first-fit.
uint
find_contiguous
(
size_t
num
,
bool
only_empty
);
...
...
@@ -117,7 +117,7 @@ class HeapRegionSeq: public CHeapObj<mtGC> {
// sequence could be found, otherwise res_idx contains the start index of this range.
uint
find_empty_from_idx_reverse
(
uint
start_idx
,
uint
*
res_idx
)
const
;
// Allocate a new HeapRegion for the given index.
HeapRegion
*
new_heap_region
(
uint
hr
s
_index
);
HeapRegion
*
new_heap_region
(
uint
hr
m
_index
);
#ifdef ASSERT
public:
bool
is_free
(
HeapRegion
*
hr
)
const
;
...
...
@@ -125,9 +125,9 @@ public:
// Returns whether the given region is available for allocation.
bool
is_available
(
uint
region
)
const
;
public:
// Empty constructor, we'll initialize it with the initialize() method.
HeapRegion
Seq
()
:
_regions
(),
_heap_mapper
(
NULL
),
_num_committed
(
0
),
public:
// Empty constructor, we'll initialize it with the initialize() method.
HeapRegion
Manager
()
:
_regions
(),
_heap_mapper
(
NULL
),
_num_committed
(
0
),
_next_bitmap_mapper
(
NULL
),
_prev_bitmap_mapper
(
NULL
),
_bot_mapper
(
NULL
),
_allocated_heapregions_length
(
0
),
_available_map
(),
_free_list
(
"Free list"
,
new
MasterFreeRegionListMtSafeChecker
())
...
...
@@ -167,7 +167,7 @@ public:
if
(
hr
!=
NULL
)
{
assert
(
hr
->
next
()
==
NULL
,
"Single region should not have next"
);
assert
(
is_available
(
hr
->
hr
s
_index
()),
"Must be committed"
);
assert
(
is_available
(
hr
->
hr
m
_index
()),
"Must be committed"
);
}
return
hr
;
}
...
...
@@ -211,10 +211,10 @@ public:
uint
expand_at
(
uint
start
,
uint
num_regions
);
// Find a contiguous set of empty regions of length num. Returns the start index of
// that set, or G1_NO_HR
S
_INDEX.
// that set, or G1_NO_HR
M
_INDEX.
uint
find_contiguous_only_empty
(
size_t
num
)
{
return
find_contiguous
(
num
,
true
);
}
// Find a contiguous set of empty or unavailable regions of length num. Returns the
// start index of that set, or G1_NO_HR
S
_INDEX.
// start index of that set, or G1_NO_HR
M
_INDEX.
uint
find_contiguous_empty_or_unavailable
(
size_t
num
)
{
return
find_contiguous
(
num
,
false
);
}
HeapRegion
*
next_region_in_heap
(
const
HeapRegion
*
r
)
const
;
...
...
@@ -235,4 +235,4 @@ public:
void
verify_optional
()
PRODUCT_RETURN
;
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
SEQ
_HPP
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
MANAGER
_HPP
src/share/vm/gc_implementation/g1/heapRegion
Seq
.inline.hpp
→
src/share/vm/gc_implementation/g1/heapRegion
Manager
.inline.hpp
浏览文件 @
ab0c41c5
...
...
@@ -22,14 +22,14 @@
*
*/
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
SEQ
_INLINE_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
SEQ
_INLINE_HPP
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
MANAGER
_INLINE_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
MANAGER
_INLINE_HPP
#include "gc_implementation/g1/heapRegion.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
inline
HeapRegion
*
HeapRegion
Seq
::
addr_to_region
(
HeapWord
*
addr
)
const
{
inline
HeapRegion
*
HeapRegion
Manager
::
addr_to_region
(
HeapWord
*
addr
)
const
{
assert
(
addr
<
heap_end
(),
err_msg
(
"addr: "
PTR_FORMAT
" end: "
PTR_FORMAT
,
p2i
(
addr
),
p2i
(
heap_end
())));
assert
(
addr
>=
heap_bottom
(),
...
...
@@ -39,20 +39,20 @@ inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
return
hr
;
}
inline
HeapRegion
*
HeapRegion
Seq
::
at
(
uint
index
)
const
{
inline
HeapRegion
*
HeapRegion
Manager
::
at
(
uint
index
)
const
{
assert
(
is_available
(
index
),
"pre-condition"
);
HeapRegion
*
hr
=
_regions
.
get_by_index
(
index
);
assert
(
hr
!=
NULL
,
"sanity"
);
assert
(
hr
->
hr
s
_index
()
==
index
,
"sanity"
);
assert
(
hr
->
hr
m
_index
()
==
index
,
"sanity"
);
return
hr
;
}
inline
void
HeapRegion
Seq
::
insert_into_free_list
(
HeapRegion
*
hr
)
{
inline
void
HeapRegion
Manager
::
insert_into_free_list
(
HeapRegion
*
hr
)
{
_free_list
.
add_ordered
(
hr
);
}
inline
void
HeapRegion
Seq
::
allocate_free_regions_starting_at
(
uint
first
,
uint
num_regions
)
{
inline
void
HeapRegion
Manager
::
allocate_free_regions_starting_at
(
uint
first
,
uint
num_regions
)
{
_free_list
.
remove_starting_at
(
at
(
first
),
num_regions
);
}
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
SEQ
_INLINE_HPP
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION
MANAGER
_INLINE_HPP
src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
浏览文件 @
ab0c41c5
...
...
@@ -27,7 +27,7 @@
#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "memory/allocation.hpp"
#include "memory/padded.inline.hpp"
#include "memory/space.inline.hpp"
...
...
@@ -419,7 +419,7 @@ void OtherRegionsTable::print_from_card_cache() {
}
void
OtherRegionsTable
::
add_reference
(
OopOrNarrowOopStar
from
,
int
tid
)
{
uint
cur_hr
s_ind
=
hr
()
->
hrs
_index
();
uint
cur_hr
m_ind
=
hr
()
->
hrm
_index
();
if
(
G1TraceHeapRegionRememberedSet
)
{
gclog_or_tty
->
print_cr
(
"ORT::add_reference_work("
PTR_FORMAT
"->"
PTR_FORMAT
")."
,
...
...
@@ -434,10 +434,10 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
if
(
G1TraceHeapRegionRememberedSet
)
{
gclog_or_tty
->
print_cr
(
"Table for ["
PTR_FORMAT
"...): card %d (cache = "
INT32_FORMAT
")"
,
hr
()
->
bottom
(),
from_card
,
FromCardCache
::
at
((
uint
)
tid
,
cur_hr
s
_ind
));
FromCardCache
::
at
((
uint
)
tid
,
cur_hr
m
_ind
));
}
if
(
FromCardCache
::
contains_or_replace
((
uint
)
tid
,
cur_hr
s
_ind
,
from_card
))
{
if
(
FromCardCache
::
contains_or_replace
((
uint
)
tid
,
cur_hr
m
_ind
,
from_card
))
{
if
(
G1TraceHeapRegionRememberedSet
)
{
gclog_or_tty
->
print_cr
(
" from-card cache hit."
);
}
...
...
@@ -447,7 +447,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
// Note that this may be a continued H region.
HeapRegion
*
from_hr
=
_g1h
->
heap_region_containing_raw
(
from
);
RegionIdx_t
from_hrs_ind
=
(
RegionIdx_t
)
from_hr
->
hr
s
_index
();
RegionIdx_t
from_hrs_ind
=
(
RegionIdx_t
)
from_hr
->
hr
m
_index
();
// If the region is already coarsened, return.
if
(
_coarse_map
.
at
(
from_hrs_ind
))
{
...
...
@@ -493,8 +493,8 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
}
else
{
if
(
G1TraceHeapRegionRememberedSet
)
{
gclog_or_tty
->
print_cr
(
" [tid %d] sparse table entry "
"overflow(f: %d, t: %
d
)"
,
tid
,
from_hrs_ind
,
cur_hr
s
_ind
);
"overflow(f: %d, t: %
u
)"
,
tid
,
from_hrs_ind
,
cur_hr
m
_ind
);
}
}
...
...
@@ -606,9 +606,9 @@ PerRegionTable* OtherRegionsTable::delete_region_table() {
guarantee
(
max
!=
NULL
,
"Since _n_fine_entries > 0"
);
// Set the corresponding coarse bit.
size_t
max_hr
s_index
=
(
size_t
)
max
->
hr
()
->
hrs
_index
();
if
(
!
_coarse_map
.
at
(
max_hr
s
_index
))
{
_coarse_map
.
at_put
(
max_hr
s
_index
,
true
);
size_t
max_hr
m_index
=
(
size_t
)
max
->
hr
()
->
hrm
_index
();
if
(
!
_coarse_map
.
at
(
max_hr
m
_index
))
{
_coarse_map
.
at_put
(
max_hr
m
_index
,
true
);
_n_coarse_entries
++
;
if
(
G1TraceHeapRegionRememberedSet
)
{
gclog_or_tty
->
print
(
"Coarsened entry in region ["
PTR_FORMAT
"...] "
...
...
@@ -632,7 +632,7 @@ void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
BitMap
*
region_bm
,
BitMap
*
card_bm
)
{
// First eliminated garbage regions from the coarse map.
if
(
G1RSScrubVerbose
)
{
gclog_or_tty
->
print_cr
(
"Scrubbing region %u:"
,
hr
()
->
hr
s
_index
());
gclog_or_tty
->
print_cr
(
"Scrubbing region %u:"
,
hr
()
->
hr
m
_index
());
}
assert
(
_coarse_map
.
size
()
==
region_bm
->
size
(),
"Precondition"
);
...
...
@@ -655,9 +655,9 @@ void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
// If the entire region is dead, eliminate.
if
(
G1RSScrubVerbose
)
{
gclog_or_tty
->
print_cr
(
" For other region %u:"
,
cur
->
hr
()
->
hr
s
_index
());
cur
->
hr
()
->
hr
m
_index
());
}
if
(
!
region_bm
->
at
((
size_t
)
cur
->
hr
()
->
hr
s
_index
()))
{
if
(
!
region_bm
->
at
((
size_t
)
cur
->
hr
()
->
hr
m
_index
()))
{
*
prev
=
nxt
;
cur
->
set_collision_list_next
(
NULL
);
_n_fine_entries
--
;
...
...
@@ -751,7 +751,7 @@ size_t OtherRegionsTable::fl_mem_size() {
}
void
OtherRegionsTable
::
clear_fcc
()
{
FromCardCache
::
clear
(
hr
()
->
hr
s
_index
());
FromCardCache
::
clear
(
hr
()
->
hr
m
_index
());
}
void
OtherRegionsTable
::
clear
()
{
...
...
@@ -802,7 +802,7 @@ bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
bool
OtherRegionsTable
::
contains_reference_locked
(
OopOrNarrowOopStar
from
)
const
{
HeapRegion
*
hr
=
_g1h
->
heap_region_containing_raw
(
from
);
RegionIdx_t
hr_ind
=
(
RegionIdx_t
)
hr
->
hr
s
_index
();
RegionIdx_t
hr_ind
=
(
RegionIdx_t
)
hr
->
hr
m
_index
();
// Is this region in the coarse map?
if
(
_coarse_map
.
at
(
hr_ind
))
return
true
;
...
...
@@ -839,7 +839,7 @@ uint HeapRegionRemSet::num_par_rem_sets() {
HeapRegionRemSet
::
HeapRegionRemSet
(
G1BlockOffsetSharedArray
*
bosa
,
HeapRegion
*
hr
)
:
_bosa
(
bosa
),
_m
(
Mutex
::
leaf
,
FormatBuffer
<
128
>
(
"HeapRegionRemSet lock #%u"
,
hr
->
hr
s
_index
()),
true
),
_m
(
Mutex
::
leaf
,
FormatBuffer
<
128
>
(
"HeapRegionRemSet lock #%u"
,
hr
->
hr
m
_index
()),
true
),
_code_roots
(),
_other_regions
(
hr
,
&
_m
),
_iter_state
(
Unclaimed
),
_iter_claimed
(
0
)
{
reset_for_par_iteration
();
}
...
...
src/share/vm/gc_implementation/g1/heapRegionSet.cpp
浏览文件 @
ab0c41c5
...
...
@@ -39,11 +39,11 @@ void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
#ifndef PRODUCT
void
HeapRegionSetBase
::
verify_region
(
HeapRegion
*
hr
)
{
assert
(
hr
->
containing_set
()
==
this
,
err_msg
(
"Inconsistent containing set for %u"
,
hr
->
hr
s
_index
()));
assert
(
!
hr
->
is_young
(),
err_msg
(
"Adding young region %u"
,
hr
->
hr
s
_index
()));
// currently we don't use these sets for young regions
assert
(
hr
->
isHumongous
()
==
regions_humongous
(),
err_msg
(
"Wrong humongous state for region %u and set %s"
,
hr
->
hr
s
_index
(),
name
()));
assert
(
hr
->
is_empty
()
==
regions_empty
(),
err_msg
(
"Wrong empty state for region %u and set %s"
,
hr
->
hr
s
_index
(),
name
()));
assert
(
hr
->
rem_set
()
->
verify_ready_for_par_iteration
(),
err_msg
(
"Wrong iteration state %u"
,
hr
->
hr
s
_index
()));
assert
(
hr
->
containing_set
()
==
this
,
err_msg
(
"Inconsistent containing set for %u"
,
hr
->
hr
m
_index
()));
assert
(
!
hr
->
is_young
(),
err_msg
(
"Adding young region %u"
,
hr
->
hr
m
_index
()));
// currently we don't use these sets for young regions
assert
(
hr
->
isHumongous
()
==
regions_humongous
(),
err_msg
(
"Wrong humongous state for region %u and set %s"
,
hr
->
hr
m
_index
(),
name
()));
assert
(
hr
->
is_empty
()
==
regions_empty
(),
err_msg
(
"Wrong empty state for region %u and set %s"
,
hr
->
hr
m
_index
(),
name
()));
assert
(
hr
->
rem_set
()
->
verify_ready_for_par_iteration
(),
err_msg
(
"Wrong iteration state %u"
,
hr
->
hr
m
_index
()));
}
#endif
...
...
@@ -158,7 +158,7 @@ void FreeRegionList::add_ordered(FreeRegionList* from_list) {
HeapRegion
*
curr_from
=
from_list
->
_head
;
while
(
curr_from
!=
NULL
)
{
while
(
curr_to
!=
NULL
&&
curr_to
->
hr
s_index
()
<
curr_from
->
hrs
_index
())
{
while
(
curr_to
!=
NULL
&&
curr_to
->
hr
m_index
()
<
curr_from
->
hrm
_index
())
{
curr_to
=
curr_to
->
next
();
}
...
...
@@ -183,7 +183,7 @@ void FreeRegionList::add_ordered(FreeRegionList* from_list) {
}
}
if
(
_tail
->
hr
s_index
()
<
from_list
->
_tail
->
hrs
_index
())
{
if
(
_tail
->
hr
m_index
()
<
from_list
->
_tail
->
hrm
_index
())
{
_tail
=
from_list
->
_tail
;
}
}
...
...
@@ -309,8 +309,8 @@ void FreeRegionList::verify_list() {
if
(
curr
->
next
()
!=
NULL
)
{
guarantee
(
curr
->
next
()
->
prev
()
==
curr
,
"Next or prev pointers messed up"
);
}
guarantee
(
curr
->
hr
s_index
()
==
0
||
curr
->
hrs
_index
()
>
last_index
,
"List should be sorted"
);
last_index
=
curr
->
hr
s
_index
();
guarantee
(
curr
->
hr
m_index
()
==
0
||
curr
->
hrm
_index
()
>
last_index
,
"List should be sorted"
);
last_index
=
curr
->
hr
m
_index
();
capacity
+=
curr
->
capacity
();
...
...
@@ -319,7 +319,7 @@ void FreeRegionList::verify_list() {
curr
=
curr
->
next
();
}
guarantee
(
_tail
==
prev0
,
err_msg
(
"Expected %s to end with %u but it ended with %u."
,
name
(),
_tail
->
hr
s_index
(),
prev0
->
hrs
_index
()));
guarantee
(
_tail
==
prev0
,
err_msg
(
"Expected %s to end with %u but it ended with %u."
,
name
(),
_tail
->
hr
m_index
(),
prev0
->
hrm
_index
()));
guarantee
(
_tail
==
NULL
||
_tail
->
next
()
==
NULL
,
"_tail should not have a next"
);
guarantee
(
length
()
==
count
,
err_msg
(
"%s count mismatch. Expected %u, actual %u."
,
name
(),
length
(),
count
));
guarantee
(
total_capacity_bytes
()
==
capacity
,
err_msg
(
"%s capacity mismatch. Expected "
SIZE_FORMAT
", actual "
SIZE_FORMAT
,
...
...
src/share/vm/gc_implementation/g1/heapRegionSet.hpp
浏览文件 @
ab0c41c5
...
...
@@ -238,14 +238,14 @@ public:
// Add hr to the list. The region should not be a member of another set.
// Assumes that the list is ordered and will preserve that order. The order
// is determined by hr
s
_index.
// is determined by hr
m
_index.
inline
void
add_ordered
(
HeapRegion
*
hr
);
// Removes from head or tail based on the given argument.
HeapRegion
*
remove_region
(
bool
from_head
);
// Merge two ordered lists. The result is also ordered. The order is
// determined by hr
s
_index.
// determined by hr
m
_index.
void
add_ordered
(
FreeRegionList
*
from_list
);
// It empties the list by removing all regions from it.
...
...
src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp
浏览文件 @
ab0c41c5
...
...
@@ -60,14 +60,14 @@ inline void FreeRegionList::add_ordered(HeapRegion* hr) {
if
(
_head
!=
NULL
)
{
HeapRegion
*
curr
;
if
(
_last
!=
NULL
&&
_last
->
hr
s_index
()
<
hr
->
hrs
_index
())
{
if
(
_last
!=
NULL
&&
_last
->
hr
m_index
()
<
hr
->
hrm
_index
())
{
curr
=
_last
;
}
else
{
curr
=
_head
;
}
// Find first entry with a Region Index larger than entry to insert.
while
(
curr
!=
NULL
&&
curr
->
hr
s_index
()
<
hr
->
hrs
_index
())
{
while
(
curr
!=
NULL
&&
curr
->
hr
m_index
()
<
hr
->
hrm
_index
())
{
curr
=
curr
->
next
();
}
...
...
src/share/vm/gc_implementation/g1/sparsePRT.cpp
浏览文件 @
ab0c41c5
...
...
@@ -478,7 +478,7 @@ size_t SparsePRT::mem_size() const {
bool
SparsePRT
::
add_card
(
RegionIdx_t
region_id
,
CardIdx_t
card_index
)
{
#if SPARSE_PRT_VERBOSE
gclog_or_tty
->
print_cr
(
" Adding card %d from region %d to region %u sparse."
,
card_index
,
region_id
,
_hr
->
hr
s
_index
());
card_index
,
region_id
,
_hr
->
hr
m
_index
());
#endif
if
(
_next
->
occupied_entries
()
*
2
>
_next
->
capacity
())
{
expand
();
...
...
@@ -530,7 +530,7 @@ void SparsePRT::expand() {
#if SPARSE_PRT_VERBOSE
gclog_or_tty
->
print_cr
(
" Expanded sparse table for %u to %d."
,
_hr
->
hr
s
_index
(),
_next
->
capacity
());
_hr
->
hr
m
_index
(),
_next
->
capacity
());
#endif
for
(
size_t
i
=
0
;
i
<
last
->
capacity
();
i
++
)
{
SparsePRTEntry
*
e
=
last
->
entry
((
int
)
i
);
...
...
src/share/vm/gc_implementation/g1/vmStructs_g1.hpp
浏览文件 @
ab0c41c5
...
...
@@ -26,7 +26,7 @@
#define SHARE_VM_GC_IMPLEMENTATION_G1_VMSTRUCTS_G1_HPP
#include "gc_implementation/g1/heapRegion.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#define VM_STRUCTS_G1(nonstatic_field, static_field) \
...
...
@@ -42,10 +42,10 @@
nonstatic_field(G1HeapRegionTable, _bias, size_t) \
nonstatic_field(G1HeapRegionTable, _shift_by, uint) \
\
nonstatic_field(HeapRegion
Seq, _regions,
G1HeapRegionTable) \
nonstatic_field(HeapRegion
Seq, _num_committed,
uint) \
nonstatic_field(HeapRegion
Manager, _regions,
G1HeapRegionTable) \
nonstatic_field(HeapRegion
Manager, _num_committed,
uint) \
\
nonstatic_field(G1CollectedHeap, _hr
s, HeapRegionSeq)
\
nonstatic_field(G1CollectedHeap, _hr
m, HeapRegionManager)
\
nonstatic_field(G1CollectedHeap, _summary_bytes_used, size_t) \
nonstatic_field(G1CollectedHeap, _g1mm, G1MonitoringSupport*) \
nonstatic_field(G1CollectedHeap, _old_set, HeapRegionSetBase) \
...
...
@@ -72,7 +72,7 @@
\
declare_type(G1OffsetTableContigSpace, CompactibleSpace) \
declare_type(HeapRegion, G1OffsetTableContigSpace) \
declare_toplevel_type(HeapRegion
Seq
) \
declare_toplevel_type(HeapRegion
Manager
) \
declare_toplevel_type(HeapRegionSetBase) \
declare_toplevel_type(HeapRegionSetCount) \
declare_toplevel_type(G1MonitoringSupport) \
...
...
src/share/vm/oops/instanceKlass.cpp
浏览文件 @
ab0c41c5
...
...
@@ -66,7 +66,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
...
...
src/share/vm/oops/instanceMirrorKlass.cpp
浏览文件 @
ab0c41c5
...
...
@@ -42,7 +42,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
...
...
src/share/vm/oops/instanceRefKlass.cpp
浏览文件 @
ab0c41c5
...
...
@@ -38,7 +38,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
...
...
src/share/vm/oops/objArrayKlass.cpp
浏览文件 @
ab0c41c5
...
...
@@ -51,7 +51,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegion
Seq
.inline.hpp"
#include "gc_implementation/g1/heapRegion
Manager
.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录