Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java @ 2600:f1bc67c2d453
new node layout: TypeCheck, RegisterFinalizer, Invoke, NewArray, NullCheck
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 05 May 2011 16:32:20 +0200 |
parents | c58a301eb2d7 |
children | 91d3952f7eb7 |
comparison
equal
deleted
inserted
replaced
2596:1c36b17f7ee0 | 2600:f1bc67c2d453 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.sun.c1x.ir; | 23 package com.sun.c1x.ir; |
24 | 24 |
25 import com.oracle.graal.graph.*; | |
25 import com.sun.c1x.debug.*; | 26 import com.sun.c1x.debug.*; |
26 import com.sun.c1x.value.*; | 27 import com.sun.c1x.value.*; |
27 import com.sun.cri.ci.*; | 28 import com.sun.cri.ci.*; |
28 | 29 |
30 /** | |
31 * This instruction is used to perform the finalizer registration at the end of the java.lang.Object constructor. | |
32 */ | |
29 public class RegisterFinalizer extends StateSplit { | 33 public class RegisterFinalizer extends StateSplit { |
30 | 34 |
31 private Value object; | 35 private static final int INPUT_COUNT = 1; |
36 private static final int INPUT_OBJECT = 0; | |
32 | 37 |
33 public RegisterFinalizer(Value object, FrameState stateBefore) { | 38 private static final int SUCCESSOR_COUNT = 0; |
34 super(CiKind.Void, stateBefore); | |
35 this.object = object; | |
36 } | |
37 | 39 |
38 public Value object() { | 40 @Override |
39 return object; | 41 protected int inputCount() { |
42 return super.inputCount() + INPUT_COUNT; | |
40 } | 43 } |
41 | 44 |
42 @Override | 45 @Override |
43 public void inputValuesDo(ValueClosure closure) { | 46 protected int successorCount() { |
44 object = closure.apply(object); | 47 return super.successorCount() + SUCCESSOR_COUNT; |
45 super.inputValuesDo(closure); | 48 } |
49 | |
50 /** | |
51 * The instruction that produces the object whose finalizer should be registered. | |
52 */ | |
53 public Value object() { | |
54 return (Value) inputs().get(super.inputCount() + INPUT_OBJECT); | |
55 } | |
56 | |
57 public Value setObject(Value n) { | |
58 return (Value) inputs().set(super.inputCount() + INPUT_OBJECT, n); | |
59 } | |
60 | |
61 public RegisterFinalizer(Value object, FrameState stateBefore, Graph graph) { | |
62 super(CiKind.Void, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph); | |
63 setObject(object); | |
46 } | 64 } |
47 | 65 |
48 @Override | 66 @Override |
49 public void accept(ValueVisitor v) { | 67 public void accept(ValueVisitor v) { |
50 v.visitRegisterFinalizer(this); | 68 v.visitRegisterFinalizer(this); |
51 } | 69 } |
52 | 70 |
53 @Override | 71 @Override |
54 public void print(LogStream out) { | 72 public void print(LogStream out) { |
55 out.print("register finalizer ").print(object); | 73 out.print("register finalizer ").print(object()); |
56 } | 74 } |
57 } | 75 } |