Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
bee8b017
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看板
提交
bee8b017
编写于
9月 30, 2008
作者:
J
jcoomes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6725697: par compact - rename class ChunkData to RegionData
Reviewed-by: iveresov, tonyp
上级
a039f22b
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1057 addition
and
1048 deletion
+1057
-1048
src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
+20
-21
src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp
src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp
+11
-11
src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
...c_implementation/parallelScavenge/psCompactionManager.cpp
+48
-48
src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp
...c_implementation/parallelScavenge/psCompactionManager.hpp
+36
-35
src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
.../gc_implementation/parallelScavenge/psParallelCompact.cpp
+627
-613
src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp
.../gc_implementation/parallelScavenge/psParallelCompact.hpp
+269
-274
src/share/vm/runtime/globals.hpp
src/share/vm/runtime/globals.hpp
+5
-5
src/share/vm/utilities/taskqueue.cpp
src/share/vm/utilities/taskqueue.cpp
+27
-27
src/share/vm/utilities/taskqueue.hpp
src/share/vm/utilities/taskqueue.hpp
+14
-14
未找到文件。
src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
浏览文件 @
bee8b017
...
@@ -146,7 +146,7 @@ void RefProcTaskExecutor::execute(ProcessTask& task)
...
@@ -146,7 +146,7 @@ void RefProcTaskExecutor::execute(ProcessTask& task)
{
{
ParallelScavengeHeap
*
heap
=
PSParallelCompact
::
gc_heap
();
ParallelScavengeHeap
*
heap
=
PSParallelCompact
::
gc_heap
();
uint
parallel_gc_threads
=
heap
->
gc_task_manager
()
->
workers
();
uint
parallel_gc_threads
=
heap
->
gc_task_manager
()
->
workers
();
ChunkTaskQueueSet
*
qset
=
ParCompactionManager
::
chunk
_array
();
RegionTaskQueueSet
*
qset
=
ParCompactionManager
::
region
_array
();
ParallelTaskTerminator
terminator
(
parallel_gc_threads
,
qset
);
ParallelTaskTerminator
terminator
(
parallel_gc_threads
,
qset
);
GCTaskQueue
*
q
=
GCTaskQueue
::
create
();
GCTaskQueue
*
q
=
GCTaskQueue
::
create
();
for
(
uint
i
=
0
;
i
<
parallel_gc_threads
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
parallel_gc_threads
;
i
++
)
{
...
@@ -205,38 +205,38 @@ void StealMarkingTask::do_it(GCTaskManager* manager, uint which) {
...
@@ -205,38 +205,38 @@ void StealMarkingTask::do_it(GCTaskManager* manager, uint which) {
}
}
//
//
// Steal
Chunk
CompactionTask
// Steal
Region
CompactionTask
//
//
Steal
ChunkCompactionTask
::
StealChunkCompactionTask
(
ParallelTaskTerminator
*
t
)
:
Steal
RegionCompactionTask
::
StealRegionCompactionTask
(
ParallelTaskTerminator
*
t
)
:
_terminator
(
t
)
{}
;
_terminator
(
t
)
{}
void
Steal
Chunk
CompactionTask
::
do_it
(
GCTaskManager
*
manager
,
uint
which
)
{
void
Steal
Region
CompactionTask
::
do_it
(
GCTaskManager
*
manager
,
uint
which
)
{
assert
(
Universe
::
heap
()
->
is_gc_active
(),
"called outside gc"
);
assert
(
Universe
::
heap
()
->
is_gc_active
(),
"called outside gc"
);
NOT_PRODUCT
(
TraceTime
tm
(
"Steal
Chunk
CompactionTask"
,
NOT_PRODUCT
(
TraceTime
tm
(
"Steal
Region
CompactionTask"
,
PrintGCDetails
&&
TraceParallelOldGCTasks
,
true
,
gclog_or_tty
));
PrintGCDetails
&&
TraceParallelOldGCTasks
,
true
,
gclog_or_tty
));
ParCompactionManager
*
cm
=
ParCompactionManager
*
cm
=
ParCompactionManager
::
gc_thread_compaction_manager
(
which
);
ParCompactionManager
::
gc_thread_compaction_manager
(
which
);
// Has to drain stacks first because there may be
chunk
s on
// Has to drain stacks first because there may be
region
s on
// preloaded onto the stack and this thread may never have
// preloaded onto the stack and this thread may never have
// done a draining task. Are the draining tasks needed?
// done a draining task. Are the draining tasks needed?
cm
->
drain_
chunk
_stacks
();
cm
->
drain_
region
_stacks
();
size_t
chunk
_index
=
0
;
size_t
region
_index
=
0
;
int
random_seed
=
17
;
int
random_seed
=
17
;
// If we're the termination task, try 10 rounds of stealing before
// If we're the termination task, try 10 rounds of stealing before
// setting the termination flag
// setting the termination flag
while
(
true
)
{
while
(
true
)
{
if
(
ParCompactionManager
::
steal
(
which
,
&
random_seed
,
chunk
_index
))
{
if
(
ParCompactionManager
::
steal
(
which
,
&
random_seed
,
region
_index
))
{
PSParallelCompact
::
fill_and_update_
chunk
(
cm
,
chunk
_index
);
PSParallelCompact
::
fill_and_update_
region
(
cm
,
region
_index
);
cm
->
drain_
chunk
_stacks
();
cm
->
drain_
region
_stacks
();
}
else
{
}
else
{
if
(
terminator
()
->
offer_termination
())
{
if
(
terminator
()
->
offer_termination
())
{
break
;
break
;
...
@@ -249,11 +249,10 @@ void StealChunkCompactionTask::do_it(GCTaskManager* manager, uint which) {
...
@@ -249,11 +249,10 @@ void StealChunkCompactionTask::do_it(GCTaskManager* manager, uint which) {
UpdateDensePrefixTask
::
UpdateDensePrefixTask
(
UpdateDensePrefixTask
::
UpdateDensePrefixTask
(
PSParallelCompact
::
SpaceId
space_id
,
PSParallelCompact
::
SpaceId
space_id
,
size_t
chunk_index_start
,
size_t
region_index_start
,
size_t
chunk_index_end
)
:
size_t
region_index_end
)
:
_space_id
(
space_id
),
_chunk_index_start
(
chunk_index_start
),
_space_id
(
space_id
),
_region_index_start
(
region_index_start
),
_chunk_index_end
(
chunk_index_end
)
_region_index_end
(
region_index_end
)
{}
{}
void
UpdateDensePrefixTask
::
do_it
(
GCTaskManager
*
manager
,
uint
which
)
{
void
UpdateDensePrefixTask
::
do_it
(
GCTaskManager
*
manager
,
uint
which
)
{
...
@@ -265,8 +264,8 @@ void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) {
...
@@ -265,8 +264,8 @@ void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) {
PSParallelCompact
::
update_and_deadwood_in_dense_prefix
(
cm
,
PSParallelCompact
::
update_and_deadwood_in_dense_prefix
(
cm
,
_space_id
,
_space_id
,
_
chunk
_index_start
,
_
region
_index_start
,
_
chunk
_index_end
);
_
region
_index_end
);
}
}
void
DrainStacksCompactionTask
::
do_it
(
GCTaskManager
*
manager
,
uint
which
)
{
void
DrainStacksCompactionTask
::
do_it
(
GCTaskManager
*
manager
,
uint
which
)
{
...
@@ -278,6 +277,6 @@ void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) {
...
@@ -278,6 +277,6 @@ void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) {
ParCompactionManager
*
cm
=
ParCompactionManager
*
cm
=
ParCompactionManager
::
gc_thread_compaction_manager
(
which
);
ParCompactionManager
::
gc_thread_compaction_manager
(
which
);
// Process any
chunk
s already in the compaction managers stacks.
// Process any
region
s already in the compaction managers stacks.
cm
->
drain_
chunk
_stacks
();
cm
->
drain_
region
_stacks
();
}
}
src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp
浏览文件 @
bee8b017
...
@@ -188,18 +188,18 @@ class StealMarkingTask : public GCTask {
...
@@ -188,18 +188,18 @@ class StealMarkingTask : public GCTask {
};
};
//
//
// Steal
Chunk
CompactionTask
// Steal
Region
CompactionTask
//
//
// This task is used to distribute work to idle threads.
// This task is used to distribute work to idle threads.
//
//
class
Steal
Chunk
CompactionTask
:
public
GCTask
{
class
Steal
Region
CompactionTask
:
public
GCTask
{
private:
private:
ParallelTaskTerminator
*
const
_terminator
;
ParallelTaskTerminator
*
const
_terminator
;
public:
public:
Steal
Chunk
CompactionTask
(
ParallelTaskTerminator
*
t
);
Steal
Region
CompactionTask
(
ParallelTaskTerminator
*
t
);
char
*
name
()
{
return
(
char
*
)
"steal-
chunk
-task"
;
}
char
*
name
()
{
return
(
char
*
)
"steal-
region
-task"
;
}
ParallelTaskTerminator
*
terminator
()
{
return
_terminator
;
}
ParallelTaskTerminator
*
terminator
()
{
return
_terminator
;
}
virtual
void
do_it
(
GCTaskManager
*
manager
,
uint
which
);
virtual
void
do_it
(
GCTaskManager
*
manager
,
uint
which
);
...
@@ -215,15 +215,15 @@ class StealChunkCompactionTask : public GCTask {
...
@@ -215,15 +215,15 @@ class StealChunkCompactionTask : public GCTask {
class
UpdateDensePrefixTask
:
public
GCTask
{
class
UpdateDensePrefixTask
:
public
GCTask
{
private:
private:
PSParallelCompact
::
SpaceId
_space_id
;
PSParallelCompact
::
SpaceId
_space_id
;
size_t
_
chunk
_index_start
;
size_t
_
region
_index_start
;
size_t
_
chunk
_index_end
;
size_t
_
region
_index_end
;
public:
public:
char
*
name
()
{
return
(
char
*
)
"update-dense_prefix-task"
;
}
char
*
name
()
{
return
(
char
*
)
"update-dense_prefix-task"
;
}
UpdateDensePrefixTask
(
PSParallelCompact
::
SpaceId
space_id
,
UpdateDensePrefixTask
(
PSParallelCompact
::
SpaceId
space_id
,
size_t
chunk
_index_start
,
size_t
region
_index_start
,
size_t
chunk
_index_end
);
size_t
region
_index_end
);
virtual
void
do_it
(
GCTaskManager
*
manager
,
uint
which
);
virtual
void
do_it
(
GCTaskManager
*
manager
,
uint
which
);
};
};
...
@@ -231,17 +231,17 @@ class UpdateDensePrefixTask : public GCTask {
...
@@ -231,17 +231,17 @@ class UpdateDensePrefixTask : public GCTask {
//
//
// DrainStacksCompactionTask
// DrainStacksCompactionTask
//
//
// This task processes
chunk
s that have been added to the stacks of each
// This task processes
region
s that have been added to the stacks of each
// compaction manager.
// compaction manager.
//
//
// Trying to use one draining thread does not work because there are no
// Trying to use one draining thread does not work because there are no
// guarantees about which task will be picked up by which thread. For example,
// guarantees about which task will be picked up by which thread. For example,
// if thread A gets all the preloaded
chunk
s, thread A may not get a draining
// if thread A gets all the preloaded
region
s, thread A may not get a draining
// task (they may all be done by other threads).
// task (they may all be done by other threads).
//
//
class
DrainStacksCompactionTask
:
public
GCTask
{
class
DrainStacksCompactionTask
:
public
GCTask
{
public:
public:
char
*
name
()
{
return
(
char
*
)
"drain-
chunk
-task"
;
}
char
*
name
()
{
return
(
char
*
)
"drain-
region
-task"
;
}
virtual
void
do_it
(
GCTaskManager
*
manager
,
uint
which
);
virtual
void
do_it
(
GCTaskManager
*
manager
,
uint
which
);
};
};
src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
浏览文件 @
bee8b017
...
@@ -30,7 +30,7 @@ ParCompactionManager** ParCompactionManager::_manager_array = NULL;
...
@@ -30,7 +30,7 @@ ParCompactionManager** ParCompactionManager::_manager_array = NULL;
OopTaskQueueSet
*
ParCompactionManager
::
_stack_array
=
NULL
;
OopTaskQueueSet
*
ParCompactionManager
::
_stack_array
=
NULL
;
ObjectStartArray
*
ParCompactionManager
::
_start_array
=
NULL
;
ObjectStartArray
*
ParCompactionManager
::
_start_array
=
NULL
;
ParMarkBitMap
*
ParCompactionManager
::
_mark_bitmap
=
NULL
;
ParMarkBitMap
*
ParCompactionManager
::
_mark_bitmap
=
NULL
;
ChunkTaskQueueSet
*
ParCompactionManager
::
_chunk
_array
=
NULL
;
RegionTaskQueueSet
*
ParCompactionManager
::
_region
_array
=
NULL
;
ParCompactionManager
::
ParCompactionManager
()
:
ParCompactionManager
::
ParCompactionManager
()
:
_action
(
CopyAndUpdate
)
{
_action
(
CopyAndUpdate
)
{
...
@@ -46,13 +46,13 @@ ParCompactionManager::ParCompactionManager() :
...
@@ -46,13 +46,13 @@ ParCompactionManager::ParCompactionManager() :
// We want the overflow stack to be permanent
// We want the overflow stack to be permanent
_overflow_stack
=
new
(
ResourceObj
::
C_HEAP
)
GrowableArray
<
oop
>
(
10
,
true
);
_overflow_stack
=
new
(
ResourceObj
::
C_HEAP
)
GrowableArray
<
oop
>
(
10
,
true
);
#ifdef USE_
Chunk
TaskQueueWithOverflow
#ifdef USE_
Region
TaskQueueWithOverflow
chunk
_stack
()
->
initialize
();
region
_stack
()
->
initialize
();
#else
#else
chunk
_stack
()
->
initialize
();
region
_stack
()
->
initialize
();
// We want the overflow stack to be permanent
// We want the overflow stack to be permanent
_
chunk
_overflow_stack
=
_
region
_overflow_stack
=
new
(
ResourceObj
::
C_HEAP
)
GrowableArray
<
size_t
>
(
10
,
true
);
new
(
ResourceObj
::
C_HEAP
)
GrowableArray
<
size_t
>
(
10
,
true
);
#endif
#endif
...
@@ -86,18 +86,18 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) {
...
@@ -86,18 +86,18 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) {
_stack_array
=
new
OopTaskQueueSet
(
parallel_gc_threads
);
_stack_array
=
new
OopTaskQueueSet
(
parallel_gc_threads
);
guarantee
(
_stack_array
!=
NULL
,
"Count not initialize promotion manager"
);
guarantee
(
_stack_array
!=
NULL
,
"Count not initialize promotion manager"
);
_
chunk_array
=
new
Chunk
TaskQueueSet
(
parallel_gc_threads
);
_
region_array
=
new
Region
TaskQueueSet
(
parallel_gc_threads
);
guarantee
(
_
chunk
_array
!=
NULL
,
"Count not initialize promotion manager"
);
guarantee
(
_
region
_array
!=
NULL
,
"Count not initialize promotion manager"
);
// Create and register the ParCompactionManager(s) for the worker threads.
// Create and register the ParCompactionManager(s) for the worker threads.
for
(
uint
i
=
0
;
i
<
parallel_gc_threads
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
parallel_gc_threads
;
i
++
)
{
_manager_array
[
i
]
=
new
ParCompactionManager
();
_manager_array
[
i
]
=
new
ParCompactionManager
();
guarantee
(
_manager_array
[
i
]
!=
NULL
,
"Could not create ParCompactionManager"
);
guarantee
(
_manager_array
[
i
]
!=
NULL
,
"Could not create ParCompactionManager"
);
stack_array
()
->
register_queue
(
i
,
_manager_array
[
i
]
->
marking_stack
());
stack_array
()
->
register_queue
(
i
,
_manager_array
[
i
]
->
marking_stack
());
#ifdef USE_
Chunk
TaskQueueWithOverflow
#ifdef USE_
Region
TaskQueueWithOverflow
chunk_array
()
->
register_queue
(
i
,
_manager_array
[
i
]
->
chunk
_stack
()
->
task_queue
());
region_array
()
->
register_queue
(
i
,
_manager_array
[
i
]
->
region
_stack
()
->
task_queue
());
#else
#else
chunk_array
()
->
register_queue
(
i
,
_manager_array
[
i
]
->
chunk
_stack
());
region_array
()
->
register_queue
(
i
,
_manager_array
[
i
]
->
region
_stack
());
#endif
#endif
}
}
...
@@ -153,31 +153,31 @@ oop ParCompactionManager::retrieve_for_scanning() {
...
@@ -153,31 +153,31 @@ oop ParCompactionManager::retrieve_for_scanning() {
return
NULL
;
return
NULL
;
}
}
// Save
chunk
on a stack
// Save
region
on a stack
void
ParCompactionManager
::
save_for_processing
(
size_t
chunk
_index
)
{
void
ParCompactionManager
::
save_for_processing
(
size_t
region
_index
)
{
#ifdef ASSERT
#ifdef ASSERT
const
ParallelCompactData
&
sd
=
PSParallelCompact
::
summary_data
();
const
ParallelCompactData
&
sd
=
PSParallelCompact
::
summary_data
();
ParallelCompactData
::
ChunkData
*
const
chunk_ptr
=
sd
.
chunk
(
chunk
_index
);
ParallelCompactData
::
RegionData
*
const
region_ptr
=
sd
.
region
(
region
_index
);
assert
(
chunk
_ptr
->
claimed
(),
"must be claimed"
);
assert
(
region
_ptr
->
claimed
(),
"must be claimed"
);
assert
(
chunk
_ptr
->
_pushed
++
==
0
,
"should only be pushed once"
);
assert
(
region
_ptr
->
_pushed
++
==
0
,
"should only be pushed once"
);
#endif
#endif
chunk_stack_push
(
chunk
_index
);
region_stack_push
(
region
_index
);
}
}
void
ParCompactionManager
::
chunk_stack_push
(
size_t
chunk
_index
)
{
void
ParCompactionManager
::
region_stack_push
(
size_t
region
_index
)
{
#ifdef USE_
Chunk
TaskQueueWithOverflow
#ifdef USE_
Region
TaskQueueWithOverflow
chunk_stack
()
->
save
(
chunk
_index
);
region_stack
()
->
save
(
region
_index
);
#else
#else
if
(
!
chunk_stack
()
->
push
(
chunk
_index
))
{
if
(
!
region_stack
()
->
push
(
region
_index
))
{
chunk_overflow_stack
()
->
push
(
chunk
_index
);
region_overflow_stack
()
->
push
(
region
_index
);
}
}
#endif
#endif
}
}
bool
ParCompactionManager
::
retrieve_for_processing
(
size_t
&
chunk
_index
)
{
bool
ParCompactionManager
::
retrieve_for_processing
(
size_t
&
region
_index
)
{
#ifdef USE_
Chunk
TaskQueueWithOverflow
#ifdef USE_
Region
TaskQueueWithOverflow
return
chunk_stack
()
->
retrieve
(
chunk
_index
);
return
region_stack
()
->
retrieve
(
region
_index
);
#else
#else
// Should not be used in the parallel case
// Should not be used in the parallel case
ShouldNotReachHere
();
ShouldNotReachHere
();
...
@@ -230,14 +230,14 @@ void ParCompactionManager::drain_marking_stacks(OopClosure* blk) {
...
@@ -230,14 +230,14 @@ void ParCompactionManager::drain_marking_stacks(OopClosure* blk) {
assert
(
overflow_stack
()
->
length
()
==
0
,
"Sanity"
);
assert
(
overflow_stack
()
->
length
()
==
0
,
"Sanity"
);
}
}
void
ParCompactionManager
::
drain_
chunk
_overflow_stack
()
{
void
ParCompactionManager
::
drain_
region
_overflow_stack
()
{
size_t
chunk
_index
=
(
size_t
)
-
1
;
size_t
region
_index
=
(
size_t
)
-
1
;
while
(
chunk_stack
()
->
retrieve_from_overflow
(
chunk
_index
))
{
while
(
region_stack
()
->
retrieve_from_overflow
(
region
_index
))
{
PSParallelCompact
::
fill_and_update_
chunk
(
this
,
chunk
_index
);
PSParallelCompact
::
fill_and_update_
region
(
this
,
region
_index
);
}
}
}
}
void
ParCompactionManager
::
drain_
chunk
_stacks
()
{
void
ParCompactionManager
::
drain_
region
_stacks
()
{
#ifdef ASSERT
#ifdef ASSERT
ParallelScavengeHeap
*
heap
=
(
ParallelScavengeHeap
*
)
Universe
::
heap
();
ParallelScavengeHeap
*
heap
=
(
ParallelScavengeHeap
*
)
Universe
::
heap
();
assert
(
heap
->
kind
()
==
CollectedHeap
::
ParallelScavengeHeap
,
"Sanity"
);
assert
(
heap
->
kind
()
==
CollectedHeap
::
ParallelScavengeHeap
,
"Sanity"
);
...
@@ -249,42 +249,42 @@ void ParCompactionManager::drain_chunk_stacks() {
...
@@ -249,42 +249,42 @@ void ParCompactionManager::drain_chunk_stacks() {
#if 1 // def DO_PARALLEL - the serial code hasn't been updated
#if 1 // def DO_PARALLEL - the serial code hasn't been updated
do
{
do
{
#ifdef USE_
Chunk
TaskQueueWithOverflow
#ifdef USE_
Region
TaskQueueWithOverflow
// Drain overflow stack first, so other threads can steal from
// Drain overflow stack first, so other threads can steal from
// claimed stack while we work.
// claimed stack while we work.
size_t
chunk
_index
=
(
size_t
)
-
1
;
size_t
region
_index
=
(
size_t
)
-
1
;
while
(
chunk_stack
()
->
retrieve_from_overflow
(
chunk
_index
))
{
while
(
region_stack
()
->
retrieve_from_overflow
(
region
_index
))
{
PSParallelCompact
::
fill_and_update_
chunk
(
this
,
chunk
_index
);
PSParallelCompact
::
fill_and_update_
region
(
this
,
region
_index
);
}
}
while
(
chunk_stack
()
->
retrieve_from_stealable_queue
(
chunk
_index
))
{
while
(
region_stack
()
->
retrieve_from_stealable_queue
(
region
_index
))
{
PSParallelCompact
::
fill_and_update_
chunk
(
this
,
chunk
_index
);
PSParallelCompact
::
fill_and_update_
region
(
this
,
region
_index
);
}
}
}
while
(
!
chunk
_stack
()
->
is_empty
());
}
while
(
!
region
_stack
()
->
is_empty
());
#else
#else
// Drain overflow stack first, so other threads can steal from
// Drain overflow stack first, so other threads can steal from
// claimed stack while we work.
// claimed stack while we work.
while
(
!
chunk
_overflow_stack
()
->
is_empty
())
{
while
(
!
region
_overflow_stack
()
->
is_empty
())
{
size_t
chunk_index
=
chunk
_overflow_stack
()
->
pop
();
size_t
region_index
=
region
_overflow_stack
()
->
pop
();
PSParallelCompact
::
fill_and_update_
chunk
(
this
,
chunk
_index
);
PSParallelCompact
::
fill_and_update_
region
(
this
,
region
_index
);
}
}
size_t
chunk
_index
=
-
1
;
size_t
region
_index
=
-
1
;
// obj is a reference!!!
// obj is a reference!!!
while
(
chunk_stack
()
->
pop_local
(
chunk
_index
))
{
while
(
region_stack
()
->
pop_local
(
region
_index
))
{
// It would be nice to assert about the type of objects we might
// It would be nice to assert about the type of objects we might
// pop, but they can come from anywhere, unfortunately.
// pop, but they can come from anywhere, unfortunately.
PSParallelCompact
::
fill_and_update_
chunk
(
this
,
chunk
_index
);
PSParallelCompact
::
fill_and_update_
region
(
this
,
region
_index
);
}
}
}
while
((
chunk
_stack
()
->
size
()
!=
0
)
||
}
while
((
region
_stack
()
->
size
()
!=
0
)
||
(
chunk
_overflow_stack
()
->
length
()
!=
0
));
(
region
_overflow_stack
()
->
length
()
!=
0
));
#endif
#endif
#ifdef USE_
Chunk
TaskQueueWithOverflow
#ifdef USE_
Region
TaskQueueWithOverflow
assert
(
chunk
_stack
()
->
is_empty
(),
"Sanity"
);
assert
(
region
_stack
()
->
is_empty
(),
"Sanity"
);
#else
#else
assert
(
chunk
_stack
()
->
size
()
==
0
,
"Sanity"
);
assert
(
region
_stack
()
->
size
()
==
0
,
"Sanity"
);
assert
(
chunk
_overflow_stack
()
->
length
()
==
0
,
"Sanity"
);
assert
(
region
_overflow_stack
()
->
length
()
==
0
,
"Sanity"
);
#endif
#endif
#else
#else
oop
obj
;
oop
obj
;
...
...
src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp
浏览文件 @
bee8b017
...
@@ -52,7 +52,7 @@ class ParCompactionManager : public CHeapObj {
...
@@ -52,7 +52,7 @@ class ParCompactionManager : public CHeapObj {
friend
class
ParallelTaskTerminator
;
friend
class
ParallelTaskTerminator
;
friend
class
ParMarkBitMap
;
friend
class
ParMarkBitMap
;
friend
class
PSParallelCompact
;
friend
class
PSParallelCompact
;
friend
class
Steal
Chunk
CompactionTask
;
friend
class
Steal
Region
CompactionTask
;
friend
class
UpdateAndFillClosure
;
friend
class
UpdateAndFillClosure
;
friend
class
RefProcTaskExecutor
;
friend
class
RefProcTaskExecutor
;
...
@@ -72,27 +72,27 @@ class ParCompactionManager : public CHeapObj {
...
@@ -72,27 +72,27 @@ class ParCompactionManager : public CHeapObj {
// ------------------------ End don't putback if not needed
// ------------------------ End don't putback if not needed
private:
private:
static
ParCompactionManager
**
_manager_array
;
static
ParCompactionManager
**
_manager_array
;
static
OopTaskQueueSet
*
_stack_array
;
static
OopTaskQueueSet
*
_stack_array
;
static
ObjectStartArray
*
_start_array
;
static
ObjectStartArray
*
_start_array
;
static
ChunkTaskQueueSet
*
_chunk
_array
;
static
RegionTaskQueueSet
*
_region
_array
;
static
PSOldGen
*
_old_gen
;
static
PSOldGen
*
_old_gen
;
OopTaskQueue
_marking_stack
;
OopTaskQueue
_marking_stack
;
GrowableArray
<
oop
>*
_overflow_stack
;
GrowableArray
<
oop
>*
_overflow_stack
;
// Is there a way to reuse the _marking_stack for the
// Is there a way to reuse the _marking_stack for the
// saving empty
chunk
s? For now just create a different
// saving empty
region
s? For now just create a different
// type of TaskQueue.
// type of TaskQueue.
#ifdef USE_
Chunk
TaskQueueWithOverflow
#ifdef USE_
Region
TaskQueueWithOverflow
ChunkTaskQueueWithOverflow
_chunk
_stack
;
RegionTaskQueueWithOverflow
_region
_stack
;
#else
#else
ChunkTaskQueue
_chunk
_stack
;
RegionTaskQueue
_region
_stack
;
GrowableArray
<
size_t
>*
_chunk
_overflow_stack
;
GrowableArray
<
size_t
>*
_region
_overflow_stack
;
#endif
#endif
#if 1 // does this happen enough to need a per thread stack?
#if 1 // does this happen enough to need a per thread stack?
GrowableArray
<
Klass
*>*
_revisit_klass_stack
;
GrowableArray
<
Klass
*>*
_revisit_klass_stack
;
#endif
#endif
static
ParMarkBitMap
*
_mark_bitmap
;
static
ParMarkBitMap
*
_mark_bitmap
;
...
@@ -100,21 +100,22 @@ class ParCompactionManager : public CHeapObj {
...
@@ -100,21 +100,22 @@ class ParCompactionManager : public CHeapObj {
static
PSOldGen
*
old_gen
()
{
return
_old_gen
;
}
static
PSOldGen
*
old_gen
()
{
return
_old_gen
;
}
static
ObjectStartArray
*
start_array
()
{
return
_start_array
;
}
static
ObjectStartArray
*
start_array
()
{
return
_start_array
;
}
static
OopTaskQueueSet
*
stack_array
()
{
return
_stack_array
;
}
static
OopTaskQueueSet
*
stack_array
()
{
return
_stack_array
;
}
static
void
initialize
(
ParMarkBitMap
*
mbm
);
static
void
initialize
(
ParMarkBitMap
*
mbm
);
protected:
protected:
// Array of tasks. Needed by the ParallelTaskTerminator.
// Array of tasks. Needed by the ParallelTaskTerminator.
static
ChunkTaskQueueSet
*
chunk_array
()
{
return
_chunk_array
;
}
static
RegionTaskQueueSet
*
region_array
()
{
return
_region_array
;
}
OopTaskQueue
*
marking_stack
()
{
return
&
_marking_stack
;
}
OopTaskQueue
*
marking_stack
()
{
return
&
_marking_stack
;
}
GrowableArray
<
oop
>*
overflow_stack
()
{
return
_overflow_stack
;
}
GrowableArray
<
oop
>*
overflow_stack
()
{
return
_overflow_stack
;
}
#ifdef USE_RegionTaskQueueWithOverflow
#ifdef USE_ChunkTaskQueueWithOverflow
RegionTaskQueueWithOverflow
*
region_stack
()
{
return
&
_region_stack
;
}
ChunkTaskQueueWithOverflow
*
chunk_stack
()
{
return
&
_chunk_stack
;
}
#else
#else
ChunkTaskQueue
*
chunk_stack
()
{
return
&
_chunk_stack
;
}
RegionTaskQueue
*
region_stack
()
{
return
&
_region_stack
;
}
GrowableArray
<
size_t
>*
chunk_overflow_stack
()
{
return
_chunk_overflow_stack
;
}
GrowableArray
<
size_t
>*
region_overflow_stack
()
{
return
_region_overflow_stack
;
}
#endif
#endif
// Pushes onto the marking stack. If the marking stack is full,
// Pushes onto the marking stack. If the marking stack is full,
...
@@ -123,9 +124,9 @@ class ParCompactionManager : public CHeapObj {
...
@@ -123,9 +124,9 @@ class ParCompactionManager : public CHeapObj {
// Do not implement an equivalent stack_pop. Deal with the
// Do not implement an equivalent stack_pop. Deal with the
// marking stack and overflow stack directly.
// marking stack and overflow stack directly.
// Pushes onto the
chunk stack. If the chunk
stack is full,
// Pushes onto the
region stack. If the region
stack is full,
// pushes onto the
chunk
overflow stack.
// pushes onto the
region
overflow stack.
void
chunk_stack_push
(
size_t
chunk
_index
);
void
region_stack_push
(
size_t
region
_index
);
public:
public:
Action
action
()
{
return
_action
;
}
Action
action
()
{
return
_action
;
}
...
@@ -160,10 +161,10 @@ class ParCompactionManager : public CHeapObj {
...
@@ -160,10 +161,10 @@ class ParCompactionManager : public CHeapObj {
// Get a oop for scanning. If returns null, no oop were found.
// Get a oop for scanning. If returns null, no oop were found.
oop
retrieve_for_scanning
();
oop
retrieve_for_scanning
();
// Save
chunk
for later processing. Must not fail.
// Save
region
for later processing. Must not fail.
void
save_for_processing
(
size_t
chunk
_index
);
void
save_for_processing
(
size_t
region
_index
);
// Get a
chunk for processing. If returns null, no chunk
were found.
// Get a
region for processing. If returns null, no region
were found.
bool
retrieve_for_processing
(
size_t
&
chunk
_index
);
bool
retrieve_for_processing
(
size_t
&
region
_index
);
// Access function for compaction managers
// Access function for compaction managers
static
ParCompactionManager
*
gc_thread_compaction_manager
(
int
index
);
static
ParCompactionManager
*
gc_thread_compaction_manager
(
int
index
);
...
@@ -172,18 +173,18 @@ class ParCompactionManager : public CHeapObj {
...
@@ -172,18 +173,18 @@ class ParCompactionManager : public CHeapObj {
return
stack_array
()
->
steal
(
queue_num
,
seed
,
t
);
return
stack_array
()
->
steal
(
queue_num
,
seed
,
t
);
}
}
static
bool
steal
(
int
queue_num
,
int
*
seed
,
Chunk
Task
&
t
)
{
static
bool
steal
(
int
queue_num
,
int
*
seed
,
Region
Task
&
t
)
{
return
chunk
_array
()
->
steal
(
queue_num
,
seed
,
t
);
return
region
_array
()
->
steal
(
queue_num
,
seed
,
t
);
}
}
// Process tasks remaining on any stack
// Process tasks remaining on any stack
void
drain_marking_stacks
(
OopClosure
*
blk
);
void
drain_marking_stacks
(
OopClosure
*
blk
);
// Process tasks remaining on any stack
// Process tasks remaining on any stack
void
drain_
chunk
_stacks
();
void
drain_
region
_stacks
();
// Process tasks remaining on any stack
// Process tasks remaining on any stack
void
drain_
chunk
_overflow_stack
();
void
drain_
region
_overflow_stack
();
// Debugging support
// Debugging support
#ifdef ASSERT
#ifdef ASSERT
...
...
src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
浏览文件 @
bee8b017
此差异已折叠。
点击以展开。
src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp
浏览文件 @
bee8b017
此差异已折叠。
点击以展开。
src/share/vm/runtime/globals.hpp
浏览文件 @
bee8b017
...
@@ -1157,9 +1157,9 @@ class CommandLineFlags {
...
@@ -1157,9 +1157,9 @@ class CommandLineFlags {
"In the Parallel Old garbage collector use parallel dense" \
"In the Parallel Old garbage collector use parallel dense" \
" prefix update") \
" prefix update") \
\
\
develop(bool, UseParallelOldGC
ChunkPointerCalc, true,
\
develop(bool, UseParallelOldGC
RegionPointerCalc, true,
\
"In the Parallel Old garbage collector use
chucks to calculate"
\
"In the Parallel Old garbage collector use
regions to calculate"
\
"
new object locations")
\
"
new object locations")
\
\
\
product(uintx, HeapMaximumCompactionInterval, 20, \
product(uintx, HeapMaximumCompactionInterval, 20, \
"How often should we maximally compact the heap (not allowing " \
"How often should we maximally compact the heap (not allowing " \
...
@@ -1195,8 +1195,8 @@ class CommandLineFlags {
...
@@ -1195,8 +1195,8 @@ class CommandLineFlags {
develop(bool, ParallelOldMTUnsafeUpdateLiveData, false, \
develop(bool, ParallelOldMTUnsafeUpdateLiveData, false, \
"Use the Parallel Old MT unsafe in update of live size") \
"Use the Parallel Old MT unsafe in update of live size") \
\
\
develop(bool, Trace
ChunkTasksQueuing, false,
\
develop(bool, Trace
RegionTasksQueuing, false,
\
"Trace the queuing of the
chunk tasks")
\
"Trace the queuing of the
region tasks")
\
\
\
product(uintx, ParallelMarkingThreads, 0, \
product(uintx, ParallelMarkingThreads, 0, \
"Number of marking threads concurrent gc will use") \
"Number of marking threads concurrent gc will use") \
...
...
src/share/vm/utilities/taskqueue.cpp
浏览文件 @
bee8b017
...
@@ -109,72 +109,72 @@ void ParallelTaskTerminator::reset_for_reuse() {
...
@@ -109,72 +109,72 @@ void ParallelTaskTerminator::reset_for_reuse() {
}
}
}
}
bool
Chunk
TaskQueueWithOverflow
::
is_empty
()
{
bool
Region
TaskQueueWithOverflow
::
is_empty
()
{
return
(
_
chunk
_queue
.
size
()
==
0
)
&&
return
(
_
region
_queue
.
size
()
==
0
)
&&
(
_overflow_stack
->
length
()
==
0
);
(
_overflow_stack
->
length
()
==
0
);
}
}
bool
Chunk
TaskQueueWithOverflow
::
stealable_is_empty
()
{
bool
Region
TaskQueueWithOverflow
::
stealable_is_empty
()
{
return
_
chunk
_queue
.
size
()
==
0
;
return
_
region
_queue
.
size
()
==
0
;
}
}
bool
Chunk
TaskQueueWithOverflow
::
overflow_is_empty
()
{
bool
Region
TaskQueueWithOverflow
::
overflow_is_empty
()
{
return
_overflow_stack
->
length
()
==
0
;
return
_overflow_stack
->
length
()
==
0
;
}
}
void
Chunk
TaskQueueWithOverflow
::
initialize
()
{
void
Region
TaskQueueWithOverflow
::
initialize
()
{
_
chunk
_queue
.
initialize
();
_
region
_queue
.
initialize
();
assert
(
_overflow_stack
==
0
,
"Creating memory leak"
);
assert
(
_overflow_stack
==
0
,
"Creating memory leak"
);
_overflow_stack
=
_overflow_stack
=
new
(
ResourceObj
::
C_HEAP
)
GrowableArray
<
Chunk
Task
>
(
10
,
true
);
new
(
ResourceObj
::
C_HEAP
)
GrowableArray
<
Region
Task
>
(
10
,
true
);
}
}
void
ChunkTaskQueueWithOverflow
::
save
(
Chunk
Task
t
)
{
void
RegionTaskQueueWithOverflow
::
save
(
Region
Task
t
)
{
if
(
Trace
Chunk
TasksQueuing
&&
Verbose
)
{
if
(
Trace
Region
TasksQueuing
&&
Verbose
)
{
gclog_or_tty
->
print_cr
(
"CTQ: save "
PTR_FORMAT
,
t
);
gclog_or_tty
->
print_cr
(
"CTQ: save "
PTR_FORMAT
,
t
);
}
}
if
(
!
_
chunk
_queue
.
push
(
t
))
{
if
(
!
_
region
_queue
.
push
(
t
))
{
_overflow_stack
->
push
(
t
);
_overflow_stack
->
push
(
t
);
}
}
}
}
// Note that using this method will retrieve all
chunk
s
// Note that using this method will retrieve all
region
s
// that have been saved but that it will always check
// that have been saved but that it will always check
// the overflow stack. It may be more efficient to
// the overflow stack. It may be more efficient to
// check the stealable queue and the overflow stack
// check the stealable queue and the overflow stack
// separately.
// separately.
bool
ChunkTaskQueueWithOverflow
::
retrieve
(
ChunkTask
&
chunk
_task
)
{
bool
RegionTaskQueueWithOverflow
::
retrieve
(
RegionTask
&
region
_task
)
{
bool
result
=
retrieve_from_overflow
(
chunk
_task
);
bool
result
=
retrieve_from_overflow
(
region
_task
);
if
(
!
result
)
{
if
(
!
result
)
{
result
=
retrieve_from_stealable_queue
(
chunk
_task
);
result
=
retrieve_from_stealable_queue
(
region
_task
);
}
}
if
(
Trace
Chunk
TasksQueuing
&&
Verbose
&&
result
)
{
if
(
Trace
Region
TasksQueuing
&&
Verbose
&&
result
)
{
gclog_or_tty
->
print_cr
(
" CTQ: retrieve "
PTR_FORMAT
,
result
);
gclog_or_tty
->
print_cr
(
" CTQ: retrieve "
PTR_FORMAT
,
result
);
}
}
return
result
;
return
result
;
}
}
bool
Chunk
TaskQueueWithOverflow
::
retrieve_from_stealable_queue
(
bool
Region
TaskQueueWithOverflow
::
retrieve_from_stealable_queue
(
ChunkTask
&
chunk
_task
)
{
RegionTask
&
region
_task
)
{
bool
result
=
_
chunk_queue
.
pop_local
(
chunk
_task
);
bool
result
=
_
region_queue
.
pop_local
(
region
_task
);
if
(
Trace
Chunk
TasksQueuing
&&
Verbose
)
{
if
(
Trace
Region
TasksQueuing
&&
Verbose
)
{
gclog_or_tty
->
print_cr
(
"CTQ: retrieve_stealable "
PTR_FORMAT
,
chunk
_task
);
gclog_or_tty
->
print_cr
(
"CTQ: retrieve_stealable "
PTR_FORMAT
,
region
_task
);
}
}
return
result
;
return
result
;
}
}
bool
ChunkTaskQueueWithOverflow
::
retrieve_from_overflow
(
bool
ChunkTask
&
chunk
_task
)
{
RegionTaskQueueWithOverflow
::
retrieve_from_overflow
(
RegionTask
&
region
_task
)
{
bool
result
;
bool
result
;
if
(
!
_overflow_stack
->
is_empty
())
{
if
(
!
_overflow_stack
->
is_empty
())
{
chunk
_task
=
_overflow_stack
->
pop
();
region
_task
=
_overflow_stack
->
pop
();
result
=
true
;
result
=
true
;
}
else
{
}
else
{
chunk_task
=
(
Chunk
Task
)
NULL
;
region_task
=
(
Region
Task
)
NULL
;
result
=
false
;
result
=
false
;
}
}
if
(
Trace
Chunk
TasksQueuing
&&
Verbose
)
{
if
(
Trace
Region
TasksQueuing
&&
Verbose
)
{
gclog_or_tty
->
print_cr
(
"CTQ: retrieve_stealable "
PTR_FORMAT
,
chunk
_task
);
gclog_or_tty
->
print_cr
(
"CTQ: retrieve_stealable "
PTR_FORMAT
,
region
_task
);
}
}
return
result
;
return
result
;
}
}
src/share/vm/utilities/taskqueue.hpp
浏览文件 @
bee8b017
...
@@ -557,32 +557,32 @@ class StarTask {
...
@@ -557,32 +557,32 @@ class StarTask {
typedef
GenericTaskQueue
<
StarTask
>
OopStarTaskQueue
;
typedef
GenericTaskQueue
<
StarTask
>
OopStarTaskQueue
;
typedef
GenericTaskQueueSet
<
StarTask
>
OopStarTaskQueueSet
;
typedef
GenericTaskQueueSet
<
StarTask
>
OopStarTaskQueueSet
;
typedef
size_t
ChunkTask
;
// index for chunk
typedef
size_t
RegionTask
;
// index for region
typedef
GenericTaskQueue
<
ChunkTask
>
Chunk
TaskQueue
;
typedef
GenericTaskQueue
<
RegionTask
>
Region
TaskQueue
;
typedef
GenericTaskQueueSet
<
ChunkTask
>
Chunk
TaskQueueSet
;
typedef
GenericTaskQueueSet
<
RegionTask
>
Region
TaskQueueSet
;
class
Chunk
TaskQueueWithOverflow
:
public
CHeapObj
{
class
Region
TaskQueueWithOverflow
:
public
CHeapObj
{
protected:
protected:
ChunkTaskQueue
_chunk
_queue
;
RegionTaskQueue
_region
_queue
;
GrowableArray
<
Chunk
Task
>*
_overflow_stack
;
GrowableArray
<
Region
Task
>*
_overflow_stack
;
public:
public:
Chunk
TaskQueueWithOverflow
()
:
_overflow_stack
(
NULL
)
{}
Region
TaskQueueWithOverflow
()
:
_overflow_stack
(
NULL
)
{}
// Initialize both stealable queue and overflow
// Initialize both stealable queue and overflow
void
initialize
();
void
initialize
();
// Save first to stealable queue and then to overflow
// Save first to stealable queue and then to overflow
void
save
(
Chunk
Task
t
);
void
save
(
Region
Task
t
);
// Retrieve first from overflow and then from stealable queue
// Retrieve first from overflow and then from stealable queue
bool
retrieve
(
ChunkTask
&
chunk
_index
);
bool
retrieve
(
RegionTask
&
region
_index
);
// Retrieve from stealable queue
// Retrieve from stealable queue
bool
retrieve_from_stealable_queue
(
ChunkTask
&
chunk
_index
);
bool
retrieve_from_stealable_queue
(
RegionTask
&
region
_index
);
// Retrieve from overflow
// Retrieve from overflow
bool
retrieve_from_overflow
(
ChunkTask
&
chunk
_index
);
bool
retrieve_from_overflow
(
RegionTask
&
region
_index
);
bool
is_empty
();
bool
is_empty
();
bool
stealable_is_empty
();
bool
stealable_is_empty
();
bool
overflow_is_empty
();
bool
overflow_is_empty
();
juint
stealable_size
()
{
return
_
chunk
_queue
.
size
();
}
juint
stealable_size
()
{
return
_
region
_queue
.
size
();
}
ChunkTaskQueue
*
task_queue
()
{
return
&
_chunk
_queue
;
}
RegionTaskQueue
*
task_queue
()
{
return
&
_region
_queue
;
}
};
};
#define USE_
Chunk
TaskQueueWithOverflow
#define USE_
Region
TaskQueueWithOverflow
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录