jdk

Форк
0
/
opaquenode.cpp 
116 строк · 3.5 Кб
1
/*
2
 * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 *
5
 * This code is free software; you can redistribute it and/or modify it
6
 * under the terms of the GNU General Public License version 2 only, as
7
 * published by the Free Software Foundation.
8
 *
9
 * This code is distributed in the hope that it will be useful, but WITHOUT
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
 * version 2 for more details (a copy is included in the LICENSE file that
13
 * accompanied this code).
14
 *
15
 * You should have received a copy of the GNU General Public License version
16
 * 2 along with this work; if not, write to the Free Software Foundation,
17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
 *
19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
 * or visit www.oracle.com if you need additional information or have any
21
 * questions.
22
 *
23
 */
24

25
#include "precompiled.hpp"
26
#include "opto/loopnode.hpp"
27
#include "opto/opaquenode.hpp"
28
#include "opto/phaseX.hpp"
29

30
//=============================================================================
31
// Do not allow value-numbering
32
uint Opaque1Node::hash() const { return NO_HASH; }
33
bool Opaque1Node::cmp( const Node &n ) const {
34
  return (&n == this);          // Always fail except on self
35
}
36

37
//------------------------------Identity---------------------------------------
38
// Do NOT remove the opaque node until no more loop opts can happen.
39
Node* Opaque1Node::Identity(PhaseGVN* phase) {
40
  if (phase->C->post_loop_opts_phase()) {
41
    return in(1);
42
  } else {
43
    phase->C->record_for_post_loop_opts_igvn(this);
44
  }
45
  return this;
46
}
47

48
#ifdef ASSERT
49
CountedLoopNode* OpaqueZeroTripGuardNode::guarded_loop() const {
50
  Node* iff = if_node();
51
  ResourceMark rm;
52
  Unique_Node_List wq;
53
  wq.push(iff);
54
  for (uint i = 0; i < wq.size(); ++i) {
55
    Node* nn = wq.at(i);
56
    for (DUIterator_Fast imax, i = nn->fast_outs(imax); i < imax; i++) {
57
      Node* u = nn->fast_out(i);
58
      if (u->is_OuterStripMinedLoop()) {
59
        wq.push(u);
60
      }
61
      if (u->is_CountedLoop() && u->as_CountedLoop()->is_canonical_loop_entry() == this) {
62
        return u->as_CountedLoop();
63
      }
64
      if (u->is_Region()) {
65
        continue;
66
      }
67
      if (u->is_CFG()) {
68
        wq.push(u);
69
      }
70
    }
71
  }
72
  return nullptr;
73
}
74
#endif
75

76
IfNode* OpaqueZeroTripGuardNode::if_node() const {
77
  Node* cmp = unique_out();
78
  assert(cmp->Opcode() == Op_CmpI, "");
79
  Node* bol = cmp->unique_out();
80
  assert(bol->Opcode() == Op_Bool, "");
81
  Node* iff = bol->unique_out();
82
  return iff->as_If();
83
}
84

85
const Type* Opaque4Node::Value(PhaseGVN* phase) const {
86
  return phase->type(in(1));
87
}
88

89
const Type* OpaqueInitializedAssertionPredicateNode::Value(PhaseGVN* phase) const {
90
  return phase->type(in(1));
91
}
92

93
//=============================================================================
94

95
uint ProfileBooleanNode::hash() const { return NO_HASH; }
96
bool ProfileBooleanNode::cmp( const Node &n ) const {
97
  return (&n == this);
98
}
99

100
Node *ProfileBooleanNode::Ideal(PhaseGVN *phase, bool can_reshape) {
101
  if (can_reshape && _delay_removal) {
102
    _delay_removal = false;
103
    return this;
104
  } else {
105
    return nullptr;
106
  }
107
}
108

109
Node* ProfileBooleanNode::Identity(PhaseGVN* phase) {
110
  if (_delay_removal) {
111
    return this;
112
  } else {
113
    assert(_consumed, "profile should be consumed before elimination");
114
    return in(1);
115
  }
116
}
117

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.