298 // separately and does not directly affect performance.
299 return uncolor_or_color_size + 4;
300 }
301
302 void* ZBarrierSetC2::create_barrier_state(Arena* comp_arena) const {
303 return new (comp_arena) ZBarrierSetC2State(comp_arena);
304 }
305
306 void ZBarrierSetC2::late_barrier_analysis() const {
307 compute_liveness_at_stubs();
308 analyze_dominating_barriers();
309 }
310
311 void ZBarrierSetC2::emit_stubs(CodeBuffer& cb) const {
312 MacroAssembler masm(&cb);
313 GrowableArray<ZBarrierStubC2*>* const stubs = barrier_set_state()->stubs();
314 barrier_set_state()->set_stubs_start_offset(masm.offset());
315
316 for (int i = 0; i < stubs->length(); i++) {
317 // Make sure there is enough space in the code buffer
318 if (cb.insts()->maybe_expand_to_ensure_remaining(PhaseOutput::MAX_inst_size) && cb.blob() == nullptr) {
319 ciEnv::current()->record_failure("CodeCache is full");
320 return;
321 }
322
323 stubs->at(i)->emit_code(masm);
324 }
325
326 masm.flush();
327 }
328
329 int ZBarrierSetC2::estimate_stub_size() const {
330 Compile* const C = Compile::current();
331 BufferBlob* const blob = C->output()->scratch_buffer_blob();
332 GrowableArray<ZBarrierStubC2*>* const stubs = barrier_set_state()->stubs();
333 int size = 0;
334
335 for (int i = 0; i < stubs->length(); i++) {
336 CodeBuffer cb(blob->content_begin(), checked_cast<CodeBuffer::csize_t>((address)C->output()->scratch_locs_memory() - blob->content_begin()));
337 MacroAssembler masm(&cb);
338 stubs->at(i)->emit_code(masm);
|
298 // separately and does not directly affect performance.
299 return uncolor_or_color_size + 4;
300 }
301
302 void* ZBarrierSetC2::create_barrier_state(Arena* comp_arena) const {
303 return new (comp_arena) ZBarrierSetC2State(comp_arena);
304 }
305
306 void ZBarrierSetC2::late_barrier_analysis() const {
307 compute_liveness_at_stubs();
308 analyze_dominating_barriers();
309 }
310
311 void ZBarrierSetC2::emit_stubs(CodeBuffer& cb) const {
312 MacroAssembler masm(&cb);
313 GrowableArray<ZBarrierStubC2*>* const stubs = barrier_set_state()->stubs();
314 barrier_set_state()->set_stubs_start_offset(masm.offset());
315
316 for (int i = 0; i < stubs->length(); i++) {
317 // Make sure there is enough space in the code buffer
318 if (cb.insts()->maybe_expand_to_ensure_remaining(PhaseOutput::max_inst_gcstub_size()) && cb.blob() == nullptr) {
319 ciEnv::current()->record_failure("CodeCache is full");
320 return;
321 }
322
323 stubs->at(i)->emit_code(masm);
324 }
325
326 masm.flush();
327 }
328
329 int ZBarrierSetC2::estimate_stub_size() const {
330 Compile* const C = Compile::current();
331 BufferBlob* const blob = C->output()->scratch_buffer_blob();
332 GrowableArray<ZBarrierStubC2*>* const stubs = barrier_set_state()->stubs();
333 int size = 0;
334
335 for (int i = 0; i < stubs->length(); i++) {
336 CodeBuffer cb(blob->content_begin(), checked_cast<CodeBuffer::csize_t>((address)C->output()->scratch_locs_memory() - blob->content_begin()));
337 MacroAssembler masm(&cb);
338 stubs->at(i)->emit_code(masm);
|