-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8027545: Improve object array chunking test in G1's copy_to_survivor_…
…space 8158045: Improve large object handling during evacuation 8027761: Investigate fast-path for scanning only objects with references during gc Generate multiple partial array tasks for large objArrays. Reviewed-by: sjohanss, ayang, tschatzl
- Loading branch information
Kim Barrett
committed
Sep 15, 2020
1 parent
7eb4d4a
commit dafcf10
Showing
8 changed files
with
439 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2020, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
* | ||
*/ | ||
|
||
#include "precompiled.hpp" | ||
#include "gc/shared/partialArrayTaskStepper.hpp" | ||
#include "oops/arrayOop.hpp" | ||
#include "utilities/globalDefinitions.hpp" | ||
|
||
static uint compute_task_limit(uint n_workers) { | ||
// Don't need more than n_workers tasks at a time. But allowing up to | ||
// that maximizes available parallelism. | ||
return n_workers; | ||
} | ||
|
||
static uint compute_task_fanout(uint task_limit) { | ||
assert(task_limit > 0, "precondition"); | ||
// There is a tradeoff between providing parallelism more quickly and | ||
// number of enqueued tasks. A constant fanout may be too slow when | ||
// parallelism (and so task_limit) is large. A constant fraction might | ||
// be overly eager. Using log2 attempts to balance between those. | ||
uint result = log2_uint(task_limit); | ||
// result must be > 0. result should be > 1 if task_limit > 1, to | ||
// provide some potentially parallel tasks. But don't just +1 to | ||
// avoid otherwise increasing rate of task generation. | ||
if (result < 2) ++result; | ||
return result; | ||
} | ||
|
||
PartialArrayTaskStepper::PartialArrayTaskStepper(uint n_workers) : | ||
_task_limit(compute_task_limit(n_workers)), | ||
_task_fanout(compute_task_fanout(_task_limit)) | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2020, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
* | ||
*/ | ||
|
||
#ifndef SHARE_GC_SHARED_PARTIALARRAYTASKSTEPPER_HPP | ||
#define SHARE_GC_SHARED_PARTIALARRAYTASKSTEPPER_HPP | ||
|
||
#include "oops/arrayOop.hpp" | ||
#include "utilities/globalDefinitions.hpp" | ||
|
||
// Helper for handling PartialArrayTasks. | ||
// | ||
// When an array is large, we want to split it up into chunks that can be | ||
// processed in parallel. Each task (implicitly) represents such a chunk. | ||
// We can enqueue multiple tasks at the same time. We want to enqueue | ||
// enough tasks to benefit from the available parallelism, while not so many | ||
// as to substantially expand the task queues. | ||
// | ||
// A task directly refers to the from-space array. The from-space array's | ||
// forwarding pointer refers to the associated to-space array, and its | ||
// length is the actual length. The to-space array's length field is used to | ||
// indicate processing progress. It is the starting index of the next chunk | ||
// to process, or equals the actual length when there are no more chunks to | ||
// be processed. | ||
class PartialArrayTaskStepper { | ||
public: | ||
PartialArrayTaskStepper(uint n_workers); | ||
|
||
struct Step { | ||
int _index; // Array index for the step. | ||
uint _ncreate; // Number of new tasks to create. | ||
}; | ||
|
||
// Set to's length to the end of the initial chunk, which is the start of | ||
// the first partial task if the array is large enough to need splitting. | ||
// Returns a Step with _index being that index and _ncreate being the | ||
// initial number of partial tasks to enqueue. | ||
inline Step start(arrayOop from, arrayOop to, int chunk_size) const; | ||
|
||
// Increment to's length by chunk_size to claim the next chunk. Returns a | ||
// Step with _index being the starting index of the claimed chunk and | ||
// _ncreate being the number of additional partial tasks to enqueue. | ||
// precondition: chunk_size must be the same as used to start the task sequence. | ||
inline Step next(arrayOop from, arrayOop to, int chunk_size) const; | ||
|
||
class TestSupport; // For unit tests | ||
|
||
private: | ||
// Limit on the number of partial array tasks to create for a given array. | ||
uint _task_limit; | ||
// Maximum number of new tasks to create when processing an existing task. | ||
uint _task_fanout; | ||
|
||
// Split start/next into public part dealing with oops and private | ||
// impl dealing with lengths and pointers to lengths, for unit testing. | ||
// length is the actual length obtained from the from-space object. | ||
// to_length_addr is the address of the to-space object's length value. | ||
inline Step start_impl(int length, int* to_length_addr, int chunk_size) const; | ||
inline Step next_impl(int length, int* to_length_addr, int chunk_size) const; | ||
}; | ||
|
||
#endif // SHARE_GC_SHARED_PARTIALARRAYTASKSTEPPER_HPP |
Oops, something went wrong.
dafcf10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review
Issues