Mercurial > hg > truffle
comparison graal/com.oracle.max.graal.compiler/src/com/sun/c1x/ir/AccessMonitor.java @ 2872:0341b6424579
Project renaming.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 08 Jun 2011 08:42:25 +0200 |
parents | graal/GraalCompiler/src/com/sun/c1x/ir/AccessMonitor.java@569228710be8 |
children |
comparison
equal
deleted
inserted
replaced
2871:d704eb526603 | 2872:0341b6424579 |
---|---|
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.cri.ci.*; | |
27 | |
28 /** | |
29 * The {@code AccessMonitor} instruction is the base class of both monitor acquisition and release. | |
30 */ | |
31 public abstract class AccessMonitor extends StateSplit { | |
32 | |
33 private static final int INPUT_COUNT = 2; | |
34 private static final int INPUT_OBJECT = 0; | |
35 private static final int INPUT_LOCK_ADDRESS = 1; | |
36 | |
37 private static final int SUCCESSOR_COUNT = 0; | |
38 | |
39 @Override | |
40 protected int inputCount() { | |
41 return super.inputCount() + INPUT_COUNT; | |
42 } | |
43 | |
44 @Override | |
45 protected int successorCount() { | |
46 return super.successorCount() + SUCCESSOR_COUNT; | |
47 } | |
48 | |
49 /** | |
50 * The instruction producing the object locked or unlocked by this instruction. | |
51 */ | |
52 public Value object() { | |
53 return (Value) inputs().get(super.inputCount() + INPUT_OBJECT); | |
54 } | |
55 | |
56 public Value setObject(Value n) { | |
57 return (Value) inputs().set(super.inputCount() + INPUT_OBJECT, n); | |
58 } | |
59 | |
60 /** | |
61 * The instruction producing the address of the lock object. | |
62 */ | |
63 public Value lockAddress() { | |
64 return (Value) inputs().get(super.inputCount() + INPUT_LOCK_ADDRESS); | |
65 } | |
66 | |
67 public Value setLockAddress(Value n) { | |
68 return (Value) inputs().set(super.inputCount() + INPUT_LOCK_ADDRESS, n); | |
69 } | |
70 | |
71 /** | |
72 * The lock number of this monitor access. | |
73 */ | |
74 public final int lockNumber; | |
75 | |
76 /** | |
77 * Creates a new AccessMonitor instruction. | |
78 * | |
79 * @param object the instruction producing the object | |
80 * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack | |
81 * @param stateBefore the state before executing the monitor operation | |
82 * @param lockNumber the number of the lock being acquired | |
83 * @param inputCount | |
84 * @param successorCount | |
85 * @param graph | |
86 */ | |
87 public AccessMonitor(Value object, Value lockAddress, int lockNumber, int inputCount, int successorCount, Graph graph) { | |
88 super(CiKind.Illegal, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); | |
89 this.lockNumber = lockNumber; | |
90 setObject(object); | |
91 setLockAddress(lockAddress); | |
92 } | |
93 } |