< prev index next >
src/cpu/x86/vm/stubGenerator_x86_32.cpp
Print this page
@@ -36,14 +36,18 @@
#include "runtime/handles.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubCodeGenerator.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
+#include "utilities/macros.hpp"
#include "utilities/top.hpp"
#ifdef COMPILER2
#include "opto/runtime.hpp"
#endif
+#if INCLUDE_ALL_GCS
+#include "shenandoahBarrierSetAssembler_x86.hpp"
+#endif
// Declaration and definition of StubGenerator (no .hpp file).
// For a more detailed description of the stub routine structure
// see the comment in stubRoutines.hpp
@@ -700,11 +704,11 @@
// Generate pre-barrier for array stores
//
// Input:
// start - starting address
// count - element count
- void gen_write_ref_array_pre_barrier(Register start, Register count, bool uninitialized_target) {
+ void gen_write_ref_array_pre_barrier(Register src, Register start, Register count, bool uninitialized_target) {
assert_different_registers(start, count);
BarrierSet* bs = Universe::heap()->barrier_set();
switch (bs->kind()) {
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
@@ -718,10 +722,15 @@
break;
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
+#if INCLUDE_ALL_GCS
+ case BarrierSet::ShenandoahBarrierSet:
+ ShenandoahBarrierSetAssembler::bsasm()->arraycopy_prologue(_masm, uninitialized_target, src, start, count);
+ break;
+#endif
default :
ShouldNotReachHere();
}
}
@@ -770,10 +779,11 @@
__ decrement(count);
__ jcc(Assembler::greaterEqual, L_loop);
}
break;
case BarrierSet::ModRef:
+ case BarrierSet::ShenandoahBarrierSet:
break;
default :
ShouldNotReachHere();
}
@@ -935,11 +945,11 @@
}
if (t == T_OBJECT) {
__ testl(count, count);
__ jcc(Assembler::zero, L_0_count);
- gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
+ gen_write_ref_array_pre_barrier(from, to, count, dest_uninitialized);
__ mov(saved_to, to); // save 'to'
}
__ subptr(to, from); // to --> to_from
__ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
@@ -1114,11 +1124,11 @@
__ jump_cc(Assembler::aboveEqual, nooverlap);
if (t == T_OBJECT) {
__ testl(count, count);
__ jcc(Assembler::zero, L_0_count);
- gen_write_ref_array_pre_barrier(dst, count, dest_uninitialized);
+ gen_write_ref_array_pre_barrier(src, dst, count, dest_uninitialized);
}
// copy from high to low
__ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
__ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
@@ -1461,11 +1471,11 @@
Address from_element_addr(end_from, count, Address::times_ptr, 0);
Address to_element_addr(end_to, count, Address::times_ptr, 0);
Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes());
// Copy from low to high addresses, indexed from the end of each array.
- gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
+ gen_write_ref_array_pre_barrier(from, to, count, dest_uninitialized);
__ lea(end_from, end_from_addr);
__ lea(end_to, end_to_addr);
assert(length == count, ""); // else fix next line:
__ negptr(count); // negate and test the length
__ jccb(Assembler::notZero, L_load_element);
@@ -1482,16 +1492,34 @@
__ align(OptoLoopAlignment);
__ BIND(L_store_element);
__ movptr(to_element_addr, elem); // store the oop
__ increment(count); // increment the count toward zero
+#if INCLUDE_ALL_GCS
+ if (UseShenandoahGC) {
+ // Shenandoah barrier is too big for 8-bit offsets to work
+ __ jcc(Assembler::zero, L_do_card_marks);
+ } else
+#endif
__ jccb(Assembler::zero, L_do_card_marks);
// ======== loop entry is here ========
__ BIND(L_load_element);
+#if INCLUDE_ALL_GCS
+ if (UseShenandoahGC) {
+ // Needs GC barriers
+ __ load_heap_oop(elem, from_element_addr);
+ } else
+#endif
__ movptr(elem, from_element_addr); // load the oop
__ testptr(elem, elem);
+#if INCLUDE_ALL_GCS
+ if (UseShenandoahGC) {
+ // Shenandoah barrier is too big for 8-bit offsets to work
+ __ jcc(Assembler::zero, L_store_element);
+ } else
+#endif
__ jccb(Assembler::zero, L_store_element);
// (Could do a trick here: Remember last successful non-null
// element stored and make a quick oop equality check on it.)
< prev index next >