171
172 assert(forwarded_oop->is_oop(), "oop required");
173 assert(is_in(forwarded_oop), "forwardee must be in heap");
174 assert(oopDesc::bs()->is_safe(forwarded_oop), "forwardee must not be in collection set");
175 // If this fails, another thread wrote to p before us, it will be logged in SATB and the
176 // reference be updated later.
177 oop result = atomic_compare_exchange_oop(forwarded_oop, p, heap_oop);
178
179 if (oopDesc::unsafe_equals(result, heap_oop)) { // CAS successful.
180 return forwarded_oop;
181 } else {
182 return NULL;
183 }
184 } else {
185 assert(oopDesc::unsafe_equals(heap_oop, ShenandoahBarrierSet::resolve_oop_static_not_null(heap_oop)), "expect not forwarded");
186 return heap_oop;
187 }
188 }
189
190 inline bool ShenandoahHeap::cancelled_concgc() const {
191 bool cancelled = _cancelled_concgc;
192 return cancelled;
193 }
194
195 inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) {
196 if (UseTLAB) {
197 HeapWord* obj = thread->gclab().allocate(size);
198 if (obj != NULL) {
199 return obj;
200 }
201 // Otherwise...
202 return allocate_from_gclab_slow(thread, size);
203 } else {
204 return NULL;
205 }
206 }
207
208 inline void ShenandoahHeap::copy_object(oop p, HeapWord* s, size_t words) {
209 assert(s != NULL, "allocation of brooks pointer must not fail");
210 HeapWord* copy = s + BrooksPointer::word_size();
211
|
171
172 assert(forwarded_oop->is_oop(), "oop required");
173 assert(is_in(forwarded_oop), "forwardee must be in heap");
174 assert(oopDesc::bs()->is_safe(forwarded_oop), "forwardee must not be in collection set");
175 // If this fails, another thread wrote to p before us, it will be logged in SATB and the
176 // reference be updated later.
177 oop result = atomic_compare_exchange_oop(forwarded_oop, p, heap_oop);
178
179 if (oopDesc::unsafe_equals(result, heap_oop)) { // CAS successful.
180 return forwarded_oop;
181 } else {
182 return NULL;
183 }
184 } else {
185 assert(oopDesc::unsafe_equals(heap_oop, ShenandoahBarrierSet::resolve_oop_static_not_null(heap_oop)), "expect not forwarded");
186 return heap_oop;
187 }
188 }
189
190 inline bool ShenandoahHeap::cancelled_concgc() const {
191 bool cancelled = (bool) OrderAccess::load_acquire((jbyte*) &_cancelled_concgc);
192 return cancelled;
193 }
194
195 inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) {
196 if (UseTLAB) {
197 HeapWord* obj = thread->gclab().allocate(size);
198 if (obj != NULL) {
199 return obj;
200 }
201 // Otherwise...
202 return allocate_from_gclab_slow(thread, size);
203 } else {
204 return NULL;
205 }
206 }
207
208 inline void ShenandoahHeap::copy_object(oop p, HeapWord* s, size_t words) {
209 assert(s != NULL, "allocation of brooks pointer must not fail");
210 HeapWord* copy = s + BrooksPointer::word_size();
211
|