23 package jdk.vm.ci.code;
24
25 import java.util.Objects;
26
27 /**
28 * Represents the debugging information for a particular point of execution. This information
29 * includes:
30 * <ul>
31 * <li>a {@linkplain #getBytecodePosition() bytecode position}</li>
32 * <li>a reference map for registers and stack slots in the current frame</li>
33 * <li>a map from bytecode locals and operand stack slots to their values or locations from which
34 * their values can be read</li>
35 * <li>a map from the registers (in the caller's frame) to the slots where they are saved in the
36 * current frame</li>
37 * </ul>
38 */
39 public final class DebugInfo {
40
41 private final BytecodePosition bytecodePosition;
42 private ReferenceMap referenceMap;
43 @SuppressWarnings("unused") private final VirtualObject[] virtualObjectMapping;
44 private RegisterSaveLayout calleeSaveInfo;
45
46 /**
47 * Creates a new {@link DebugInfo} from the given values.
48 *
49 * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame
50 * frame} info
51 * @param virtualObjectMapping the mapping of {@link VirtualObject}s to their real values. This
52 * array is now owned by this object and must not be mutated by the caller.
53 */
54 @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `virtualObjectMapping`")
55 public DebugInfo(BytecodePosition codePos, VirtualObject[] virtualObjectMapping) {
56 this.bytecodePosition = codePos;
57 this.virtualObjectMapping = virtualObjectMapping;
58 }
59
60 public DebugInfo(BytecodePosition codePos) {
61 this(codePos, null);
62 }
63
85 }
86
87 @Override
88 public String toString() {
89 return CodeUtil.append(new StringBuilder(100), this, null).toString();
90 }
91
92 /**
93 * @return The code position (including all inlined methods) of this debug info. If this is a
94 * {@link BytecodeFrame} instance, then it is also the deoptimization information for
95 * each inlined frame.
96 */
97 public BytecodePosition getBytecodePosition() {
98 return bytecodePosition;
99 }
100
101 public ReferenceMap getReferenceMap() {
102 return referenceMap;
103 }
104
105 /**
106 * Sets the map from the registers (in the caller's frame) to the slots where they are saved in
107 * the current frame.
108 */
109 public void setCalleeSaveInfo(RegisterSaveLayout calleeSaveInfo) {
110 this.calleeSaveInfo = calleeSaveInfo;
111 }
112
113 /**
114 * Gets the map from the registers (in the caller's frame) to the slots where they are saved in
115 * the current frame. If no such information is available, {@code null} is returned.
116 */
117 public RegisterSaveLayout getCalleeSaveInfo() {
118 return calleeSaveInfo;
119 }
120
121 @Override
122 public int hashCode() {
123 throw new UnsupportedOperationException("hashCode");
124 }
|
23 package jdk.vm.ci.code;
24
25 import java.util.Objects;
26
27 /**
28 * Represents the debugging information for a particular point of execution. This information
29 * includes:
30 * <ul>
31 * <li>a {@linkplain #getBytecodePosition() bytecode position}</li>
32 * <li>a reference map for registers and stack slots in the current frame</li>
33 * <li>a map from bytecode locals and operand stack slots to their values or locations from which
34 * their values can be read</li>
35 * <li>a map from the registers (in the caller's frame) to the slots where they are saved in the
36 * current frame</li>
37 * </ul>
38 */
39 public final class DebugInfo {
40
41 private final BytecodePosition bytecodePosition;
42 private ReferenceMap referenceMap;
43 private final VirtualObject[] virtualObjectMapping;
44 private RegisterSaveLayout calleeSaveInfo;
45
46 /**
47 * Creates a new {@link DebugInfo} from the given values.
48 *
49 * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame
50 * frame} info
51 * @param virtualObjectMapping the mapping of {@link VirtualObject}s to their real values. This
52 * array is now owned by this object and must not be mutated by the caller.
53 */
54 @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `virtualObjectMapping`")
55 public DebugInfo(BytecodePosition codePos, VirtualObject[] virtualObjectMapping) {
56 this.bytecodePosition = codePos;
57 this.virtualObjectMapping = virtualObjectMapping;
58 }
59
60 public DebugInfo(BytecodePosition codePos) {
61 this(codePos, null);
62 }
63
85 }
86
87 @Override
88 public String toString() {
89 return CodeUtil.append(new StringBuilder(100), this, null).toString();
90 }
91
92 /**
93 * @return The code position (including all inlined methods) of this debug info. If this is a
94 * {@link BytecodeFrame} instance, then it is also the deoptimization information for
95 * each inlined frame.
96 */
97 public BytecodePosition getBytecodePosition() {
98 return bytecodePosition;
99 }
100
101 public ReferenceMap getReferenceMap() {
102 return referenceMap;
103 }
104
105 public VirtualObject[] getVirtualObjectMapping() {
106 return virtualObjectMapping;
107 }
108
109 /**
110 * Sets the map from the registers (in the caller's frame) to the slots where they are saved in
111 * the current frame.
112 */
113 public void setCalleeSaveInfo(RegisterSaveLayout calleeSaveInfo) {
114 this.calleeSaveInfo = calleeSaveInfo;
115 }
116
117 /**
118 * Gets the map from the registers (in the caller's frame) to the slots where they are saved in
119 * the current frame. If no such information is available, {@code null} is returned.
120 */
121 public RegisterSaveLayout getCalleeSaveInfo() {
122 return calleeSaveInfo;
123 }
124
125 @Override
126 public int hashCode() {
127 throw new UnsupportedOperationException("hashCode");
128 }
|