hotspot/src/share/vm/opto/narrowptrnode.cpp
author thartmann
Mon, 04 Jul 2016 09:14:02 +0200
changeset 40044 4e8299073922
parent 35551 36ef3841fb34
permissions -rw-r--r--
8160651: StubRoutines::_dtan does not restore callee save register rbx Summary: Pop rbx before leaving stub. Reviewed-by: vlivanov, vdeshpande
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
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
    29
Node* DecodeNNode::Identity(PhaseGVN* phase) {
23528
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
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
    40
const Type* DecodeNNode::Value(PhaseGVN* phase) const {
23528
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
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
    49
Node* EncodePNode::Identity(PhaseGVN* phase) {
23528
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
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
    60
const Type* EncodePNode::Value(PhaseGVN* phase) const {
23528
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
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
    70
Node* DecodeNKlassNode::Identity(PhaseGVN* phase) {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    71
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    72
  if( t == Type::TOP ) return in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    73
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    74
  if (in(1)->is_EncodePKlass()) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    75
    // (DecodeNKlass (EncodePKlass p)) -> p
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    76
    return in(1)->in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    77
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    78
  return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    79
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    80
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
    81
const Type* DecodeNKlassNode::Value(PhaseGVN* phase) const {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    82
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    83
  if (t == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    84
  assert(t != TypeNarrowKlass::NULL_PTR, "null klass?");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    85
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    86
  assert(t->isa_narrowklass(), "only narrow klass ptr here");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    87
  return t->make_ptr();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    88
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    89
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
    90
Node* EncodePKlassNode::Identity(PhaseGVN* phase) {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    91
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    92
  if( t == Type::TOP ) return in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    93
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    94
  if (in(1)->is_DecodeNKlass()) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    95
    // (EncodePKlass (DecodeNKlass p)) -> p
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    96
    return in(1)->in(1);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    97
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    98
  return this;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    99
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   100
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 30300
diff changeset
   101
const Type* EncodePKlassNode::Value(PhaseGVN* phase) const {
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   102
  const Type *t = phase->type( in(1) );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   103
  if (t == Type::TOP) return Type::TOP;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   104
  assert (t != TypePtr::NULL_PTR, "null klass?");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   105
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   106
  assert(UseCompressedClassPointers && t->isa_klassptr(), "only klass ptr here");
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   107
  return t->make_narrowklass();
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   108
}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   109