mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
7119584: UseParallelGC barrier task can be overwritten
Provoke a GC for a metadata allocation failure. Reviewed-by: johnc, iveresov
This commit is contained in:
parent
bb40d3f9f4
commit
714e978aac
2 changed files with 22 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, 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
|
||||
|
@ -53,6 +53,9 @@ const char* GCTask::Kind::to_string(kind value) {
|
|||
case noop_task:
|
||||
result = "noop task";
|
||||
break;
|
||||
case idle_task:
|
||||
result = "idle task";
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
@ -782,6 +785,12 @@ void GCTaskManager::note_release(uint which) {
|
|||
void GCTaskManager::execute_and_wait(GCTaskQueue* list) {
|
||||
WaitForBarrierGCTask* fin = WaitForBarrierGCTask::create();
|
||||
list->enqueue(fin);
|
||||
// The barrier task will be read by one of the GC
|
||||
// workers once it is added to the list of tasks.
|
||||
// Be sure that is globally visible before the
|
||||
// GC worker reads it (which is after the task is added
|
||||
// to the list of tasks below).
|
||||
OrderAccess::storestore();
|
||||
add_list(list);
|
||||
fin->wait_for(true /* reset */);
|
||||
// We have to release the barrier tasks!
|
||||
|
@ -833,11 +842,15 @@ void NoopGCTask::destruct() {
|
|||
|
||||
IdleGCTask* IdleGCTask::create() {
|
||||
IdleGCTask* result = new IdleGCTask(false);
|
||||
assert(UseDynamicNumberOfGCThreads,
|
||||
"Should only be used with dynamic GC thread");
|
||||
return result;
|
||||
}
|
||||
|
||||
IdleGCTask* IdleGCTask::create_on_c_heap() {
|
||||
IdleGCTask* result = new(ResourceObj::C_HEAP) IdleGCTask(true);
|
||||
assert(UseDynamicNumberOfGCThreads,
|
||||
"Should only be used with dynamic GC thread");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue