Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Automatic merge of jdk:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Sep 30, 2020
2 parents 82bc7ce + a55cde4 commit 74f7f5f
Show file tree
Hide file tree
Showing 253 changed files with 2,449 additions and 1,974 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp
Expand Up @@ -149,7 +149,7 @@ jlong CgroupV2Subsystem::memory_max_usage_in_bytes() {
}

char* CgroupV2Subsystem::mem_soft_limit_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/memory.high",
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/memory.low",
"Memory Soft Limit is: %s", "%s", mem_soft_limit_str, 1024);
if (mem_soft_limit_str == NULL) {
return NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/classfile/javaClasses.inline.hpp
Expand Up @@ -113,7 +113,7 @@ void java_lang_ref_Reference::set_referent_raw(oop ref, oop value) {
}

HeapWord* java_lang_ref_Reference::referent_addr_raw(oop ref) {
return ref->obj_field_addr_raw<HeapWord>(_referent_offset);
return ref->obj_field_addr<HeapWord>(_referent_offset);
}

oop java_lang_ref_Reference::next(oop ref) {
Expand All @@ -129,7 +129,7 @@ void java_lang_ref_Reference::set_next_raw(oop ref, oop value) {
}

HeapWord* java_lang_ref_Reference::next_addr_raw(oop ref) {
return ref->obj_field_addr_raw<HeapWord>(_next_offset);
return ref->obj_field_addr<HeapWord>(_next_offset);
}

oop java_lang_ref_Reference::discovered(oop ref) {
Expand All @@ -145,7 +145,7 @@ void java_lang_ref_Reference::set_discovered_raw(oop ref, oop value) {
}

HeapWord* java_lang_ref_Reference::discovered_addr_raw(oop ref) {
return ref->obj_field_addr_raw<HeapWord>(_discovered_offset);
return ref->obj_field_addr<HeapWord>(_discovered_offset);
}

bool java_lang_ref_Reference::is_final(oop ref) {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
Expand Up @@ -48,7 +48,7 @@ class G1ResetHumongousClosure : public HeapRegionClosure {
if (_bitmap->is_marked(obj)) {
// Clear bitmap and fix mark word.
_bitmap->clear(obj);
obj->init_mark_raw();
obj->init_mark();
} else {
assert(current->is_empty(), "Should have been cleared in phase 2.");
}
Expand All @@ -71,7 +71,7 @@ size_t G1FullGCCompactTask::G1CompactRegionClosure::apply(oop obj) {
HeapWord* obj_addr = cast_from_oop<HeapWord*>(obj);
assert(obj_addr != destination, "everything in this pass should be moving");
Copy::aligned_conjoint_words(obj_addr, destination, size);
oop(destination)->init_mark_raw();
oop(destination)->init_mark();
assert(oop(destination)->klass() != NULL, "should have a class");

return size;
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
Expand Up @@ -112,15 +112,15 @@ void G1FullGCCompactionPoint::forward(oop object, size_t size) {
// with BiasedLocking, in this case forwardee() will return NULL
// even if the mark-word is used. This is no problem since
// forwardee() will return NULL in the compaction phase as well.
object->init_mark_raw();
object->init_mark();
} else {
// Make sure object has the correct mark-word set or that it will be
// fixed when restoring the preserved marks.
assert(object->mark_raw() == markWord::prototype_for_klass(object->klass()) || // Correct mark
assert(object->mark() == markWord::prototype_for_klass(object->klass()) || // Correct mark
object->mark_must_be_preserved() || // Will be restored by PreservedMarksSet
(UseBiasedLocking && object->has_bias_pattern_raw()), // Will be restored by BiasedLocking
(UseBiasedLocking && object->has_bias_pattern()), // Will be restored by BiasedLocking
"should have correct prototype obj: " PTR_FORMAT " mark: " PTR_FORMAT " prototype: " PTR_FORMAT,
p2i(object), object->mark_raw().value(), markWord::prototype_for_klass(object->klass()).value());
p2i(object), object->mark().value(), markWord::prototype_for_klass(object->klass()).value());
}
assert(object->forwardee() == NULL, "should be forwarded to NULL");
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp
Expand Up @@ -50,7 +50,7 @@ inline bool G1FullGCMarker::mark_object(oop obj) {
}

// Marked by us, preserve if needed.
markWord mark = obj->mark_raw();
markWord mark = obj->mark();
if (obj->mark_must_be_preserved(mark) &&
!G1ArchiveAllocator::is_open_archive_object(obj)) {
preserved_stack()->push(obj, mark);
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp
Expand Up @@ -77,11 +77,11 @@ template <class T> inline void G1AdjustClosure::adjust_pointer(T* p) {
oop forwardee = obj->forwardee();
if (forwardee == NULL) {
// Not forwarded, return current reference.
assert(obj->mark_raw() == markWord::prototype_for_klass(obj->klass()) || // Correct mark
assert(obj->mark() == markWord::prototype_for_klass(obj->klass()) || // Correct mark
obj->mark_must_be_preserved() || // Will be restored by PreservedMarksSet
(UseBiasedLocking && obj->has_bias_pattern_raw()), // Will be restored by BiasedLocking
(UseBiasedLocking && obj->has_bias_pattern()), // Will be restored by BiasedLocking
"Must have correct prototype or be preserved, obj: " PTR_FORMAT ", mark: " PTR_FORMAT ", prototype: " PTR_FORMAT,
p2i(obj), obj->mark_raw().value(), markWord::prototype_for_klass(obj->klass()).value());
p2i(obj), obj->mark().value(), markWord::prototype_for_klass(obj->klass()).value());
return;
}

Expand Down
21 changes: 9 additions & 12 deletions src/hotspot/share/gc/g1/g1MMUTracker.cpp
Expand Up @@ -39,15 +39,12 @@

G1MMUTracker::G1MMUTracker(double time_slice, double max_gc_time) :
_time_slice(time_slice),
_max_gc_time(max_gc_time) { }

G1MMUTrackerQueue::G1MMUTrackerQueue(double time_slice, double max_gc_time) :
G1MMUTracker(time_slice, max_gc_time),
_max_gc_time(max_gc_time),
_head_index(0),
_tail_index(trim_index(_head_index+1)),
_no_entries(0) { }

void G1MMUTrackerQueue::remove_expired_entries(double current_time) {
void G1MMUTracker::remove_expired_entries(double current_time) {
double limit = current_time - _time_slice;
while (_no_entries > 0) {
if (is_double_geq(limit, _array[_tail_index].end_time())) {
Expand All @@ -59,12 +56,12 @@ void G1MMUTrackerQueue::remove_expired_entries(double current_time) {
guarantee(_no_entries == 0, "should have no entries in the array");
}

double G1MMUTrackerQueue::calculate_gc_time(double current_time) {
double G1MMUTracker::calculate_gc_time(double current_time) {
double gc_time = 0.0;
double limit = current_time - _time_slice;
for (int i = 0; i < _no_entries; ++i) {
int index = trim_index(_tail_index + i);
G1MMUTrackerQueueElem *elem = &_array[index];
G1MMUTrackerElem *elem = &_array[index];
if (elem->end_time() > limit) {
if (elem->start_time() > limit)
gc_time += elem->duration();
Expand All @@ -75,7 +72,7 @@ double G1MMUTrackerQueue::calculate_gc_time(double current_time) {
return gc_time;
}

void G1MMUTrackerQueue::add_pause(double start, double end) {
void G1MMUTracker::add_pause(double start, double end) {
remove_expired_entries(end);
if (_no_entries == QueueLength) {
// OK, we've filled up the queue. There are a few ways
Expand All @@ -99,7 +96,7 @@ void G1MMUTrackerQueue::add_pause(double start, double end) {
_head_index = trim_index(_head_index + 1);
++_no_entries;
}
_array[_head_index] = G1MMUTrackerQueueElem(start, end);
_array[_head_index] = G1MMUTrackerElem(start, end);

// Current entry needs to be added before calculating the value
double slice_time = calculate_gc_time(end);
Expand All @@ -114,7 +111,7 @@ void G1MMUTrackerQueue::add_pause(double start, double end) {
}
}

double G1MMUTrackerQueue::when_sec(double current_time, double pause_time) {
double G1MMUTracker::when_sec(double current_time, double pause_time) {
// if the pause is over the maximum, just assume that it's the maximum
double adjusted_pause_time =
(pause_time > max_gc_time()) ? max_gc_time() : pause_time;
Expand All @@ -126,13 +123,13 @@ double G1MMUTrackerQueue::when_sec(double current_time, double pause_time) {
return 0.0;

if (adjusted_pause_time == max_gc_time()) {
G1MMUTrackerQueueElem *elem = &_array[_head_index];
G1MMUTrackerElem *elem = &_array[_head_index];
return elem->end_time() - limit;
}

int index = _tail_index;
while ( 1 ) {
G1MMUTrackerQueueElem *elem = &_array[index];
G1MMUTrackerElem *elem = &_array[index];
if (elem->end_time() > limit) {
if (elem->start_time() > limit)
diff -= elem->duration();
Expand Down
98 changes: 44 additions & 54 deletions src/hotspot/share/gc/g1/g1MMUTracker.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
Expand Down Expand Up @@ -29,45 +29,7 @@
#include "memory/allocation.hpp"
#include "utilities/debug.hpp"

// Two major user controls over G1 behavior are setting a pause time goal (MaxGCPauseMillis),
// over a time slice (GCPauseIntervalMillis). This defines the Minimum Mutator
// Utilisation (MMU) goal.
//
// * Definitions *
// Mutator Utilisation:
// - for a given time slice duration "ts",
// - mutator utilisation is the following fraction:
// non_gc_time / ts
//
// Minimum Mutator Utilisation (MMU):
// - the worst mutator utilisation across all time slices.
//
// G1MMUTracker keeps track of the GC work and decides when it is OK to do GC work
// and for how long so that the MMU invariants are maintained.
//
// ***** ALL TIMES ARE IN SECS!!!!!!! *****
// this is the "interface"
class G1MMUTracker: public CHeapObj<mtGC> {
protected:
double _time_slice;
double _max_gc_time; // this is per time slice

public:
G1MMUTracker(double time_slice, double max_gc_time);

virtual void add_pause(double start, double end) = 0;
virtual double when_sec(double current_time, double pause_time) = 0;

double max_gc_time() const {
return _max_gc_time;
}

inline double when_max_gc_sec(double current_time) {
return when_sec(current_time, max_gc_time());
}
};

class G1MMUTrackerQueueElem {
class G1MMUTrackerElem {
private:
double _start_time;
double _end_time;
Expand All @@ -77,25 +39,45 @@ class G1MMUTrackerQueueElem {
inline double end_time() { return _end_time; }
inline double duration() { return _end_time - _start_time; }

G1MMUTrackerQueueElem() {
G1MMUTrackerElem() {
_start_time = 0.0;
_end_time = 0.0;
}

G1MMUTrackerQueueElem(double start_time, double end_time) {
G1MMUTrackerElem(double start_time, double end_time) {
_start_time = start_time;
_end_time = end_time;
}
};

// this is an implementation of the MMUTracker using a (fixed-size) queue
// that keeps track of all the recent pause times
class G1MMUTrackerQueue: public G1MMUTracker {

// Two major user controls over G1 behavior are setting a pause
// time goal (MaxGCPauseMillis), over a time slice (GCPauseIntervalMillis).
// This defines the Minimum Mutator Utilisation (MMU) goal.
//
// * Definitions *
// Mutator Utilisation:
// - for a given time slice duration "ts",
// - mutator utilisation is the following fraction:
// non_gc_time / ts
//
// Minimum Mutator Utilisation (MMU):
// - the worst mutator utilisation across all time slices.
//
// The G1MMUTracker uses a fixed-size queue to keep track of all
// recent pause times. The pause time data is used to avoid
// breaking the MMU.
//
// ***** ALL TIMES ARE IN SECS!!!!!!! *****
class G1MMUTracker: public CHeapObj<mtGC> {
private:
enum PrivateConstants {
QueueLength = 64
};

double _time_slice;
double _max_gc_time; // this is per time slice

// The array keeps track of all the pauses that fall within a time
// slice (the last time slice during which pauses took place).
// The data structure implemented is a circular queue.
Expand All @@ -105,13 +87,13 @@ class G1MMUTrackerQueue: public G1MMUTracker {
// If the array is full, an easy fix is to look for the pauses with
// the shortest gap between them and consolidate them.
// For now, we have taken the expedient alternative of forgetting
// the oldest entry in the event that +G1UseFixedWindowMMUTracker, thus
// potentially violating MMU specs for some time thereafter.
// the oldest entry, thus potentially violating MMU specs for
// some time thereafter.

G1MMUTrackerQueueElem _array[QueueLength];
int _head_index;
int _tail_index;
int _no_entries;
G1MMUTrackerElem _array[QueueLength];
int _head_index;
int _tail_index;
int _no_entries;

inline int trim_index(int index) {
return (index + QueueLength) % QueueLength;
Expand All @@ -121,11 +103,19 @@ class G1MMUTrackerQueue: public G1MMUTracker {
double calculate_gc_time(double current_time);

public:
G1MMUTrackerQueue(double time_slice, double max_gc_time);
G1MMUTracker(double time_slice, double max_gc_time);

void add_pause(double start, double end);

virtual void add_pause(double start, double end);
double when_sec(double current_time, double pause_time);

virtual double when_sec(double current_time, double pause_time);
double max_gc_time() const {
return _max_gc_time;
}

double when_max_gc_sec(double current_time) {
return when_sec(current_time, max_gc_time());
}
};

#endif // SHARE_GC_G1_G1MMUTRACKER_HPP
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1OopClosures.inline.hpp
Expand Up @@ -47,8 +47,8 @@ inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) {
// stall. We'll try to prefetch the object (for write, given that
// we might need to install the forwarding reference) and we'll
// get back to it when pop it from the queue
Prefetch::write(obj->mark_addr_raw(), 0);
Prefetch::read(obj->mark_addr_raw(), (HeapWordSize*2));
Prefetch::write(obj->mark_addr(), 0);
Prefetch::read(obj->mark_addr(), (HeapWordSize*2));

// slightly paranoid test; I'm trying to catch potential
// problems before we go into push_on_queue to know where the
Expand Down Expand Up @@ -231,7 +231,7 @@ void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
const G1HeapRegionAttr state = _g1h->region_attr(obj);
if (state.is_in_cset()) {
oop forwardee;
markWord m = obj->mark_raw();
markWord m = obj->mark();
if (m.is_marked()) {
forwardee = (oop) m.decode_pointer();
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
Expand Up @@ -193,7 +193,7 @@ void G1ParScanThreadState::do_oop_evac(T* p) {
return;
}

markWord m = obj->mark_raw();
markWord m = obj->mark();
if (m.is_marked()) {
obj = (oop) m.decode_pointer();
} else {
Expand Down Expand Up @@ -485,15 +485,15 @@ oop G1ParScanThreadState::do_copy_to_survivor_space(G1HeapRegionAttr const regio
// In this case, we have to install the mark word first,
// otherwise obj looks to be forwarded (the old mark word,
// which contains the forward pointer, was copied)
obj->set_mark_raw(old_mark);
obj->set_mark(old_mark);
markWord new_mark = old_mark.displaced_mark_helper().set_age(age);
old_mark.set_displaced_mark_helper(new_mark);
} else {
obj->set_mark_raw(old_mark.set_age(age));
obj->set_mark(old_mark.set_age(age));
}
_age_table.add(age, word_sz);
} else {
obj->set_mark_raw(old_mark);
obj->set_mark(old_mark);
}

// Most objects are not arrays, so do one array check rather than
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1Policy.cpp
Expand Up @@ -56,7 +56,7 @@ G1Policy::G1Policy(STWGCTimer* gc_timer) :
_predictor(G1ConfidencePercent / 100.0),
_analytics(new G1Analytics(&_predictor)),
_remset_tracker(),
_mmu_tracker(new G1MMUTrackerQueue(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
_mmu_tracker(new G1MMUTracker(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
_old_gen_alloc_tracker(),
_ihop_control(create_ihop_control(&_old_gen_alloc_tracker, &_predictor)),
_policy_counters(new GCPolicyCounters("GarbageFirst", 1, 2)),
Expand Down

0 comments on commit 74f7f5f

Please sign in to comment.