mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
6674600: (Escape Analysis) Optimize memory graph for instance's fields
EA gives opportunite to do more aggressive memory optimizations. Reviewed-by: never, jrose
This commit is contained in:
parent
1ba2523386
commit
cdd27962da
7 changed files with 318 additions and 14 deletions
|
@ -2922,10 +2922,22 @@ Node* GraphKit::new_instance(Node* klass_node,
|
|||
const TypeOopPtr* oop_type = tklass->as_instance_type();
|
||||
|
||||
// Now generate allocation code
|
||||
|
||||
// With escape analysis, the entire memory state is needed to be able to
|
||||
// eliminate the allocation. If the allocations cannot be eliminated, this
|
||||
// will be optimized to the raw slice when the allocation is expanded.
|
||||
Node *mem;
|
||||
if (C->do_escape_analysis()) {
|
||||
mem = reset_memory();
|
||||
set_all_memory(mem);
|
||||
} else {
|
||||
mem = memory(Compile::AliasIdxRaw);
|
||||
}
|
||||
|
||||
AllocateNode* alloc
|
||||
= new (C, AllocateNode::ParmLimit)
|
||||
AllocateNode(C, AllocateNode::alloc_type(),
|
||||
control(), memory(Compile::AliasIdxRaw), i_o(),
|
||||
control(), mem, i_o(),
|
||||
size, klass_node,
|
||||
initial_slow_test);
|
||||
|
||||
|
@ -3056,11 +3068,23 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
|
|||
}
|
||||
|
||||
// Now generate allocation code
|
||||
|
||||
// With escape analysis, the entire memory state is needed to be able to
|
||||
// eliminate the allocation. If the allocations cannot be eliminated, this
|
||||
// will be optimized to the raw slice when the allocation is expanded.
|
||||
Node *mem;
|
||||
if (C->do_escape_analysis()) {
|
||||
mem = reset_memory();
|
||||
set_all_memory(mem);
|
||||
} else {
|
||||
mem = memory(Compile::AliasIdxRaw);
|
||||
}
|
||||
|
||||
// Create the AllocateArrayNode and its result projections
|
||||
AllocateArrayNode* alloc
|
||||
= new (C, AllocateArrayNode::ParmLimit)
|
||||
AllocateArrayNode(C, AllocateArrayNode::alloc_type(),
|
||||
control(), memory(Compile::AliasIdxRaw), i_o(),
|
||||
control(), mem, i_o(),
|
||||
size, klass_node,
|
||||
initial_slow_test,
|
||||
length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue