< prev index next >
src/share/vm/opto/callnode.cpp
Print this page
rev 9640 : 8144993: Elide redundant memory barrier after AllocationNode
Summary: Elide memory barrier for AllocationNode when it doesn't escape in initializer and has an MemBarRelease node at exit of initializer method.
Reviewed-by: duke
@@ -1331,10 +1331,11 @@
{
init_class_id(Class_Allocate);
init_flags(Flag_is_macro);
_is_scalar_replaceable = false;
_is_non_escaping = false;
+ _is_allocation_MemBar_redundant = false;
Node *topnode = C->top();
init_req( TypeFunc::Control , ctrl );
init_req( TypeFunc::I_O , abio );
init_req( TypeFunc::Memory , mem );
@@ -1345,10 +1346,27 @@
init_req( InitialTest , initial_test);
init_req( ALength , topnode);
C->add_macro_node(this);
}
+void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
+{
+ assert(initializer != NULL &&
+ initializer->is_initializer() &&
+ !initializer->is_static(),
+ "unexpected initializer method");
+ BCEscapeAnalyzer* analyzer = initializer->get_bcea();
+ if (analyzer == NULL) {
+ return;
+ }
+
+ // Allocation node is first parameter in its initializer
+ if (analyzer->is_arg_stack(0) || analyzer->is_arg_local(0)) {
+ _is_allocation_MemBar_redundant = true;
+ }
+}
+
//=============================================================================
Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (remove_dead_region(phase, can_reshape)) return this;
// Don't bother trying to transform a dead node
if (in(0) && in(0)->is_top()) return NULL;
< prev index next >