src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp
changeset 59296 9186be5c78ba
parent 59283 78aa7484c722
equal deleted inserted replaced
59295:8b6cc0bb93d0 59296:9186be5c78ba
   393 
   393 
   394   __ bind(done);
   394   __ bind(done);
   395   __ block_comment("load_reference_barrier_native { ");
   395   __ block_comment("load_reference_barrier_native { ");
   396 }
   396 }
   397 
   397 
       
   398 #ifdef _LP64
       
   399 void ShenandoahBarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
       
   400   // Use default version
       
   401   BarrierSetAssembler::c2i_entry_barrier(masm);
       
   402 }
       
   403 #else
       
   404 void ShenandoahBarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
       
   405   BarrierSetNMethod* bs = BarrierSet::barrier_set()->barrier_set_nmethod();
       
   406   if (bs == NULL) {
       
   407     return;
       
   408   }
       
   409 
       
   410   Label bad_call;
       
   411   __ cmpptr(rbx, 0); // rbx contains the incoming method for c2i adapters.
       
   412   __ jcc(Assembler::equal, bad_call);
       
   413 
       
   414   Register tmp1 = rax;
       
   415   Register tmp2 = rcx;
       
   416 
       
   417   __ push(tmp1);
       
   418   __ push(tmp2);
       
   419 
       
   420   // Pointer chase to the method holder to find out if the method is concurrently unloading.
       
   421   Label method_live;
       
   422   __ load_method_holder_cld(tmp1, rbx);
       
   423 
       
   424    // Is it a strong CLD?
       
   425   __ cmpl(Address(tmp1, ClassLoaderData::keep_alive_offset()), 0);
       
   426   __ jcc(Assembler::greater, method_live);
       
   427 
       
   428    // Is it a weak but alive CLD?
       
   429   __ movptr(tmp1, Address(tmp1, ClassLoaderData::holder_offset()));
       
   430   __ resolve_weak_handle(tmp1, tmp2);
       
   431   __ cmpptr(tmp1, 0);
       
   432   __ jcc(Assembler::notEqual, method_live);
       
   433   __ pop(tmp2);
       
   434   __ pop(tmp1);
       
   435 
       
   436   __ bind(bad_call);
       
   437   __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub()));
       
   438   __ bind(method_live);
       
   439   __ pop(tmp2);
       
   440   __ pop(tmp1);
       
   441 }
       
   442 #endif
       
   443 
   398 void ShenandoahBarrierSetAssembler::storeval_barrier(MacroAssembler* masm, Register dst, Register tmp) {
   444 void ShenandoahBarrierSetAssembler::storeval_barrier(MacroAssembler* masm, Register dst, Register tmp) {
   399   if (ShenandoahStoreValEnqueueBarrier) {
   445   if (ShenandoahStoreValEnqueueBarrier) {
   400     storeval_barrier_impl(masm, dst, tmp);
   446     storeval_barrier_impl(masm, dst, tmp);
   401   }
   447   }
   402 }
   448 }
   510   }
   556   }
   511 
   557 
   512   // 3: apply keep-alive barrier if needed
   558   // 3: apply keep-alive barrier if needed
   513   if (ShenandoahBarrierSet::need_keep_alive_barrier(decorators, type)) {
   559   if (ShenandoahBarrierSet::need_keep_alive_barrier(decorators, type)) {
   514     __ push_IU_state();
   560     __ push_IU_state();
   515     const Register thread = NOT_LP64(tmp_thread) LP64_ONLY(r15_thread);
   561     Register thread = NOT_LP64(tmp_thread) LP64_ONLY(r15_thread);
   516     assert_different_registers(dst, tmp1, tmp_thread);
   562     assert_different_registers(dst, tmp1, tmp_thread);
       
   563     if (!thread->is_valid()) {
       
   564       thread = rdx;
       
   565     }
   517     NOT_LP64(__ get_thread(thread));
   566     NOT_LP64(__ get_thread(thread));
   518     // Generate the SATB pre-barrier code to log the value of
   567     // Generate the SATB pre-barrier code to log the value of
   519     // the referent field in an SATB buffer.
   568     // the referent field in an SATB buffer.
   520     shenandoah_write_barrier_pre(masm /* masm */,
   569     shenandoah_write_barrier_pre(masm /* masm */,
   521                                  noreg /* obj */,
   570                                  noreg /* obj */,