src/hotspot/share/opto/live.cpp
author redestad
Thu, 14 Nov 2019 15:24:35 +0100
changeset 59081 95a99e617f28
parent 57632 9c523692db7e
permissions -rw-r--r--
8234003: Improve IndexSet iteration Reviewed-by: neliasso, thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 37248
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2154
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2154
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2154
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "memory/allocation.inline.hpp"
37248
11a660dbbb8e 8132524: Missing includes to resourceArea.hpp
jprovino
parents: 33065
diff changeset
    27
#include "memory/resourceArea.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "opto/callnode.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "opto/chaitin.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "opto/live.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "opto/machnode.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// Compute live-in/live-out.  We use a totally incremental algorithm.  The LIVE
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// problem is monotonic.  The steady-state solution looks like this: pull a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// block from the worklist.  It has a set of delta's - values which are newly
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// live-in from the block.  Push these to the live-out sets of all predecessor
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// blocks.  At each predecessor, the new live-out values are ANDed with what is
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// already live-out (extra stuff is added to the live-out sets).  Then the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// remaining new live-out values are ANDed with what is locally defined.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// Leftover bits become the new live-in for the predecessor block, and the pred
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// block is put on the worklist.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
//   The locally live-in stuff is computed once and added to predecessor
2131
98f9cef66a34 6810672: Comment typos
twisti
parents: 2030
diff changeset
    44
// live-out sets.  This separate compilation is done in the outer loop below.
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    45
PhaseLive::PhaseLive(const PhaseCFG &cfg, const LRG_List &names, Arena *arena, bool keep_deltas)
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    46
  : Phase(LIVE),
51333
f6641fcf7b7e 8208670: Compiler changes to allow enabling -Wreorder
tschatzl
parents: 47216
diff changeset
    47
  _live(0),
f6641fcf7b7e 8208670: Compiler changes to allow enabling -Wreorder
tschatzl
parents: 47216
diff changeset
    48
  _livein(0),
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    49
  _cfg(cfg),
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    50
  _names(names),
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    51
  _arena(arena),
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    52
  _keep_deltas(keep_deltas) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
