Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiDebugInfo.java @ 3733:e233f5660da4
Added Java files from Maxine project.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 17 Dec 2011 19:59:18 +0100 |
parents | |
children | bc8527f3071c |
comparison
equal
deleted
inserted
replaced
3732:3e2e8b8abdaf | 3733:e233f5660da4 |
---|---|
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.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 * The code position (including all inlined methods) of this debug info. | |
35 * If this is a {@link CiFrame} instance, then it is also the deoptimization information for each inlined frame. | |
36 */ | |
37 public final CiCodePos codePos; | |
38 | |
39 /** | |
40 * The reference map for the registers at this point. The reference map is <i>packed</i> in that | |
41 * for bit {@code k} in byte {@code n}, it refers to the register whose | |
42 * {@linkplain CiRegister#number number} is {@code (k + n * 8)}. | |
43 */ | |
44 public final CiBitMap registerRefMap; | |
45 | |
46 /** | |
47 * The reference map for the stack frame at this point. A set bit at {@code k} in the map | |
48 * represents stack slot number {@code k}. | |
49 */ | |
50 public final CiBitMap frameRefMap; | |
51 | |
52 /** | |
53 * Creates a new {@code CiDebugInfo} from the given values. | |
54 * | |
55 * @param codePos the {@linkplain CiCodePos code position} or {@linkplain CiFrame frame} info | |
56 * @param registerRefMap the register map | |
57 * @param frameRefMap the reference map for {@code frame}, which may be {@code null} | |
58 */ | |
59 public CiDebugInfo(CiCodePos codePos, CiBitMap registerRefMap, CiBitMap frameRefMap) { | |
60 this.codePos = codePos; | |
61 this.registerRefMap = registerRefMap; | |
62 this.frameRefMap = frameRefMap; | |
63 } | |
64 | |
65 /** | |
66 * @return {@code true} if this debug information has a frame | |
67 */ | |
68 public boolean hasFrame() { | |
69 return codePos instanceof CiFrame; | |
70 } | |
71 | |
72 /** | |
73 * @return {@code true} if this debug info has a reference map for the registers | |
74 */ | |
75 public boolean hasRegisterRefMap() { | |
76 return registerRefMap != null && registerRefMap.size() > 0; | |
77 } | |
78 | |
79 /** | |
80 * @return {@code true} if this debug info has a reference map for the stack | |
81 */ | |
82 public boolean hasStackRefMap() { | |
83 return frameRefMap != null && frameRefMap.size() > 0; | |
84 } | |
85 | |
86 | |
87 /** | |
88 * Gets the deoptimization information for each inlined frame (if available). | |
89 * | |
90 * @return {@code null} if no frame de-opt info is {@linkplain #hasDebugFrame available} | |
91 */ | |
92 public CiFrame frame() { | |
93 if (hasFrame()) { | |
94 return (CiFrame) codePos; | |
95 } | |
96 return null; | |
97 } | |
98 | |
99 @Override | |
100 public String toString() { | |
101 return CiUtil.append(new StringBuilder(100), this, null).toString(); | |
102 } | |
103 } |