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