void PhaseLive::compute(uint maxlrg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  _maxlrg   = maxlrg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  _worklist = new (_arena) Block_List();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  // Init the sparse live arrays.  This data is live on exit from here!
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // The _live info is the live-out info.
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    61
  _live = (IndexSet*)_arena->Amalloc(sizeof(IndexSet) * _cfg.number_of_blocks());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  uint i;
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    63
  for (i = 0; i < _cfg.number_of_blocks(); i++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    _live[i].initialize(_maxlrg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    67
  if (_keep_deltas) {
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    68
    _livein = (IndexSet*)_arena->Amalloc(sizeof(IndexSet) * _cfg.number_of_blocks());
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    69
    for (i = 0; i < _cfg.number_of_blocks(); i++) {
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    70
      _livein[i].initialize(_maxlrg);
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    71
    }
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    72
  }
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
    73
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Init the sparse arrays for delta-sets.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  ResourceMark rm;              // Nuke temp storage on exit
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  // Does the memory used by _defs and _deltas get reclaimed?  Does it matter?  TT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  // Array of values defined locally in blocks
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    80
  _defs = NEW_RESOURCE_ARRAY(IndexSet,_cfg.number_of_blocks());
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    81
  for (i = 0; i < _cfg.number_of_blocks(); i++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    _defs[i].initialize(_maxlrg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // Array of delta-set pointers, indexed by block pre_order-1.
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    86
  _deltas = NEW_RESOURCE_ARRAY(IndexSet*,_cfg.number_of_blocks());
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
    87
  memset(_deltas, 0, sizeof(IndexSet*)* _cfg.number_of_blocks());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  _free_IndexSet = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  // Blocks having done pass-1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  VectorSet first_pass(Thread::current()->resource_area());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // Outer loop: must compute local live-in sets and push into predecessors.
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    95
  for (uint j = _cfg.number_of_blocks(); j > 0; j--) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    96
    Block* block = _cfg.get_block(j - 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    // Compute the local live-in set.  Start with any new live-out bits.
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
    99
    IndexSet* use = getset(block);
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   100
    IndexSet* def = &_defs[block->_pre_order-1];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    DEBUG_ONLY(IndexSet *def_outside = getfreeset();)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    uint i;
19717
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   103
    for (i = block->number_of_nodes(); i > 1; i--) {
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   104
      Node* n = block->get_node(i-1);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   105
      if (n->is_Phi()) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   106
        break;
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   107
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
20007
b67e71448544 8024646: Remove LRG_List container, replace it with GrowableArray
adlertz
parents: 19717
diff changeset
   109
      uint r = _names.at(n->_idx);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      assert(!def_outside->member(r), "Use of external LRG overlaps the same LRG defined in this block");
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   111
      def->insert(r);
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   112
      use->remove(r);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
      uint cnt = n->req();
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   114
      for (uint k = 1; k < cnt; k++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
        Node *nk = n->in(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
        uint nkidx = nk->_idx;
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   117
        if (_cfg.get_block_for_node(nk) != block) {
20007
b67e71448544 8024646: Remove LRG_List container, replace it with GrowableArray
adlertz
parents: 19717
diff changeset
   118
          uint u = _names.at(nkidx);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   119
          use->insert(u);
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   120
          DEBUG_ONLY(def_outside->insert(u);)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    def_outside->set_next(_free_IndexSet);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    _free_IndexSet = def_outside;     // Drop onto free list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    // Remove anything defined by Phis and the block start instruction
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   129
    for (uint k = i; k > 0; k--) {
20007
b67e71448544 8024646: Remove LRG_List container, replace it with GrowableArray
adlertz
parents: 19717
diff changeset
   130
      uint r = _names.at(block->get_node(k - 1)->_idx);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   131
      def->insert(r);
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   132
      use->remove(r);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    // Push these live-in things to predecessors
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   136
    for (uint l = 1; l < block->num_preds(); l++) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   137
      Block* p = _cfg.get_block_for_node(block->pred(l));
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   138
      add_liveout(p, use, first_pass);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
      // PhiNode uses go in the live-out set of prior blocks.
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   141
      for (uint k = i; k > 0; k--) {
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   142
        Node *phi = block->get_node(k - 1);
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   143
        if (l < phi->req()) {
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   144
          add_liveout(p, _names.at(phi->in(l)->_idx), first_pass);
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   145
        }
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   146
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    }
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   148
    freeset(block);
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   149
    first_pass.set(block->_pre_order);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    // Inner loop: blocks that picked up new live-out values to be propagated
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   152
    while (_worklist->size()) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   153
      Block* block = _worklist->pop();
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   154
      IndexSet *delta = getset(block);
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   155
      assert(delta->count(), "missing delta set");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
      // Add new-live-in to predecessors live-out sets
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   158
      for (uint l = 1; l < block->num_preds(); l++) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   159
        Block* predecessor = _cfg.get_block_for_node(block->pred(l));
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   160
        add_liveout(predecessor, delta, first_pass);
19279
4be3c2e6663c 8022284: Hide internal data structure in PhaseCFG
adlertz
parents: 17013
diff changeset
   161
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   163
      freeset(block);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    } // End of while-worklist-not-empty
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  } // End of for-all-blocks-outer-loop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  // We explicitly clear all of the IndexSets which we are about to release.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  // This allows us to recycle their internal memory into IndexSet's free list.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   171
  for (i = 0; i < _cfg.number_of_blocks(); i++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    _defs[i].clear();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    if (_deltas[i]) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
      // Is this always true?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
      _deltas[i]->clear();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  IndexSet *free = _free_IndexSet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  while (free != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    IndexSet *temp = free;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    free = free->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    temp->clear();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
void PhaseLive::stats(uint iters) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
// Get an IndexSet for a block.  Return existing one, if any.  Make a new
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
// empty one if a prior one does not exist.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   194
IndexSet *PhaseLive::getset(Block *p) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  IndexSet *delta = _deltas[p->_pre_order-1];
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   196
  if (!delta) {                 // Not on worklist?
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    // Get a free set; flag as being on worklist
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    delta = _deltas[p->_pre_order-1] = getfreeset();
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   199
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  return delta;                 // Return set of new live-out items
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
// Pull from free list, or allocate.  Internal allocation on the returned set
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
// is always from thread local storage.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   205
IndexSet *PhaseLive::getfreeset() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  IndexSet *f = _free_IndexSet;
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   207
  if (!f) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    f = new IndexSet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    f->initialize(_maxlrg, Thread::current()->resource_area());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    // Pull from free list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    _free_IndexSet = f->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    f->initialize(_maxlrg, Thread::current()->resource_area());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  return f;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
// Free an IndexSet from a block.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   219
void PhaseLive::freeset(Block *p) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  IndexSet *f = _deltas[p->_pre_order-1];
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   221
  if (_keep_deltas) {
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   222
    add_livein(p, f);
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   223
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  f->set_next(_free_IndexSet);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  _free_IndexSet = f;           // Drop onto free list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  _deltas[p->_pre_order-1] = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
// Add a live-out value to a given blocks live-out set.  If it is new, then
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
// also add it to the delta set and stick the block on the worklist.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   231
void PhaseLive::add_liveout(Block *p, uint r, VectorSet &first_pass) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  IndexSet *live = &_live[p->_pre_order-1];
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   233
  if (live->insert(r)) {        // If actually inserted...
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    // We extended the live-out set.  See if the value is generated locally.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    // If it is not, then we must extend the live-in set.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   236
    if (!_defs[p->_pre_order-1].member(r)) {
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   237
      if (!_deltas[p->_pre_order-1] && // Not on worklist?
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   238
          first_pass.test(p->_pre_order)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
        _worklist->push(p);     // Actually go on worklist if already 1st pass
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   240
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
      getset(p)->insert(r);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
// Add a vector of live-out values to a given blocks live-out set.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   247
void PhaseLive::add_liveout(Block *p, IndexSet *lo, VectorSet &first_pass) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  IndexSet *live = &_live[p->_pre_order-1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  IndexSet *defs = &_defs[p->_pre_order-1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  IndexSet *on_worklist = _deltas[p->_pre_order-1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  IndexSet *delta = on_worklist ? on_worklist : getfreeset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   253
  if (!lo->is_empty()) {
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   254
    IndexSetIterator elements(lo);
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   255
    uint r;
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   256
    while ((r = elements.next()) != 0) {
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   257
      if (live->insert(r) &&      // If actually inserted...
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   258
          !defs->member(r)) {     // and not defined locally
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   259
        delta->insert(r);         // Then add to live-in set
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   260
      }
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   261
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   264
  if (delta->count()) {                // If actually added things
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
    _deltas[p->_pre_order-1] = delta; // Flag as on worklist now
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   266
    if (!on_worklist &&         // Not on worklist?
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   267
        first_pass.test(p->_pre_order)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
      _worklist->push(p);       // Actually go on worklist if already 1st pass
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   269
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  } else {                      // Nothing there; just free it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
    delta->set_next(_free_IndexSet);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
    _free_IndexSet = delta;     // Drop onto free list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   276
// Add a vector of live-in values to a given blocks live-in set.
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   277
void PhaseLive::add_livein(Block *p, IndexSet *lo) {
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   278
  IndexSet *livein = &_livein[p->_pre_order-1];
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   279
  if (!livein->is_empty()) {
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   280
    IndexSetIterator elements(lo);
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   281
    uint r;
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   282
    while ((r = elements.next()) != 0) {
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   283
      livein->insert(r);         // Then add to live-in set
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   284
    }
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   285
  }
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   286
}
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   287
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
// Dump the live-out set for a block
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   290
void PhaseLive::dump(const Block *b) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  tty->print("Block %d: ",b->_pre_order);
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   292
  if (_keep_deltas) {
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   293
    tty->print("LiveIn: ");  _livein[b->_pre_order-1].dump();
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 22234
diff changeset
   294
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  tty->print("LiveOut: ");  _live[b->_pre_order-1].dump();
19717
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   296
  uint cnt = b->number_of_nodes();
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   297
  for (uint i = 0; i < cnt; i++) {
20007
b67e71448544 8024646: Remove LRG_List container, replace it with GrowableArray
adlertz
parents: 19717
diff changeset
   298
    tty->print("L%d/", _names.at(b->get_node(i)->_idx));
19717
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   299
    b->get_node(i)->dump();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  tty->print("\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
// Verify that base pointers and derived pointers are still sane.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   305
void PhaseChaitin::verify_base_ptrs(ResourceArea *a) const {
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   306
#ifdef ASSERT
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   307
  Unique_Node_List worklist(a);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   308
  for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   309
    Block* block = _cfg.get_block(i);
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   310
    for (uint j = block->end_idx() + 1; j > 1; j--) {
19717
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   311
      Node* n = block->get_node(j-1);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   312
      if (n->is_Phi()) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   313
        break;
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   314
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
      // Found a safepoint?
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   316
      if (n->is_MachSafePoint()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
        MachSafePointNode *sfpt = n->as_MachSafePoint();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
        JVMState* jvms = sfpt->jvms();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
        if (jvms != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
          // Now scan for a live derived pointer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
          if (jvms->oopoff() < sfpt->req()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
            // Check each derived/base pair
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   323
            for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
              Node *check = sfpt->in(idx);
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   325
              bool is_derived = ((idx - jvms->oopoff()) & 1) == 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
              // search upwards through spills and spill phis for AddP
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   327
              worklist.clear();
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   328
              worklist.push(check);
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   329
              uint k = 0;
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   330
              while (k < worklist.size()) {
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   331
                check = worklist.at(k);
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   332
                assert(check,"Bad base or derived pointer");
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   333
                // See PhaseChaitin::find_base_for_derived() for all cases.
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   334
                int isc = check->is_Copy();
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   335
                if (isc) {
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   336
                  worklist.push(check->in(isc));
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   337
                } else if (check->is_Phi()) {
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   338
                  for (uint m = 1; m < check->req(); m++)
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   339
                    worklist.push(check->in(m));
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   340
                } else if (check->is_Con()) {
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   341
                  if (is_derived) {
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   342
                    // Derived is NULL+offset
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   343
                    assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad derived pointer");
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   344
                  } else {
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   345
                    assert(check->bottom_type()->is_ptr()->_offset == 0,"Bad base pointer");
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   346
                    // Base either ConP(NULL) or loadConP
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   347
                    if (check->is_Mach()) {
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   348
                      assert(check->as_Mach()->ideal_Opcode() == Op_ConP,"Bad base pointer");
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   349
                    } else {
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   350
                      assert(check->Opcode() == Op_ConP &&
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   351
                             check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad base pointer");
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   352
                    }
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   353
                  }
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   354
                } else if (check->bottom_type()->is_ptr()->_offset == 0) {
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   355
                  if (check->is_Proj() || (check->is_Mach() &&
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   356
                     (check->as_Mach()->ideal_Opcode() == Op_CreateEx ||
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   357
                      check->as_Mach()->ideal_Opcode() == Op_ThreadLocal ||
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   358
                      check->as_Mach()->ideal_Opcode() == Op_CMoveP ||
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   359
                      check->as_Mach()->ideal_Opcode() == Op_CheckCastPP ||
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   360
#ifdef _LP64
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 37248
diff changeset
   361
                      (UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP) ||
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 37248
diff changeset
   362
                      (UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN) ||
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 37248
diff changeset
   363
                      (UseCompressedClassPointers && check->as_Mach()->ideal_Opcode() == Op_DecodeNKlass) ||
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   364
#endif
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   365
                      check->as_Mach()->ideal_Opcode() == Op_LoadP ||
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 37248
diff changeset
   366
                      check->as_Mach()->ideal_Opcode() == Op_LoadKlass))) {
2030
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   367
                    // Valid nodes
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   368
                  } else {
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   369
                    check->dump();
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   370
                    assert(false,"Bad base or derived pointer");
2030
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   371
                  }
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   372
                } else {
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   373
                  assert(is_derived,"Bad base pointer");
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   374
                  assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer");
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   375
                }
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   376
                k++;
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   377
                assert(k < 100000,"Derived pointer checking in infinite loop");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
              } // End while
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
          } // End of check for derived pointers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        } // End of Kcheck for debug info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
      } // End of if found a safepoint
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    } // End of forall instructions in block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  } // End of forall blocks
2014
5510e7394f2d 6782232: assert("CreateEx must be first instruction in block" )
kvn
parents: 1
diff changeset
   385
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
}
2030
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   387
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   388
// Verify that graphs and base pointers are still sane.
59081
95a99e617f28 8234003: Improve IndexSet iteration
redestad
parents: 57632
diff changeset
   389
void PhaseChaitin::verify(ResourceArea *a, bool verify_ifg) const {
2030
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   390
#ifdef ASSERT
57632
9c523692db7e 6394013: C2: Remove VerifyOpto
thartmann
parents: 51333
diff changeset
   391
  if (VerifyRegisterAllocator) {
2030
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   392
    _cfg.verify();
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   393
    verify_base_ptrs(a);
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   394
    if(verify_ifg)
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   395
      _ifg->verify(this);
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   396
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
#endif
2030
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   398
}
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   399
39d55e4534b4 6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
kvn
parents: 2014
diff changeset
   400
#endif