comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDebugInfo.java @ 4199:aaac4894175c

Renamed cri packages from sun to oracle.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 03 Jan 2012 16:29:28 +0100
parents graal/com.oracle.max.cri/src/com/sun/cri/ci/CiDebugInfo.java@bc8527f3071c
children 12c63380e7ff
comparison
equal deleted inserted replaced
4198:8c9c0e1eaab1 4199:aaac4894175c
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.oracle.max.cri.ci;
24
25 import java.io.*;
26
27 /**
28 * Represents the debugging information for a particular place in the code,
29 * which includes the code position, a reference map, and deoptimization information.
30 */
31 public class CiDebugInfo implements Serializable {
32
33 /**
34 *
35 */
36 private static final long serialVersionUID = -6047206624915812516L;
37
38 /**
39 * The code position (including all inlined methods) of this debug info.
40 * If this is a {@link CiFrame} instance, then it is also the deoptimization information for each inlined frame.
41 */
42 public final CiCodePos codePos;
43
44 /**
45 * The reference map for the registers at this point. The reference map is <i>packed</i> in that
46 * for bit {@code k} in byte {@code n}, it refers to the register whose
47 * {@linkplain CiRegister#number number} is {@code (k + n * 8)}.
48 */
49 public final CiBitMap registerRefMap;
50
51 /**
52 * The reference map for the stack frame at this point. A set bit at {@code k} in the map
53 * represents stack slot number {@code k}.
54 */
55 public final CiBitMap frameRefMap;
56
57 /**
58 * Creates a new {@code CiDebugInfo} from the given values.
59 *
60 * @param codePos the {@linkplain CiCodePos code position} or {@linkplain CiFrame frame} info
61 * @param registerRefMap the register map
62 * @param frameRefMap the reference map for {@code frame}, which may be {@code null}
63 */
64 public CiDebugInfo(CiCodePos codePos, CiBitMap registerRefMap, CiBitMap frameRefMap) {
65 this.codePos = codePos;
66 this.registerRefMap = registerRefMap;
67 this.frameRefMap = frameRefMap;
68 }
69
70 /**
71 * @return {@code true} if this debug information has a frame
72 */
73 public boolean hasFrame() {
74 return codePos instanceof CiFrame;
75 }
76
77 /**
78 * @return {@code true} if this debug info has a reference map for the registers
79 */
80 public boolean hasRegisterRefMap() {
81 return registerRefMap != null && registerRefMap.size() > 0;
82 }
83
84 /**
85 * @return {@code true} if this debug info has a reference map for the stack
86 */
87 public boolean hasStackRefMap() {
88 return frameRefMap != null && frameRefMap.size() > 0;
89 }
90
91
92 /**
93 * Gets the deoptimization information for each inlined frame (if available).
94 *
95 * @return {@code null} if no frame de-opt info is {@linkplain #hasDebugFrame available}
96 */
97 public CiFrame frame() {
98 if (hasFrame()) {
99 return (CiFrame) codePos;
100 }
101 return null;
102 }
103
104 @Override
105 public String toString() {
106 return CiUtil.append(new StringBuilder(100), this, null).toString();
107 }
108 }