@@ -177,39 +177,12 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
177
177
Node* eden_end_adr;
178
178
179
179
{
180
- // Only bump pointer allocator fastpath is implemented.
181
- if (selector.tag != TAG_BUMP_POINTER && selector.tag != TAG_MARK_COMPACT && selector.tag != TAG_IMMIX) {
182
- fatal (" unimplemented allocator fastpath\n " );
183
- }
180
+ // Calculate offsets of TLAB top and end
181
+ MMTkAllocatorOffsets alloc_offsets = get_tlab_top_and_end_offsets (selector);
184
182
185
- // Calculat offsets of top and end. We now assume we are using bump pointer.
186
- int allocators_base_offset = in_bytes (JavaThread::third_party_heap_mutator_offset ())
187
- + in_bytes (byte_offset_of (MMTkMutatorContext, allocators));
188
- int tlab_top_offset, tlab_end_offset;
189
- if (selector.tag == TAG_IMMIX) {
190
- int allocator_base_offset = allocators_base_offset
191
- + in_bytes (byte_offset_of (Allocators, immix))
192
- + selector.index * sizeof (ImmixAllocator);
193
- tlab_top_offset = allocator_base_offset + in_bytes (byte_offset_of (ImmixAllocator, cursor));
194
- tlab_end_offset = allocator_base_offset + in_bytes (byte_offset_of (ImmixAllocator, limit));
195
- } else if (selector.tag == TAG_BUMP_POINTER) {
196
- int allocator_base_offset = allocators_base_offset
197
- + in_bytes (byte_offset_of (Allocators, bump_pointer))
198
- + selector.index * sizeof (BumpAllocator);
199
- tlab_top_offset = allocator_base_offset + in_bytes (byte_offset_of (BumpAllocator, cursor));
200
- tlab_end_offset = allocator_base_offset + in_bytes (byte_offset_of (BumpAllocator, limit));
201
- } else {
202
- // markcompact allocator
203
- int allocator_base_offset = allocators_base_offset
204
- + in_bytes (byte_offset_of (Allocators, bump_pointer))
205
- + selector.index * sizeof (MarkCompactAllocator)
206
- + in_bytes (byte_offset_of (MarkCompactAllocator, bump_allocator));
207
- tlab_top_offset = allocator_base_offset + in_bytes (byte_offset_of (BumpAllocator, cursor));
208
- tlab_end_offset = allocator_base_offset + in_bytes (byte_offset_of (BumpAllocator, limit));
209
- }
210
183
Node* thread = x->transform_later (new ThreadLocalNode ());
211
- eden_top_adr = x->basic_plus_adr (x->top ()/* not oop*/ , thread, tlab_top_offset);
212
- eden_end_adr = x->basic_plus_adr (x->top ()/* not oop*/ , thread, tlab_end_offset);
184
+ eden_top_adr = x->basic_plus_adr (x->top ()/* not oop*/ , thread, alloc_offsets. tlab_top_offset );
185
+ eden_end_adr = x->basic_plus_adr (x->top ()/* not oop*/ , thread, alloc_offsets. tlab_end_offset );
213
186
}
214
187
215
188
// set_eden_pointers(eden_top_adr, eden_end_adr);
@@ -239,7 +212,7 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
239
212
240
213
// Load(-locked) the heap top.
241
214
// See note above concerning the control input when using a TLAB
242
- Node *old_eden_top;
215
+ Node *old_eden_top;
243
216
244
217
if (selector.tag == TAG_MARK_COMPACT) {
245
218
Node *offset = ConLNode::make (extra_header);
@@ -303,15 +276,14 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
303
276
#ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
304
277
enable_global_alloc_bit = true ;
305
278
#endif
306
- // #ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
307
- if (enable_global_alloc_bit || selector.tag == TAG_MARK_COMPACT) {
308
- // set the alloc bit:
279
+ if (enable_global_alloc_bit || selector.tag == TAG_MARK_COMPACT) {
280
+ // set the alloc bit:
309
281
// intptr_t addr = (intptr_t) (void*) fast_oop;
310
282
// uint8_t* meta_addr = (uint8_t*) (ALLOC_BIT_BASE_ADDRESS + (addr >> 6));
311
283
// intptr_t shift = (addr >> 3) & 0b111;
312
284
// uint8_t byte_val = *meta_addr;
313
285
// uint8_t new_byte_val = byte_val | (1 << shift);
314
- // *meta_addr = new_byte_val;
286
+ // *meta_addr = new_byte_val;
315
287
Node *obj_addr = new CastP2XNode (fast_oop_ctrl, fast_oop);
316
288
x->transform_later (obj_addr);
317
289
@@ -348,7 +320,7 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
348
320
Node *const_one = ConINode::make (1 );
349
321
x->transform_later (const_one);
350
322
351
- Node *shifted_masked_addr_i = new ConvL2INode (shifted_masked_addr);
323
+ Node *shifted_masked_addr_i = new ConvL2INode (shifted_masked_addr);
352
324
x->transform_later (shifted_masked_addr_i);
353
325
354
326
Node *set_bit = new LShiftINode (const_one, shifted_masked_addr_i);
@@ -362,7 +334,6 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
362
334
363
335
fast_oop_rawmem = set_alloc_bit;
364
336
}
365
- // #endif
366
337
367
338
InitializeNode* init = alloc->initialization ();
368
339
fast_oop_rawmem = x->initialize_object (alloc,
0 commit comments