hotspot/src/share/vm/opto/opaquenode.cpp
author coleenp
Wed, 23 Dec 2015 20:07:39 +0000
changeset 35222 fc89375d788d
parent 28912 27fac2f8fdbe
child 35551 36ef3841fb34
permissions -rw-r--r--
8146011: sun/management/jmxremote/bootstrap/CustomLauncherTest crash at assert(stack_size) Summary: We were setting stack_overflow_limit before initialization completed which may change the stack base for some solaris systems with unlimited stack Reviewed-by: goetz, hseigel, gthornbr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     1
/*
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
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/opaquenode.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    27
#include "opto/phaseX.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    28
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    29
//=============================================================================
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    30
// Do not allow value-numbering
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    31
uint Opaque1Node::hash() const { return NO_HASH; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    32
uint Opaque1Node::cmp( const Node &n ) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    33
  return (&n == this);          // Always fail except on self
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
//------------------------------Identity---------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    37
// If _major_progress, then more loop optimizations follow.  Do NOT remove
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    38
// the opaque Node until no more loop ops can happen.  Note the timing of
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    39
// _major_progress; it's set in the major loop optimizations THEN comes the
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    40
// call to IterGVN and any chance of hitting this code.  Hence there's no
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    41
// phase-ordering problem with stripping Opaque1 in IGVN followed by some
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    42
// more loop optimizations that require it.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    43
Node *Opaque1Node::Identity( PhaseTransform *phase ) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    44
  return phase->C->major_progress() ? this : in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    45
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    46
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    47
//=============================================================================
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    48
// A node to prevent unwanted optimizations.  Allows constant folding.  Stops
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    49
// value-numbering, most Ideal calls or Identity functions.  This Node is
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    50
// specifically designed to prevent the pre-increment value of a loop trip
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    51
// counter from being live out of the bottom of the loop (hence causing the
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    52
// pre- and post-increment values both being live and thus requiring an extra
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    53
// temp register and an extra move).  If we "accidentally" optimize through
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    54
// this kind of a Node, we'll get slightly pessimal, but correct, code.  Thus
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    55
// it's OK to be slightly sloppy on optimizations here.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    56
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    57
// Do not allow value-numbering
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    58
uint Opaque2Node::hash() const { return NO_HASH; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    59
uint Opaque2Node::cmp( const Node &n ) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    60
  return (&n == this);          // Always fail except on self
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    61
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    62
28912
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    63
//=============================================================================
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    64
28912
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    65
uint ProfileBooleanNode::hash() const { return NO_HASH; }
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    66
uint ProfileBooleanNode::cmp( const Node &n ) const {
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    67
  return (&n == this);
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    68
}
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    69
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    70
Node *ProfileBooleanNode::Ideal(PhaseGVN *phase, bool can_reshape) {
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    71
  if (can_reshape && _delay_removal) {
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    72
    _delay_removal = false;
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    73
    return this;
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    74
  } else {
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    75
    return NULL;
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    76
  }
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    77
}
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    78
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    79
Node *ProfileBooleanNode::Identity( PhaseTransform *phase ) {
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    80
  if (_delay_removal) {
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    81
    return this;
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    82
  } else {
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    83
    assert(_consumed, "profile should be consumed before elimination");
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    84
    return in(1);
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    85
  }
27fac2f8fdbe 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents: 23528
diff changeset
    86
}