Mercurial > hg > truffle
comparison graal/com.oracle.max.graal.compiler/src/com/sun/c1x/lir/LIRDebugInfo.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/lir/LIRDebugInfo.java@1cd59ca9ac86 |
children |
comparison
equal
deleted
inserted
replaced
2871:d704eb526603 | 2872:0341b6424579 |
---|---|
1 /* | |
2 * Copyright (c) 2009, 2010, 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.lir; | |
24 | |
25 import com.sun.c1x.*; | |
26 import com.sun.c1x.ir.*; | |
27 import com.sun.c1x.value.*; | |
28 import com.sun.cri.ci.*; | |
29 | |
30 /** | |
31 * This class represents debugging and deoptimization information attached to a LIR instruction. | |
32 */ | |
33 public class LIRDebugInfo { | |
34 | |
35 public abstract static class ValueLocator { | |
36 public abstract CiValue getLocation(Value value); | |
37 } | |
38 | |
39 public final FrameState state; | |
40 private LIRBlock exceptionEdge; | |
41 public CiDebugInfo debugInfo; | |
42 | |
43 public LIRDebugInfo(FrameState state) { | |
44 assert state != null; | |
45 this.state = state; | |
46 } | |
47 | |
48 public LIRBlock exceptionEdge() { | |
49 return exceptionEdge; | |
50 } | |
51 | |
52 public void setExceptionEdge(LIRBlock exceptionEdge) { | |
53 this.exceptionEdge = exceptionEdge; | |
54 } | |
55 | |
56 private LIRDebugInfo(LIRDebugInfo info) { | |
57 this.state = info.state; | |
58 this.exceptionEdge = info.exceptionEdge; | |
59 } | |
60 | |
61 public LIRDebugInfo copy() { | |
62 return new LIRDebugInfo(this); | |
63 } | |
64 | |
65 public void setOop(CiValue location, C1XCompilation compilation, CiBitMap frameRefMap, CiBitMap regRefMap) { | |
66 CiTarget target = compilation.target; | |
67 if (location.isAddress()) { | |
68 CiAddress stackLocation = (CiAddress) location; | |
69 assert stackLocation.index.isIllegal(); | |
70 if (stackLocation.base == CiRegister.Frame.asValue()) { | |
71 int offset = stackLocation.displacement; | |
72 assert offset % target.wordSize == 0 : "must be aligned"; | |
73 int stackMapIndex = offset / target.wordSize; | |
74 setBit(frameRefMap, stackMapIndex); | |
75 } | |
76 } else if (location.isStackSlot()) { | |
77 CiStackSlot stackSlot = (CiStackSlot) location; | |
78 assert !stackSlot.inCallerFrame(); | |
79 assert target.spillSlotSize == target.wordSize; | |
80 setBit(frameRefMap, stackSlot.index()); | |
81 } else { | |
82 assert location.isRegister() : "objects can only be in a register"; | |
83 CiRegisterValue registerLocation = (CiRegisterValue) location; | |
84 int reg = registerLocation.reg.number; | |
85 assert reg >= 0 : "object cannot be in non-object register " + registerLocation.reg; | |
86 assert reg < target.arch.registerReferenceMapBitCount; | |
87 setBit(regRefMap, reg); | |
88 } | |
89 } | |
90 | |
91 public CiDebugInfo debugInfo() { | |
92 assert debugInfo != null : "debug info not allocated yet"; | |
93 return debugInfo; | |
94 } | |
95 | |
96 public boolean hasDebugInfo() { | |
97 return debugInfo != null; | |
98 } | |
99 | |
100 public static void setBit(CiBitMap refMap, int bit) { | |
101 assert !refMap.get(bit) : "Ref map entry " + bit + " is already set."; | |
102 refMap.set(bit); | |
103 } | |
104 | |
105 @Override | |
106 public String toString() { | |
107 return state.toString(); | |
108 } | |
109 } |