src/hotspot/share/opto/intrinsicnode.cpp
author redestad
Thu, 20 Dec 2018 19:44:08 +0100
changeset 53091 5bf5b773fc41
parent 47216 71c04702a3d5
permissions -rw-r--r--
8215555: TieredCompilation C2 threads can excessively block handshakes Reviewed-by: kvn, neliasso, rehn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     1
/*
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     4
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     8
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    13
 * accompanied this code).
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    14
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    18
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    21
 * questions.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    22
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    23
 */
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    24
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    25
#include "precompiled.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    26
#include "opto/intrinsicnode.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    27
#include "opto/memnode.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    28
#include "opto/phaseX.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    29
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    30
//=============================================================================
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    31
// Do not match memory edge.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    32
uint StrIntrinsicNode::match_edge(uint idx) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    33
  return idx == 2 || idx == 3;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    34
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    35
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    36
//------------------------------Ideal------------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    37
// Return a node which is more "ideal" than the current node.  Strip out
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    38
// control copies
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    39
Node* StrIntrinsicNode::Ideal(PhaseGVN* phase, bool can_reshape) {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    40
  if (remove_dead_region(phase, can_reshape)) return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    41
  // Don't bother trying to transform a dead node
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    42
  if (in(0) && in(0)->is_top())  return NULL;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    43
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    44
  if (can_reshape) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    45
    Node* mem = phase->transform(in(MemNode::Memory));
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    46
    // If transformed to a MergeMem, get the desired slice
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    47
    uint alias_idx = phase->C->get_alias_index(adr_type());
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    48
    mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    49
    if (mem != in(MemNode::Memory)) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    50
      set_req(MemNode::Memory, mem);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    51
      return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    52
    }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    53
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    54
  return NULL;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    55
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    56
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    57
//------------------------------Value------------------------------------------
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 33628
diff changeset
    58
const Type* StrIntrinsicNode::Value(PhaseGVN* phase) const {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    59
  if (in(0) && phase->type(in(0)) == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    60
  return bottom_type();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    61
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    62
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    63
uint StrIntrinsicNode::size_of() const { return sizeof(*this); }
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    64
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    65
//=============================================================================
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    66
//------------------------------Ideal------------------------------------------
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    67
// Return a node which is more "ideal" than the current node.  Strip out
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    68
// control copies
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    69
Node* StrCompressedCopyNode::Ideal(PhaseGVN* phase, bool can_reshape) {
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    70
  return remove_dead_region(phase, can_reshape) ? this : NULL;
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    71
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    72
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    73
//=============================================================================
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    74
//------------------------------Ideal------------------------------------------
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    75
// Return a node which is more "ideal" than the current node.  Strip out
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    76
// control copies
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    77
Node* StrInflatedCopyNode::Ideal(PhaseGVN* phase, bool can_reshape) {
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    78
  return remove_dead_region(phase, can_reshape) ? this : NULL;
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    79
}
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    80
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    81
//=============================================================================
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    82
//------------------------------match_edge-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    83
// Do not match memory edge
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    84
uint EncodeISOArrayNode::match_edge(uint idx) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    85
  return idx == 2 || idx == 3; // EncodeISOArray src (Binary dst len)
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    86
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    87
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    88
//------------------------------Ideal------------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    89
// Return a node which is more "ideal" than the current node.  Strip out
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    90
// control copies
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 23528
diff changeset
    91
Node* EncodeISOArrayNode::Ideal(PhaseGVN* phase, bool can_reshape) {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    92
  return remove_dead_region(phase, can_reshape) ? this : NULL;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    93
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    94
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    95
//------------------------------Value------------------------------------------
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 33628
diff changeset
    96
const Type* EncodeISOArrayNode::Value(PhaseGVN* phase) const {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    97
  if (in(0) && phase->type(in(0)) == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    98
  return bottom_type();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    99
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   100