src/cpu/x86/vm/stubGenerator_x86_32.cpp

changeset 5156
3f281b313240
parent 4873
e961c11b85fe
child 5259
ef57c43512d6
     1.1 --- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed May 22 17:39:47 2013 -0700
     1.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed May 22 18:25:43 2013 -0700
     1.3 @@ -1498,27 +1498,29 @@
     1.4      __ movptr(elem_klass, elem_klass_addr); // query the object klass
     1.5      generate_type_check(elem_klass, ckoff_arg, ckval_arg, temp,
     1.6                          &L_store_element, NULL);
     1.7 -      // (On fall-through, we have failed the element type check.)
     1.8 +    // (On fall-through, we have failed the element type check.)
     1.9      // ======== end loop ========
    1.10  
    1.11      // It was a real error; we must depend on the caller to finish the job.
    1.12      // Register "count" = -1 * number of *remaining* oops, length_arg = *total* oops.
    1.13      // Emit GC store barriers for the oops we have copied (length_arg + count),
    1.14      // and report their number to the caller.
    1.15 +    assert_different_registers(to, count, rax);
    1.16 +    Label L_post_barrier;
    1.17      __ addl(count, length_arg);         // transfers = (length - remaining)
    1.18      __ movl2ptr(rax, count);            // save the value
    1.19 -    __ notptr(rax);                     // report (-1^K) to caller
    1.20 -    __ movptr(to, to_arg);              // reload
    1.21 -    assert_different_registers(to, count, rax);
    1.22 -    gen_write_ref_array_post_barrier(to, count);
    1.23 -    __ jmpb(L_done);
    1.24 +    __ notptr(rax);                     // report (-1^K) to caller (does not affect flags)
    1.25 +    __ jccb(Assembler::notZero, L_post_barrier);
    1.26 +    __ jmp(L_done); // K == 0, nothing was copied, skip post barrier
    1.27  
    1.28      // Come here on success only.
    1.29      __ BIND(L_do_card_marks);
    1.30 +    __ xorptr(rax, rax);                // return 0 on success
    1.31      __ movl2ptr(count, length_arg);
    1.32 -    __ movptr(to, to_arg);                // reload
    1.33 +
    1.34 +    __ BIND(L_post_barrier);
    1.35 +    __ movptr(to, to_arg);              // reload
    1.36      gen_write_ref_array_post_barrier(to, count);
    1.37 -    __ xorptr(rax, rax);                  // return 0 on success
    1.38  
    1.39      // Common exit point (success or failure).
    1.40      __ BIND(L_done);

mercurial