--- old/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2018-07-25 11:31:21.204899015 +0100 +++ new/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2018-07-25 11:31:20.926898185 +0100 @@ -10935,6 +10935,44 @@ 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 is_pre) +{ + 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 (!is_pre && (optimized || no_evict)) { + // need an sfence for post flush when using clflushopt or clwb + // otherwise no no need for any synchroniaztion + + sfence(); + } +} + Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { switch (cond) { // Note some conditions are synonyms for others