-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[Draft] Test/shen oc #26433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[Draft] Test/shen oc #26433
Changes from all commits
3da9f89
ec5ad1a
354deee
359caff
adea2fc
c535645
a135b2d
4826229
00b15d6
461b71c
33aa1da
cb368f6
3d05ece
523ec03
82bb883
405e0d9
d1a1e6b
a868e9b
16eee14
e4747f2
0a9c094
b88dce2
5f912be
08fc38c
4c02ed1
520f534
b3b5706
5f77ceb
5466e0e
afe3f12
6c6e966
57d4ea0
1c371b2
b1d8145
24523e7
dd3cd66
69f0813
eff8b16
5bf562b
f3957f0
9ab1d45
0d5b154
8319955
046be80
016196b
35043ee
3b3ed70
fd0418c
97028a7
5de6cc9
0d2a8a8
15859c1
f555bfa
a794546
bbc5ff0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
#include "gc/shared/objectCountClosure.hpp" | ||
#include "gc/shared/objectCountEventSender.hpp" | ||
#include "jfr/jfrEvents.hpp" | ||
#include "memory/heapInspection.hpp" | ||
#include "utilities/macros.hpp" | ||
#include "utilities/ticks.hpp" | ||
|
||
#if INCLUDE_SERVICES | ||
|
||
KlassInfoTable* ObjectCountClosure::cit = nullptr; | ||
|
||
void ObjectCountClosure::reset_table() { | ||
if (!check_table_exists()) { | ||
return; | ||
} | ||
cit->clear_entries(); | ||
} | ||
|
||
|
||
bool ObjectCountClosure::check_table_exists() { | ||
if (cit == nullptr) { | ||
static KlassInfoTable temp_table(false); | ||
cit = &temp_table; | ||
} | ||
return !cit->allocation_failed(); | ||
} | ||
|
||
bool ObjectCountClosure::record_object(oop o) { | ||
if (!check_table_exists()) { | ||
return false; | ||
} | ||
return cit->record_instance(o); | ||
} | ||
|
||
KlassInfoTable* ObjectCountClosure::get_table() { | ||
return check_table_exists() ? cit : nullptr; | ||
} | ||
|
||
|
||
template <class Event> | ||
bool ObjectCountClosure::should_send_event() { | ||
return ObjectCountEventSender::should_send_event<Event>(); | ||
} | ||
|
||
template bool ObjectCountClosure::should_send_event<EventObjectCount>(); | ||
template bool ObjectCountClosure::should_send_event<EventObjectCountAfterGC>(); | ||
|
||
#endif // INCLUDE_SERVICES |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef SHARE_GC_SHARED_OBJECTCOUNTCLOSURE_HPP | ||
#define SHARE_GC_SHARED_OBJECTCOUNTCLOSURE_HPP | ||
|
||
#include "gc/shared/gcId.hpp" | ||
#include "gc/shared/objectCountEventSender.hpp" | ||
#include "jfr/jfrEvents.hpp" | ||
#include "memory/allStatic.hpp" | ||
#include "runtime/mutex.hpp" | ||
#include "memory/heapInspection.hpp" | ||
#include "utilities/macros.hpp" | ||
#include "utilities/ticks.hpp" | ||
|
||
class KlassInfoEntry; | ||
class Klass; | ||
|
||
class ObjectCountClosure : public AllStatic { | ||
static KlassInfoTable* cit; | ||
|
||
public: | ||
pf0n marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Return false if allocation of KlassInfoTable failed. | ||
static bool check_table_exists(); | ||
pf0n marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Return false if object could not be recorded in the KlassInfoTable. | ||
static bool record_object(oop o); | ||
// Returns the KlassInfoTable if it exists, otherwise returns nullptr. | ||
static KlassInfoTable* get_table(); | ||
// Clear entries of the KlassInfoTable | ||
static void reset_table(); | ||
|
||
// Returns true if event is enabled | ||
template <class Event> | ||
static bool should_send_event(); | ||
}; | ||
|
||
#endif // SHARE_GC_SHARED_OBJECTCOUNTCLOSURE_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,13 +28,15 @@ | |
#include "gc/shared/barrierSetNMethod.hpp" | ||
#include "gc/shared/collectorCounters.hpp" | ||
#include "gc/shared/continuationGCSupport.inline.hpp" | ||
#include "gc/shared/gcTrace.hpp" | ||
#include "gc/shenandoah/shenandoahBreakpoint.hpp" | ||
#include "gc/shenandoah/shenandoahClosures.inline.hpp" | ||
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp" | ||
#include "gc/shenandoah/shenandoahConcurrentGC.hpp" | ||
#include "gc/shenandoah/shenandoahFreeSet.hpp" | ||
#include "gc/shenandoah/shenandoahGeneration.hpp" | ||
#include "gc/shenandoah/shenandoahGenerationalHeap.hpp" | ||
#include "gc/shenandoah/shenandoahHeap.hpp" | ||
#include "gc/shenandoah/shenandoahLock.hpp" | ||
#include "gc/shenandoah/shenandoahMark.inline.hpp" | ||
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp" | ||
|
@@ -770,6 +772,11 @@ void ShenandoahConcurrentGC::op_final_mark() { | |
heap->verifier()->verify_roots_no_forwarded(); | ||
} | ||
|
||
{ | ||
heap->tracer()->report_object_count(); | ||
} | ||
|
||
|
||
Comment on lines
+775
to
+779
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, move this out of the safepoint. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the call-site, assert that we aren't at a safepoint. This would help you when you do the concurrent ObjectCount events, and also manage potential for interference with GC's and ObjectCountAfterGC. Make sure to do this state recording before you start working on the concurrent ObjectCount recording. |
||
if (!heap->cancelled_gc()) { | ||
_mark.finish_mark(); | ||
assert(!heap->cancelled_gc(), "STW mark cannot OOM"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,9 +217,10 @@ bool KlassInfoTable::record_instance(const oop obj) { | |
// elt may be null if it's a new klass for which we | ||
// could not allocate space for a new entry in the hashtable. | ||
if (elt != nullptr) { | ||
elt->set_count(elt->count() + 1); | ||
elt->set_words(elt->words() + obj->size()); | ||
_size_of_instances_in_words += obj->size(); | ||
elt->atomic_inc_count(); | ||
pf0n marked this conversation as resolved.
Show resolved
Hide resolved
|
||
size_t obj_size = obj->size(); | ||
elt->atomic_add_words(obj_size); | ||
Atomic::add(&_size_of_instances_in_words, obj_size); | ||
return true; | ||
} else { | ||
return false; | ||
|
@@ -265,6 +266,16 @@ class KlassInfoTableMergeClosure : public KlassInfoClosure { | |
bool success() { return _success; } | ||
}; | ||
|
||
void KlassInfoTable::clear_entries() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that in this case you are doing a walk of the table again after emitting the events to clear it. It makes sense instead to clear the entries as you emit the events from a specific entry. That way you avoid the extra walk. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Good idea. |
||
if (_buckets != nullptr) { | ||
for (int index = 0; index < _num_buckets; index++) { | ||
_buckets[index].empty(); | ||
_buckets[index].initialize(); | ||
} | ||
_size_of_instances_in_words = 0; | ||
} | ||
} | ||
|
||
// merge from table | ||
bool KlassInfoTable::merge(KlassInfoTable* table) { | ||
KlassInfoTableMergeClosure closure(this); | ||
|
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.
I wouldn't make it a static class.
Extend ObjectClosure instead, which is a StackObj.
(This ties into yr use of static methods below as well.)
We can discuss later this afternoon if the feedback in this review isn't clear.