Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBing committed Apr 27, 2024
1 parent f02334f commit a76a71d
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 34 deletions.
26 changes: 12 additions & 14 deletions src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ uint G1CollectedHeap::get_chunks_per_region() {
}

G1HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
MemRegion mr) {
MemRegion mr) {
return new G1HeapRegion(hrs_index, bot(), mr, &_card_set_config);
}

// Private methods.

G1HeapRegion* G1CollectedHeap::new_region(size_t word_size,
HeapRegionType type,
bool do_expand,
uint node_index) {
HeapRegionType type,
bool do_expand,
uint node_index) {
assert(!is_humongous(word_size) || word_size <= G1HeapRegion::GrainWords,
"the only time we use this to allocate a humongous region is "
"when we are allocating a single humongous region");
Expand Down Expand Up @@ -995,8 +995,7 @@ HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {

bool G1CollectedHeap::expand(size_t expand_bytes, WorkerThreads* pretouch_workers, double* expand_time_ms) {
size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes);
aligned_expand_bytes = align_up(aligned_expand_bytes,
G1HeapRegion::GrainBytes);
aligned_expand_bytes = align_up(aligned_expand_bytes, G1HeapRegion::GrainBytes);

log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: " SIZE_FORMAT "B expansion amount: " SIZE_FORMAT "B",
expand_bytes, aligned_expand_bytes);
Expand Down Expand Up @@ -1040,8 +1039,7 @@ bool G1CollectedHeap::expand_single_region(uint node_index) {
void G1CollectedHeap::shrink_helper(size_t shrink_bytes) {
size_t aligned_shrink_bytes =
ReservedSpace::page_align_size_down(shrink_bytes);
aligned_shrink_bytes = align_down(aligned_shrink_bytes,
G1HeapRegion::GrainBytes);
aligned_shrink_bytes = align_down(aligned_shrink_bytes, G1HeapRegion::GrainBytes);
uint num_regions_to_remove = (uint)(shrink_bytes / G1HeapRegion::GrainBytes);

uint num_regions_removed = _hrm.shrink_by(num_regions_to_remove);
Expand Down Expand Up @@ -2857,9 +2855,9 @@ G1HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
bool should_allocate = policy()->should_allocate_mutator_region();
if (force || should_allocate) {
G1HeapRegion* new_alloc_region = new_region(word_size,
HeapRegionType::Eden,
false /* do_expand */,
node_index);
HeapRegionType::Eden,
false /* do_expand */,
node_index);
if (new_alloc_region != nullptr) {
set_region_short_lived_locked(new_alloc_region);
_hr_printer.alloc(new_alloc_region, !should_allocate);
Expand Down Expand Up @@ -2911,9 +2909,9 @@ G1HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size, G1HeapRegio
}

G1HeapRegion* new_alloc_region = new_region(word_size,
type,
true /* do_expand */,
node_index);
type,
true /* do_expand */,
node_index);

if (new_alloc_region != nullptr) {
if (type.is_survivor()) {
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1CollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ class G1CollectedHeap : public CollectedHeap {
// request. 'type' takes the type of region to be allocated. (Use constants
// Old, Eden, Humongous, Survivor defined in HeapRegionType.)
G1HeapRegion* new_region(size_t word_size,
HeapRegionType type,
bool do_expand,
uint node_index = G1NUMA::AnyNodeIndex);
HeapRegionType type,
bool do_expand,
uint node_index = G1NUMA::AnyNodeIndex);

// Initialize a contiguous set of free regions of length num_regions
// and starting at index first so that they appear as a single
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1CollectionSetChooser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class G1CollectionSetChooser : public AllStatic {

public:
static size_t mixed_gc_live_threshold_bytes() {
return G1HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
return G1HeapRegion::GrainBytes * (size_t)G1MixedGCLiveThresholdPercent / 100;
}

static bool region_occupancy_low_enough_for_evac(size_t live_bytes) {
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1HeapRegionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ uint HeapRegionManager::find_highest_free(bool* expanded) {
// entry which is either free or not yet committed. If not yet
// committed, expand at that index.
for (uint curr = reserved_length(); curr-- > 0;) {
G1HeapRegion *hr = _regions.get_by_index(curr);
G1HeapRegion* hr = _regions.get_by_index(curr);
if (hr == nullptr || !is_available(curr)) {
// Found uncommitted and free region, expand to make it available for use.
expand_exact(curr, 1, nullptr);
Expand Down Expand Up @@ -800,9 +800,9 @@ class G1RebuildFreeListTask : public WorkerTask {
return;
}

FreeRegionList *free_list = worker_freelist(worker_id);
FreeRegionList* free_list = worker_freelist(worker_id);
for (uint i = start; i < end; i++) {
G1HeapRegion *region = _hrm->at_or_null(i);
G1HeapRegion* region = _hrm->at_or_null(i);
if (region != nullptr && region->is_free()) {
// Need to clear old links to allow to be added to new freelist.
region->unlink_from_list();
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1HeapRegionSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class FreeRegionList : public HeapRegionSetBase {
class FreeRegionListIterator : public StackObj {
private:
FreeRegionList* _list;
G1HeapRegion* _curr;
G1HeapRegion* _curr;

public:
bool more_available() {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1HeapVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ class VerifyObjsInRegionClosure: public ObjectClosure {
private:
G1CollectedHeap* _g1h;
size_t _live_bytes;
G1HeapRegion *_hr;
G1HeapRegion* _hr;
VerifyOption _vo;

public:
VerifyObjsInRegionClosure(G1HeapRegion *hr, VerifyOption vo)
VerifyObjsInRegionClosure(G1HeapRegion* hr, VerifyOption vo)
: _live_bytes(0), _hr(hr), _vo(vo) {
_g1h = G1CollectedHeap::heap();
}
Expand Down
18 changes: 9 additions & 9 deletions src/hotspot/share/gc/g1/vmStructs_g1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
volatile_nonstatic_field, \
static_field) \
\
static_field(G1HeapRegion, GrainBytes, size_t) \
static_field(G1HeapRegion, LogOfHRGrainBytes, uint) \
static_field(G1HeapRegion, GrainBytes, size_t) \
static_field(G1HeapRegion, LogOfHRGrainBytes, uint) \
\
nonstatic_field(G1HeapRegion, _type, HeapRegionType) \
nonstatic_field(G1HeapRegion, _bottom, HeapWord* const) \
nonstatic_field(G1HeapRegion, _top, HeapWord* volatile) \
nonstatic_field(G1HeapRegion, _end, HeapWord* const) \
volatile_nonstatic_field(G1HeapRegion, _pinned_object_count, size_t) \
nonstatic_field(G1HeapRegion, _type, HeapRegionType) \
nonstatic_field(G1HeapRegion, _bottom, HeapWord* const) \
nonstatic_field(G1HeapRegion, _top, HeapWord* volatile) \
nonstatic_field(G1HeapRegion, _end, HeapWord* const) \
volatile_nonstatic_field(G1HeapRegion, _pinned_object_count, size_t) \
\
nonstatic_field(HeapRegionType, _tag, HeapRegionType::Tag volatile) \
\
Expand Down Expand Up @@ -93,7 +93,7 @@
\
declare_type(G1CollectedHeap, CollectedHeap) \
\
declare_toplevel_type(G1HeapRegion) \
declare_toplevel_type(G1HeapRegion) \
declare_toplevel_type(HeapRegionManager) \
declare_toplevel_type(HeapRegionSetBase) \
declare_toplevel_type(G1MonitoringSupport) \
Expand All @@ -103,7 +103,7 @@
declare_toplevel_type(G1DirtyCardQueue) \
\
declare_toplevel_type(G1CollectedHeap*) \
declare_toplevel_type(G1HeapRegion*) \
declare_toplevel_type(G1HeapRegion*) \
declare_toplevel_type(G1MonitoringSupport*) \
\
declare_integer_type(HeapRegionType::Tag volatile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void run() {
printValMB("CompressedClassSpaceSize = ", getFlagValue("CompressedClassSpaceSize", flagMap));
printValMB("MaxMetaspaceSize = ", getFlagValue("MaxMetaspaceSize", flagMap));
if (heap instanceof G1CollectedHeap) {
printValMB("G1HeapRegionSize = ", G1HeapRegion.grainBytes());
printValMB("G1HeapRegionSize = ", G1HeapRegion.grainBytes());
}

System.out.println();
Expand Down

0 comments on commit a76a71d

Please sign in to comment.