--- old/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2018-07-19 11:58:43.556259215 +0100 +++ new/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2018-07-19 11:58:43.285258399 +0100 @@ -10935,6 +10935,39 @@ bind(done); } +void MacroAssembler::cache_wb(Address line) +{ + // 64 bit cpus always support clflush + assert(VM_Version::supports_clflush(), "should not reach here on 32-bit"); + bool optimized = VM_Version::supports_clflushopt(); + bool no_evict = VM_Version::supports_clwb(); + + // pick the correct implementation + + if (optimized) { + if (no_evict) { + clwb(line); + } else { + clflushopt(line); + } + } else { + // no need for fence when using CLFLUSH + clflush(line); + } +} + + +void MacroAssembler::cache_wbsync(bool isPre) +{ + assert(VM_Version::supports_clflush(), "should not reach here on 32-bit"); + bool optimized = VM_Version::supports_clflushopt(); + bool no_evict = VM_Version::supports_clwb(); + + // always need an mfence for pre or post flush even with clflush + // TODO true for pre-sync but check if we can ignore a post sync + mfence(); +} + Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { switch (cond) { // Note some conditions are synonyms for others