8176513: Poor code quality for ByteBuffers
Summary: Relaxes the condition under which MemBarCPUOrder nodes are added around unsafe accesses.
Reviewed-by: vlivanov, kvn, jrose
--- a/hotspot/src/share/vm/opto/library_call.cpp Wed Mar 15 13:03:13 2017 +0100
+++ b/hotspot/src/share/vm/opto/library_call.cpp Wed Mar 15 18:18:04 2017 -0700
@@ -2375,7 +2375,7 @@
bool need_mem_bar;
switch (kind) {
case Relaxed:
- need_mem_bar = mismatched || can_access_non_heap;
+ need_mem_bar = mismatched && !adr_type->isa_aryptr();
break;
case Opaque:
// Opaque uses CPUOrder membars for protection against code movement.