hotspot/src/share/vm/opto/narrowptrnode.cpp
author iveresov
Thu, 22 Jan 2015 11:25:23 -0800
changeset 28723 0a36120cb225
parent 23528 8f1a7f5e8066
child 30300 4b12a5b40064
permissions -rw-r--r--
8071302: assert(!_reg_node[reg_lo] || edge_from_to(_reg_node[reg_lo], def)) failed: after block local Summary: Add merge nodes to node to block mapping Reviewed-by: kvn, vlivanov
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/narrowptrnode.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
Node* DecodeNNode::Identity(PhaseTransform* phase) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    30
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    31
  if( t == Type::TOP ) return in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    32
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    33
  if (in(1)->is_EncodeP()) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    34
    // (DecodeN (EncodeP p)) -> p
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    35
    return in(1)->in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    36
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    37
  return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    38
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    39
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    40
const Type *DecodeNNode::Value( PhaseTransform *phase ) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    41
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    42
  if (t == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    43
  if (t == TypeNarrowOop::NULL_PTR) return TypePtr::NULL_PTR;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    44
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    45
  assert(t->isa_narrowoop(), "only  narrowoop here");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    46
  return t->make_ptr();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    47
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    48
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    49
Node* EncodePNode::Identity(PhaseTransform* phase) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    50
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    51
  if( t == Type::TOP ) return in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    52
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    53
  if (in(1)->is_DecodeN()) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    54
    // (EncodeP (DecodeN p)) -> p
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    55
    return in(1)->in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    56
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    57
  return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    58
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    59
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    60
const Type *EncodePNode::Value( PhaseTransform *phase ) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    61
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    62
  if (t == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    63
  if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    64
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    65
  assert(t->isa_oop_ptr(), "only oopptr here");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    66
  return t->make_narrowoop();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    67
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    68
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    69
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    70
Node *EncodeNarrowPtrNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    71
  return MemNode::Ideal_common_DU_postCCP(ccp, this, in(1));
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    72
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    73
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    74
Node* DecodeNKlassNode::Identity(PhaseTransform* phase) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    75
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    76
  if( t == Type::TOP ) return in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    77
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    78
  if (in(1)->is_EncodePKlass()) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    79
    // (DecodeNKlass (EncodePKlass p)) -> p
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    80
    return in(1)->in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    81
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    82
  return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    83
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    84
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    85
const Type *DecodeNKlassNode::Value( PhaseTransform *phase ) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    86
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    87
  if (t == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    88
  assert(t != TypeNarrowKlass::NULL_PTR, "null klass?");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    89
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    90
  assert(t->isa_narrowklass(), "only narrow klass ptr here");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    91
  return t->make_ptr();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    92
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    93
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    94
Node* EncodePKlassNode::Identity(PhaseTransform* phase) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    95
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    96
  if( t == Type::TOP ) return in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    97
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    98
  if (in(1)->is_DecodeNKlass()) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    99
    // (EncodePKlass (DecodeNKlass p)) -> p
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   100
    return in(1)->in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   101
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   102
  return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   103
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   104
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   105
const Type *EncodePKlassNode::Value( PhaseTransform *phase ) const {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   106
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   107
  if (t == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   108
  assert (t != TypePtr::NULL_PTR, "null klass?");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   109
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   110
  assert(UseCompressedClassPointers && t->isa_klassptr(), "only klass ptr here");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   111
  return t->make_narrowklass();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   112
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   113