@@ -398,14 +398,20 @@ const char* ZGeneration::phase_to_string() const {
398398
399399class VM_ZOperation : public VM_Operation {
400400private:
401- const uint _gc_id;
402- bool _success;
401+ const uint _gc_id;
402+ const GCCause::Cause _gc_cause;
403+ bool _success;
403404
404405public:
405- VM_ZOperation ()
406+ VM_ZOperation (GCCause::Cause gc_cause )
406407 : _gc_id(GCId::current()),
408+ _gc_cause (gc_cause),
407409 _success(false ) {}
408410
411+ virtual const char * cause () const {
412+ return GCCause::to_string (_gc_cause);
413+ }
414+
409415 virtual bool block_jni_critical () const {
410416 // Blocking JNI critical regions is needed in operations where we change
411417 // the bad mask or move objects. Changing the bad mask will invalidate all
@@ -558,6 +564,9 @@ void ZGenerationYoung::collect(ZYoungType type, ConcurrentGCTimer* timer) {
558564
559565class VM_ZMarkStartYoungAndOld : public VM_ZOperation {
560566public:
567+ VM_ZMarkStartYoungAndOld ()
568+ : VM_ZOperation(ZDriver::major()->gc_cause ()) {}
569+
561570 virtual VMOp_Type type () const {
562571 return VMOp_ZMarkStartYoungAndOld;
563572 }
@@ -578,7 +587,22 @@ class VM_ZMarkStartYoungAndOld : public VM_ZOperation {
578587 }
579588};
580589
581- class VM_ZMarkStartYoung : public VM_ZOperation {
590+ class VM_ZYoungOperation : public VM_ZOperation {
591+ private:
592+ static ZDriver* driver () {
593+ if (ZGeneration::young ()->type () == ZYoungType::minor) {
594+ return ZDriver::minor ();
595+ } else {
596+ return ZDriver::major ();
597+ }
598+ }
599+
600+ public:
601+ VM_ZYoungOperation ()
602+ : VM_ZOperation(driver()->gc_cause ()) {}
603+ };
604+
605+ class VM_ZMarkStartYoung : public VM_ZYoungOperation {
582606public:
583607 virtual VMOp_Type type () const {
584608 return VMOp_ZMarkStartYoung;
@@ -626,7 +650,7 @@ void ZGenerationYoung::concurrent_mark() {
626650 mark_follow ();
627651}
628652
629- class VM_ZMarkEndYoung : public VM_ZOperation {
653+ class VM_ZMarkEndYoung : public VM_ZYoungOperation {
630654public:
631655 virtual VMOp_Type type () const {
632656 return VMOp_ZMarkEndYoung;
@@ -785,7 +809,8 @@ void ZGenerationYoung::concurrent_select_relocation_set() {
785809 select_relocation_set (_id, promote_all);
786810}
787811
788- class VM_ZRelocateStartYoung : public VM_ZOperation {
812+ class VM_ZRelocateStartYoung : public VM_ZYoungOperation {
813+
789814public:
790815 virtual VMOp_Type type () const {
791816 return VMOp_ZRelocateStartYoung;
@@ -1047,6 +1072,9 @@ void ZGenerationOld::concurrent_mark() {
10471072
10481073class VM_ZMarkEndOld : public VM_ZOperation {
10491074public:
1075+ VM_ZMarkEndOld ()
1076+ : VM_ZOperation(ZDriver::major()->gc_cause ()) {}
1077+
10501078 virtual VMOp_Type type () const {
10511079 return VMOp_ZMarkEndOld;
10521080 }
@@ -1125,6 +1153,9 @@ void ZGenerationOld::concurrent_select_relocation_set() {
11251153
11261154class VM_ZRelocateStartOld : public VM_ZOperation {
11271155public:
1156+ VM_ZRelocateStartOld ()
1157+ : VM_ZOperation(ZDriver::major()->gc_cause ()) {}
1158+
11281159 virtual VMOp_Type type () const {
11291160 return VMOp_ZRelocateStartOld;
11301161 }
0 commit comments