30 #include "gc/shared/vmGCOperations.hpp" |
30 #include "gc/shared/vmGCOperations.hpp" |
31 |
31 |
32 // VM_operations for the G1 collector. |
32 // VM_operations for the G1 collector. |
33 // VM_GC_Operation: |
33 // VM_GC_Operation: |
34 // - VM_CGC_Operation |
34 // - VM_CGC_Operation |
|
35 // - VM_G1CollectForAllocation |
35 // - VM_G1CollectFull |
36 // - VM_G1CollectFull |
36 // - VM_G1OperationWithAllocRequest |
|
37 // - VM_G1CollectForAllocation |
|
38 // - VM_G1IncCollectionPause |
|
39 |
|
40 class VM_G1OperationWithAllocRequest : public VM_CollectForAllocation { |
|
41 protected: |
|
42 bool _pause_succeeded; |
|
43 AllocationContext_t _allocation_context; |
|
44 |
|
45 public: |
|
46 VM_G1OperationWithAllocRequest(uint gc_count_before, |
|
47 size_t word_size, |
|
48 GCCause::Cause gc_cause) |
|
49 : VM_CollectForAllocation(word_size, gc_count_before, gc_cause), |
|
50 _pause_succeeded(false) {} |
|
51 bool pause_succeeded() { return _pause_succeeded; } |
|
52 void set_allocation_context(AllocationContext_t context) { _allocation_context = context; } |
|
53 AllocationContext_t allocation_context() { return _allocation_context; } |
|
54 }; |
|
55 |
37 |
56 class VM_G1CollectFull: public VM_GC_Operation { |
38 class VM_G1CollectFull: public VM_GC_Operation { |
57 public: |
39 public: |
58 VM_G1CollectFull(uint gc_count_before, |
40 VM_G1CollectFull(uint gc_count_before, |
59 uint full_gc_count_before, |
41 uint full_gc_count_before, |
60 GCCause::Cause cause) |
42 GCCause::Cause cause) |
61 : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } |
43 : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } |
62 virtual VMOp_Type type() const { return VMOp_G1CollectFull; } |
44 virtual VMOp_Type type() const { return VMOp_G1CollectFull; } |
63 virtual void doit(); |
45 virtual void doit(); |
64 virtual const char* name() const { |
46 virtual const char* name() const { |
65 return "full garbage-first collection"; |
47 return "G1 Full collection"; |
66 } |
48 } |
67 }; |
49 }; |
68 |
50 |
69 class VM_G1CollectForAllocation: public VM_G1OperationWithAllocRequest { |
51 class VM_G1CollectForAllocation: public VM_CollectForAllocation { |
70 public: |
52 private: |
71 VM_G1CollectForAllocation(uint gc_count_before, |
53 bool _pause_succeeded; |
72 size_t word_size); |
54 AllocationContext_t _allocation_context; |
73 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } |
|
74 virtual void doit(); |
|
75 virtual const char* name() const { |
|
76 return "garbage-first collection to satisfy allocation"; |
|
77 } |
|
78 }; |
|
79 |
55 |
80 class VM_G1IncCollectionPause: public VM_G1OperationWithAllocRequest { |
|
81 private: |
|
82 bool _should_initiate_conc_mark; |
56 bool _should_initiate_conc_mark; |
83 bool _should_retry_gc; |
57 bool _should_retry_gc; |
84 double _target_pause_time_ms; |
58 double _target_pause_time_ms; |
85 uint _old_marking_cycles_completed_before; |
59 uint _old_marking_cycles_completed_before; |
86 public: |
60 public: |
87 VM_G1IncCollectionPause(uint gc_count_before, |
61 VM_G1CollectForAllocation(size_t word_size, |
88 size_t word_size, |
62 uint gc_count_before, |
89 bool should_initiate_conc_mark, |
63 GCCause::Cause gc_cause, |
90 double target_pause_time_ms, |
64 bool should_initiate_conc_mark, |
91 GCCause::Cause gc_cause); |
65 double target_pause_time_ms, |
92 virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; } |
66 AllocationContext_t allocation_context); |
|
67 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } |
93 virtual bool doit_prologue(); |
68 virtual bool doit_prologue(); |
94 virtual void doit(); |
69 virtual void doit(); |
95 virtual void doit_epilogue(); |
70 virtual void doit_epilogue(); |
96 virtual const char* name() const { |
71 virtual const char* name() const { |
97 return "garbage-first incremental collection pause"; |
72 return "G1 collect for allocation"; |
98 } |
73 } |
99 bool should_retry_gc() const { return _should_retry_gc; } |
74 bool should_retry_gc() const { return _should_retry_gc; } |
|
75 bool pause_succeeded() { return _pause_succeeded; } |
100 }; |
76 }; |
101 |
77 |
102 // Concurrent GC stop-the-world operations such as remark and cleanup; |
78 // Concurrent GC stop-the-world operations such as remark and cleanup; |
103 // consider sharing these with CMS's counterparts. |
79 // consider sharing these with CMS's counterparts. |
104 class VM_CGC_Operation: public VM_Operation { |
80 class VM_CGC_Operation: public VM_Operation { |