1 /*
  2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "asm/macroAssembler.inline.hpp"
 27 #include "gc/g1/g1BarrierSet.hpp"
 28 #include "gc/g1/g1BarrierSetAssembler.hpp"
 29 #include "gc/g1/g1BarrierSetRuntime.hpp"
 30 #include "gc/g1/g1CardTable.hpp"
 31 #include "gc/g1/g1ThreadLocalData.hpp"
 32 #include "gc/g1/heapRegion.hpp"
 33 #include "interpreter/interp_masm.hpp"
 34 #include "runtime/sharedRuntime.hpp"
 35 #include "utilities/debug.hpp"
 36 #include "utilities/macros.hpp"
 37 #ifdef COMPILER1
 38 #include "c1/c1_LIRAssembler.hpp"
 39 #include "c1/c1_MacroAssembler.hpp"
 40 #include "gc/g1/c1/g1BarrierSetC1.hpp"
 41 #endif
 42 
 43 #define __ masm->
 44 
 45 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
 46                                                             Register addr, Register count) {
 47   bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
 48 
 49   if (!dest_uninitialized) {
 50     Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
 51 #ifndef _LP64
 52     __ push(thread);
 53     __ get_thread(thread);
 54 #endif
 55 
 56     Label filtered;
 57     Address in_progress(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()));
 58     // Is marking active?
 59     if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
 60       __ cmpl(in_progress, 0);
 61     } else {
 62       assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
 63       __ cmpb(in_progress, 0);
 64     }
 65 
 66     NOT_LP64(__ pop(thread);)
 67 
 68     __ jcc(Assembler::equal, filtered);
 69 
 70     __ pusha();                      // push registers
 71 #ifdef _LP64
 72     if (count == c_rarg0) {
 73       if (addr == c_rarg1) {
 74         // exactly backwards!!
 75         __ xchgptr(c_rarg1, c_rarg0);
 76       } else {
 77         __ movptr(c_rarg1, count);
 78         __ movptr(c_rarg0, addr);
 79       }
 80     } else {
 81       __ movptr(c_rarg0, addr);
 82       __ movptr(c_rarg1, count);
 83     }
 84     if (UseCompressedOops) {
 85       __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry), 2);
 86     } else {
 87       __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry), 2);
 88     }
 89 #else
 90     __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry),
 91                     addr, count);
 92 #endif
 93     __ popa();
 94 
 95     __ bind(filtered);
 96   }
 97 }
 98 
 99 void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
100                                                              Register addr, Register count, Register tmp) {
101   __ pusha();             // push registers (overkill)
102 #ifdef _LP64
103   if (c_rarg0 == count) { // On win64 c_rarg0 == rcx
104     assert_different_registers(c_rarg1, addr);
105     __ mov(c_rarg1, count);
106     __ mov(c_rarg0, addr);
107   } else {
108     assert_different_registers(c_rarg0, count);
109     __ mov(c_rarg0, addr);
110     __ mov(c_rarg1, count);
111   }
112   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry), 2);
113 #else
114   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry),
115                   addr, count);
116 #endif
117   __ popa();
118 }
119 
120 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
121                                     Register dst, Address src, Register tmp1, Register tmp_thread) {
122   bool on_oop = is_reference_type(type);
123   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
124   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
125   bool on_reference = on_weak || on_phantom;
126   ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread);
127   if (on_oop && on_reference) {
128     Register thread = NOT_LP64(tmp_thread) LP64_ONLY(r15_thread);
129 
130 #ifndef _LP64
131     // Work around the x86_32 bug that only manifests with Loom for some reason.
132     // MacroAssembler::resolve_weak_handle calls this barrier with tmp_thread == noreg.
133     if (thread == noreg) {
134       if (dst != rcx && tmp1 != rcx) {
135         thread = rcx;
136       } else if (dst != rdx && tmp1 != rdx) {
137         thread = rdx;
138       } else if (dst != rdi && tmp1 != rdi) {
139         thread = rdi;
140       }
141     }
142     assert_different_registers(dst, tmp1, thread);
143     __ push(thread);
144     __ get_thread(thread);
145 #endif
146 
147     // Generate the G1 pre-barrier code to log the value of
148     // the referent field in an SATB buffer.
149     g1_write_barrier_pre(masm /* masm */,
150                          noreg /* obj */,
151                          dst /* pre_val */,
152                          thread /* thread */,
153                          tmp1 /* tmp */,
154                          true /* tosca_live */,
155                          true /* expand_call */);
156 
157 #ifndef _LP64
158     __ pop(thread);
159 #endif
160   }
161 }
162 
163 void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
164                                                  Register obj,
165                                                  Register pre_val,
166                                                  Register thread,
167                                                  Register tmp,
168                                                  bool tosca_live,
169                                                  bool expand_call) {
170   // If expand_call is true then we expand the call_VM_leaf macro
171   // directly to skip generating the check by
172   // InterpreterMacroAssembler::call_VM_leaf_base that checks _last_sp.
173 
174 #ifdef _LP64
175   assert(thread == r15_thread, "must be");
176 #endif // _LP64
177 
178   Label done;
179   Label runtime;
180 
181   assert(pre_val != noreg, "check this code");
182 
183   if (obj != noreg) {
184     assert_different_registers(obj, pre_val, tmp);
185     assert(pre_val != rax, "check this code");
186   }
187 
188   Address in_progress(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()));
189   Address index(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset()));
190   Address buffer(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset()));
191 
192   // Is marking active?
193   if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
194     __ cmpl(in_progress, 0);
195   } else {
196     assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
197     __ cmpb(in_progress, 0);
198   }
199   __ jcc(Assembler::equal, done);
200 
201   // Do we need to load the previous value?
202   if (obj != noreg) {
203     __ load_heap_oop(pre_val, Address(obj, 0), noreg, noreg, AS_RAW);
204   }
205 
206   // Is the previous value null?
207   __ cmpptr(pre_val, (int32_t) NULL_WORD);
208   __ jcc(Assembler::equal, done);
209 
210   // Can we store original value in the thread's buffer?
211   // Is index == 0?
212   // (The index field is typed as size_t.)
213 
214   __ movptr(tmp, index);                   // tmp := *index_adr
215   __ cmpptr(tmp, 0);                       // tmp == 0?
216   __ jcc(Assembler::equal, runtime);       // If yes, goto runtime
217 
218   __ subptr(tmp, wordSize);                // tmp := tmp - wordSize
219   __ movptr(index, tmp);                   // *index_adr := tmp
220   __ addptr(tmp, buffer);                  // tmp := tmp + *buffer_adr
221 
222   // Record the previous value
223   __ movptr(Address(tmp, 0), pre_val);
224   __ jmp(done);
225 
226   __ bind(runtime);
227 
228   // Calling the runtime using the regular call_VM_leaf mechanism generates
229   // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
230   // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL.
231   //
232   // If we care generating the pre-barrier without a frame (e.g. in the
233   // intrinsified Reference.get() routine) then ebp might be pointing to
234   // the caller frame and so this check will most likely fail at runtime.
235   //
236   // Expanding the call directly bypasses the generation of the check.
237   // So when we do not have have a full interpreter frame on the stack
238   // expand_call should be passed true.
239 
240   __ pusha();
241 
242   if (expand_call) {
243     LP64_ONLY( assert(pre_val != c_rarg1, "smashed arg"); )
244 #ifdef _LP64
245     if (c_rarg1 != thread) {
246       __ mov(c_rarg1, thread);
247     }
248     if (c_rarg0 != pre_val) {
249       __ mov(c_rarg0, pre_val);
250     }
251 #else
252     __ push(thread);
253     __ push(pre_val);
254 #endif
255     __ MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), 2);
256   } else {
257     __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread);
258   }
259 
260   __ popa();
261 
262   __ bind(done);
263 }
264 
265 void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
266                                                   Register store_addr,
267                                                   Register new_val,
268                                                   Register thread,
269                                                   Register tmp,
270                                                   Register tmp2) {
271   // Generated code assumes that buffer index is pointer sized.
272   STATIC_ASSERT(in_bytes(SATBMarkQueue::byte_width_of_index()) == sizeof(intptr_t));
273 #ifdef _LP64
274   assert(thread == r15_thread, "must be");
275 #endif // _LP64
276 
277   Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
278   Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));
279 
280   CardTableBarrierSet* ct =
281     barrier_set_cast<CardTableBarrierSet>(BarrierSet::barrier_set());
282 
283   Label done;
284   Label runtime;
285 
286   // Does store cross heap regions?
287 
288   __ movptr(tmp, store_addr);
289   __ xorptr(tmp, new_val);
290   __ shrptr(tmp, HeapRegion::LogOfHRGrainBytes);
291   __ jcc(Assembler::equal, done);
292 
293   // crosses regions, storing NULL?
294 
295   __ cmpptr(new_val, (int32_t) NULL_WORD);
296   __ jcc(Assembler::equal, done);
297 
298   // storing region crossing non-NULL, is card already dirty?
299 
300   const Register card_addr = tmp;
301   const Register cardtable = tmp2;
302 
303   __ movptr(card_addr, store_addr);
304   __ shrptr(card_addr, CardTable::card_shift);
305   // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
306   // a valid address and therefore is not properly handled by the relocation code.
307   __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
308   __ addptr(card_addr, cardtable);
309 
310   __ cmpb(Address(card_addr, 0), (int)G1CardTable::g1_young_card_val());
311   __ jcc(Assembler::equal, done);
312 
313   __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
314   __ cmpb(Address(card_addr, 0), (int)G1CardTable::dirty_card_val());
315   __ jcc(Assembler::equal, done);
316 
317 
318   // storing a region crossing, non-NULL oop, card is clean.
319   // dirty card and log.
320 
321   __ movb(Address(card_addr, 0), (int)G1CardTable::dirty_card_val());
322 
323   __ movptr(tmp2, queue_index);
324   __ testptr(tmp2, tmp2);
325   __ jcc(Assembler::zero, runtime);
326   __ subptr(tmp2, wordSize);
327   __ movptr(queue_index, tmp2);
328   __ addptr(tmp2, buffer);
329   __ movptr(Address(tmp2, 0), card_addr);
330   __ jmp(done);
331 
332   __ bind(runtime);
333   // save the live input values
334   __ push(store_addr);
335 #ifdef _LP64
336   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, r15_thread);
337 #else
338   __ push(thread);
339   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
340   __ pop(thread);
341 #endif
342   __ pop(store_addr);
343 
344   __ bind(done);
345 }
346 
347 void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
348                                          Address dst, Register val, Register tmp1, Register tmp2) {
349   bool in_heap = (decorators & IN_HEAP) != 0;
350   bool as_normal = (decorators & AS_NORMAL) != 0;
351   //assert((decorators & IS_DEST_UNINITIALIZED) == 0, "unsupported");
352 
353   bool needs_pre_barrier = as_normal && (! (decorators & IS_DEST_UNINITIALIZED) );
354   bool needs_post_barrier = val != noreg && in_heap;
355 
356   Register tmp3 = LP64_ONLY(r8) NOT_LP64(rsi);
357   Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
358   // flatten object address if needed
359   // We do it regardless of precise because we need the registers
360   if (dst.index() == noreg && dst.disp() == 0) {
361     if (dst.base() != tmp1) {
362       __ movptr(tmp1, dst.base());
363     }
364   } else {
365     __ lea(tmp1, dst);
366   }
367 
368 #ifndef _LP64
369   InterpreterMacroAssembler *imasm = static_cast<InterpreterMacroAssembler*>(masm);
370 #endif
371 
372   NOT_LP64(__ get_thread(rcx));
373   NOT_LP64(imasm->save_bcp());
374 
375   if (needs_pre_barrier) {
376     g1_write_barrier_pre(masm /*masm*/,
377                          tmp1 /* obj */,
378                          tmp2 /* pre_val */,
379                          rthread /* thread */,
380                          tmp3  /* tmp */,
381                          val != noreg /* tosca_live */,
382                          false /* expand_call */);
383   }
384   if (val == noreg) {
385     BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg);
386   } else {
387     Register new_val = val;
388     if (needs_post_barrier) {
389       // G1 barrier needs uncompressed oop for region cross check.
390       if (UseCompressedOops) {
391         new_val = tmp2;
392         __ movptr(new_val, val);
393       }
394     }
395     BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg);
396     if (needs_post_barrier) {
397       g1_write_barrier_post(masm /*masm*/,
398                             tmp1 /* store_adr */,
399                             new_val /* new_val */,
400                             rthread /* thread */,
401                             tmp3 /* tmp */,
402                             tmp2 /* tmp2 */);
403     }
404   }
405   NOT_LP64(imasm->restore_bcp());
406 }
407 
408 #ifdef COMPILER1
409 
410 #undef __
411 #define __ ce->masm()->
412 
413 void G1BarrierSetAssembler::gen_pre_barrier_stub(LIR_Assembler* ce, G1PreBarrierStub* stub) {
414   G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1();
415   // At this point we know that marking is in progress.
416   // If do_load() is true then we have to emit the
417   // load of the previous value; otherwise it has already
418   // been loaded into _pre_val.
419 
420   __ bind(*stub->entry());
421   assert(stub->pre_val()->is_register(), "Precondition.");
422 
423   Register pre_val_reg = stub->pre_val()->as_register();
424 
425   if (stub->do_load()) {
426     ce->mem2reg(stub->addr(), stub->pre_val(), T_OBJECT, stub->patch_code(), stub->info(), false /*wide*/);
427   }
428 
429   __ cmpptr(pre_val_reg, (int32_t)NULL_WORD);
430   __ jcc(Assembler::equal, *stub->continuation());
431   ce->store_parameter(stub->pre_val()->as_register(), 0);
432   __ call(RuntimeAddress(bs->pre_barrier_c1_runtime_code_blob()->code_begin()));
433   __ jmp(*stub->continuation());
434 
435 }
436 
437 void G1BarrierSetAssembler::gen_post_barrier_stub(LIR_Assembler* ce, G1PostBarrierStub* stub) {
438   G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1();
439   __ bind(*stub->entry());
440   assert(stub->addr()->is_register(), "Precondition.");
441   assert(stub->new_val()->is_register(), "Precondition.");
442   Register new_val_reg = stub->new_val()->as_register();
443   __ cmpptr(new_val_reg, (int32_t) NULL_WORD);
444   __ jcc(Assembler::equal, *stub->continuation());
445   ce->store_parameter(stub->addr()->as_pointer_register(), 0);
446   __ call(RuntimeAddress(bs->post_barrier_c1_runtime_code_blob()->code_begin()));
447   __ jmp(*stub->continuation());
448 }
449 
450 #undef __
451 
452 #define __ sasm->
453 
454 void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm) {
455   // Generated code assumes that buffer index is pointer sized.
456   STATIC_ASSERT(in_bytes(SATBMarkQueue::byte_width_of_index()) == sizeof(intptr_t));
457 
458   __ prologue("g1_pre_barrier", false);
459   // arg0 : previous value of memory
460 
461   __ push(rax);
462   __ push(rdx);
463 
464   const Register pre_val = rax;
465   const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
466   const Register tmp = rdx;
467 
468   NOT_LP64(__ get_thread(thread);)
469 
470   Address queue_active(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()));
471   Address queue_index(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset()));
472   Address buffer(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset()));
473 
474   Label done;
475   Label runtime;
476 
477   // Is marking still active?
478   if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
479     __ cmpl(queue_active, 0);
480   } else {
481     assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
482     __ cmpb(queue_active, 0);
483   }
484   __ jcc(Assembler::equal, done);
485 
486   // Can we store original value in the thread's buffer?
487 
488   __ movptr(tmp, queue_index);
489   __ testptr(tmp, tmp);
490   __ jcc(Assembler::zero, runtime);
491   __ subptr(tmp, wordSize);
492   __ movptr(queue_index, tmp);
493   __ addptr(tmp, buffer);
494 
495   // prev_val (rax)
496   __ load_parameter(0, pre_val);
497   __ movptr(Address(tmp, 0), pre_val);
498   __ jmp(done);
499 
500   __ bind(runtime);
501 
502   __ save_live_registers_no_oop_map(true);
503 
504   // load the pre-value
505   __ load_parameter(0, rcx);
506   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), rcx, thread);
507 
508   __ restore_live_registers(true);
509 
510   __ bind(done);
511 
512   __ pop(rdx);
513   __ pop(rax);
514 
515   __ epilogue();
516 }
517 
518 void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) {
519   __ prologue("g1_post_barrier", false);
520 
521   // arg0: store_address
522   Address store_addr(rbp, 2*BytesPerWord);
523 
524   CardTableBarrierSet* ct =
525     barrier_set_cast<CardTableBarrierSet>(BarrierSet::barrier_set());
526 
527   Label done;
528   Label enqueued;
529   Label runtime;
530 
531   // At this point we know new_value is non-NULL and the new_value crosses regions.
532   // Must check to see if card is already dirty
533 
534   const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
535 
536   Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
537   Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));
538 
539   __ push(rax);
540   __ push(rcx);
541 
542   const Register cardtable = rax;
543   const Register card_addr = rcx;
544 
545   __ load_parameter(0, card_addr);
546   __ shrptr(card_addr, CardTable::card_shift);
547   // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
548   // a valid address and therefore is not properly handled by the relocation code.
549   __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
550   __ addptr(card_addr, cardtable);
551 
552   NOT_LP64(__ get_thread(thread);)
553 
554   __ cmpb(Address(card_addr, 0), (int)G1CardTable::g1_young_card_val());
555   __ jcc(Assembler::equal, done);
556 
557   __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
558   __ cmpb(Address(card_addr, 0), (int)CardTable::dirty_card_val());
559   __ jcc(Assembler::equal, done);
560 
561   // storing region crossing non-NULL, card is clean.
562   // dirty card and log.
563 
564   __ movb(Address(card_addr, 0), (int)CardTable::dirty_card_val());
565 
566   const Register tmp = rdx;
567   __ push(rdx);
568 
569   __ movptr(tmp, queue_index);
570   __ testptr(tmp, tmp);
571   __ jcc(Assembler::zero, runtime);
572   __ subptr(tmp, wordSize);
573   __ movptr(queue_index, tmp);
574   __ addptr(tmp, buffer);
575   __ movptr(Address(tmp, 0), card_addr);
576   __ jmp(enqueued);
577 
578   __ bind(runtime);
579 
580   __ save_live_registers_no_oop_map(true);
581 
582   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
583 
584   __ restore_live_registers(true);
585 
586   __ bind(enqueued);
587   __ pop(rdx);
588 
589   __ bind(done);
590   __ pop(rcx);
591   __ pop(rax);
592 
593   __ epilogue();
594 }
595 
596 #undef __
597 
598 #endif // COMPILER1