Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/vm_operations_g1.cpp @ 20404:227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
Summary: Splitting out a g1 allocator class to simply specialized allocators which can associate each allocation with a given context.
Reviewed-by: mgerdin, brutisso
author | sjohanss |
---|---|
date | Fri, 05 Sep 2014 09:49:19 +0200 |
parents | 0982ec23da03 |
children | d3fd73295885 |
comparison
equal
deleted
inserted
replaced
20403:8ec8971f511a | 20404:227a9e5e4b4a |
---|---|
43 } | 43 } |
44 | 44 |
45 void VM_G1CollectForAllocation::doit() { | 45 void VM_G1CollectForAllocation::doit() { |
46 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | 46 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
47 GCCauseSetter x(g1h, _gc_cause); | 47 GCCauseSetter x(g1h, _gc_cause); |
48 _result = g1h->satisfy_failed_allocation(_word_size, &_pause_succeeded); | 48 |
49 _result = g1h->satisfy_failed_allocation(_word_size, allocation_context(), &_pause_succeeded); | |
49 assert(_result == NULL || _pause_succeeded, | 50 assert(_result == NULL || _pause_succeeded, |
50 "if we get back a result, the pause should have succeeded"); | 51 "if we get back a result, the pause should have succeeded"); |
51 } | 52 } |
52 | 53 |
53 void VM_G1CollectFull::doit() { | 54 void VM_G1CollectFull::doit() { |
97 _gc_cause == GCCause::_g1_humongous_allocation), | 98 _gc_cause == GCCause::_g1_humongous_allocation), |
98 "only a GC locker, a System.gc() or a hum allocation induced GC should start a cycle"); | 99 "only a GC locker, a System.gc() or a hum allocation induced GC should start a cycle"); |
99 | 100 |
100 if (_word_size > 0) { | 101 if (_word_size > 0) { |
101 // An allocation has been requested. So, try to do that first. | 102 // An allocation has been requested. So, try to do that first. |
102 _result = g1h->attempt_allocation_at_safepoint(_word_size, | 103 _result = g1h->attempt_allocation_at_safepoint(_word_size, allocation_context(), |
103 false /* expect_null_cur_alloc_region */); | 104 false /* expect_null_cur_alloc_region */); |
104 if (_result != NULL) { | 105 if (_result != NULL) { |
105 // If we can successfully allocate before we actually do the | 106 // If we can successfully allocate before we actually do the |
106 // pause then we will consider this pause successful. | 107 // pause then we will consider this pause successful. |
107 _pause_succeeded = true; | 108 _pause_succeeded = true; |
150 | 151 |
151 _pause_succeeded = | 152 _pause_succeeded = |
152 g1h->do_collection_pause_at_safepoint(_target_pause_time_ms); | 153 g1h->do_collection_pause_at_safepoint(_target_pause_time_ms); |
153 if (_pause_succeeded && _word_size > 0) { | 154 if (_pause_succeeded && _word_size > 0) { |
154 // An allocation had been requested. | 155 // An allocation had been requested. |
155 _result = g1h->attempt_allocation_at_safepoint(_word_size, | 156 _result = g1h->attempt_allocation_at_safepoint(_word_size, allocation_context(), |
156 true /* expect_null_cur_alloc_region */); | 157 true /* expect_null_cur_alloc_region */); |
157 } else { | 158 } else { |
158 assert(_result == NULL, "invariant"); | 159 assert(_result == NULL, "invariant"); |
159 if (!_pause_succeeded) { | 160 if (!_pause_succeeded) { |
160 // Another possible reason reason for the pause to not be successful | 161 // Another possible reason reason for the pause to not be successful |