comparison graal/GraalCompiler/src/com/sun/c1x/ir/Deoptimize.java @ 2671:d8601d421b96

New Deoptimize node, remove ResolveClass node and replace it with deoptimization
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Thu, 12 May 2011 17:17:50 +0200
parents
children 7b7dbe19fafb
comparison
equal deleted inserted replaced
2670:50b181d88c9f 2671:d8601d421b96
1 /*
2 * Copyright (c) 2009, 2011, 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 package com.sun.c1x.ir;
24
25 import com.oracle.graal.graph.*;
26 import com.sun.c1x.debug.*;
27 import com.sun.c1x.value.*;
28 import com.sun.cri.ci.*;
29
30
31 /**
32 *
33 */
34 public class Deoptimize extends Instruction {
35
36 private static final int INPUT_COUNT = 1;
37 private static final int SUCCESSOR_COUNT = 0;
38 private static final int INPUT_STATE_BEFORE = 0;
39
40 /**
41 * @param kind
42 * @param inputCount
43 * @param successorCount
44 * @param graph
45 */
46 public Deoptimize(Graph graph, FrameState stateBefore) {
47 super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph);
48 this.setStateBefore(stateBefore);
49 }
50
51 @Override
52 protected int inputCount() {
53 return super.inputCount() + INPUT_COUNT;
54 }
55
56 @Override
57 protected int successorCount() {
58 return super.successorCount() + SUCCESSOR_COUNT;
59 }
60
61 /**
62 * The state for this instruction.
63 */
64 public FrameState stateBefore() {
65 return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE);
66 }
67
68 public FrameState setStateBefore(FrameState n) {
69 return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_BEFORE, n);
70 }
71
72 @Override
73 public void accept(ValueVisitor v) {
74 v.visitDeoptimize(this);
75 }
76
77 @Override
78 public void print(LogStream out) {
79 out.print("deoptimize");
80 }
81
82 }