--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Thu Nov 30 18:51:47 2017 +0100
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Thu Dec 07 13:05:31 2017 +0100
@@ -1265,9 +1265,12 @@
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
- Label L_loop;
+ Label L_loop, L_done;
const Register end = count;
+ __ testl(count, count);
+ __ jcc(Assembler::zero, L_done); // zero count - nothing to do
+
__ leaq(end, Address(start, count, TIMES_OOP, 0)); // end == start+count*oop_size
__ subptr(end, BytesPerHeapOop); // end - 1 to make inclusive
__ shrptr(start, CardTableModRefBS::card_shift);
@@ -1281,6 +1284,7 @@
__ movb(Address(start, count, Address::times_1), 0);
__ decrement(count);
__ jcc(Assembler::greaterEqual, L_loop);
+ __ BIND(L_done);
}
break;
case BarrierSet::Epsilon: