Skip to content

Commit e659d9d

Browse files
committed
8342975: C2: Micro-optimize PhaseIdealLoop::Dominators()
Reviewed-by: dlong, kvn
1 parent 9f6211b commit e659d9d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/hotspot/share/opto/domgraph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,9 @@ void PhaseIdealLoop::Dominators() {
410410
// Setup mappings from my Graph to Tarjan's stuff and back
411411
// Note: Tarjan uses 1-based arrays
412412
NTarjan *ntarjan = NEW_RESOURCE_ARRAY(NTarjan,C->unique()+1);
413-
// Initialize _control field for fast reference
414-
int i;
415-
for( i= C->unique()-1; i>=0; i-- )
416-
ntarjan[i]._control = nullptr;
413+
// Initialize all fields at once for safety and extra performance.
414+
// Among other things, this initializes _control field for fast reference.
415+
memset(ntarjan, 0, (C->unique() + 1)*sizeof(NTarjan));
417416

418417
// Store the DFS order for the main loop
419418
const uint fill_value = max_juint;
@@ -429,6 +428,7 @@ void PhaseIdealLoop::Dominators() {
429428
ntarjan[0]._size = ntarjan[0]._semi = 0;
430429
ntarjan[0]._label = &ntarjan[0];
431430

431+
int i;
432432
for( i = dfsnum-1; i>1; i-- ) { // For all nodes in reverse DFS order
433433
NTarjan *w = &ntarjan[i]; // Get Node from DFS
434434
assert(w->_control != nullptr,"bad DFS walk");

0 commit comments

Comments
 (0)