< prev index next >
src/hotspot/share/opto/matcher.cpp
Print this page
@@ -39,10 +39,13 @@
#include "opto/type.hpp"
#include "opto/vectornode.hpp"
#include "runtime/os.hpp"
#include "runtime/sharedRuntime.hpp"
#include "utilities/align.hpp"
+#if INCLUDE_ZGC
+#include "gc/z/zBarrierSetRuntime.hpp"
+#endif // INCLUDE_ZGC
OptoReg::Name OptoReg::c_frame_pointer;
const RegMask *Matcher::idealreg2regmask[_last_machine_leaf];
RegMask Matcher::mreg2regmask[_last_Mach_Reg];
@@ -2060,10 +2063,11 @@
}
if (nstate == Visit) {
mstack.set_state(Post_Visit);
set_visited(n); // Flag as visited now
bool mem_op = false;
+ int mem_addr_idx = MemNode::Address;
switch( nop ) { // Handle some opcodes special
case Op_Phi: // Treat Phis as shared roots
case Op_Parm:
case Op_Proj: // All handled specially during matching
@@ -2148,10 +2152,21 @@
break;
case Op_ClearArray:
case Op_SafePoint:
mem_op = true;
break;
+#if INCLUDE_ZGC
+ case Op_CallLeaf:
+ if (UseZGC) {
+ if (n->as_Call()->entry_point() == ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr() ||
+ n->as_Call()->entry_point() == ZBarrierSetRuntime::load_barrier_on_weak_oop_field_preloaded_addr()) {
+ mem_op = true;
+ mem_addr_idx = TypeFunc::Parms+1;
+ }
+ break;
+ }
+#endif
default:
if( n->is_Store() ) {
// Do match stores, despite no ideal reg
mem_op = true;
break;
@@ -2197,11 +2212,11 @@
continue;
}
#endif
// Clone addressing expressions as they are "free" in memory access instructions
- if (mem_op && i == MemNode::Address && mop == Op_AddP &&
+ if (mem_op && i == mem_addr_idx && mop == Op_AddP &&
// When there are other uses besides address expressions
// put it on stack and mark as shared.
!is_visited(m)) {
// Some inputs for address expression are not put on stack
// to avoid marking them as shared and forcing them into register
< prev index next >