annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java @ 19251:063e8873bd14

changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
author Doug Simon <doug.simon@oracle.com>
date Wed, 11 Feb 2015 11:38:22 +0100
parents 7ebed83df427
children 131fb3dd493b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
23 package com.oracle.graal.api.code;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
18499
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
25 import static com.oracle.graal.api.meta.MetaUtil.*;
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
26 import static java.util.Collections.*;
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
27
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28 import java.io.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
19251
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
31 import com.oracle.graal.api.code.Assumptions.Assumption;
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14758
diff changeset
32 import com.oracle.graal.api.code.CodeUtil.RefMapFormatter;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5501
diff changeset
33 import com.oracle.graal.api.meta.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
36 * Represents the output from compiling a method, including the compiled machine code, associated
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
37 * data and references, relocation information, deoptimization information, etc.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 */
5546
e42c0df7212a Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5542
diff changeset
39 public class CompilationResult implements Serializable {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
41 private static final long serialVersionUID = -1319947729753702434L;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
42
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
43 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 * Represents a code position with associated additional information.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 public abstract static class Site implements Serializable {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
47
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
48 private static final long serialVersionUID = -8214214947651979102L;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
49 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 * The position (or offset) of this site with respect to the start of the target method.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 public final int pcOffset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 public Site(int pos) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 this.pcOffset = pos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
57
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
58 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
59 public final int hashCode() {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
60 throw new UnsupportedOperationException("hashCode");
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
61 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
62
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
63 @Override
18499
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
64 public String toString() {
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
65 return identityHashCodeString(this);
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
66 }
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
67
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
68 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
69 public abstract boolean equals(Object obj);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
70 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 /**
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
73 * Represents an infopoint with associated debug info. Note that safepoints are also infopoints.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
75 public static class Infopoint extends Site implements Comparable<Infopoint> {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
76
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
77 private static final long serialVersionUID = 2479806696381720162L;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
78 public final DebugInfo debugInfo;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
80 public final InfopointReason reason;
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
81
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
82 public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 super(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 this.debugInfo = debugInfo;
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
85 this.reason = reason;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 StringBuilder sb = new StringBuilder();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 sb.append(pcOffset);
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
92 sb.append("[<infopoint>]");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 appendDebugInfo(sb, debugInfo);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 return sb.toString();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 @Override
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
98 public int compareTo(Infopoint o) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 if (pcOffset < o.pcOffset) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 return -1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 } else if (pcOffset > o.pcOffset) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 return 1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 }
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
104 return this.reason.compareTo(o.reason);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
106
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
107 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
108 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
109 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
110 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
111 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
112 if (obj != null && obj.getClass() == getClass()) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
113 Infopoint that = (Infopoint) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
114 if (this.pcOffset == that.pcOffset && Objects.equals(this.debugInfo, that.debugInfo) && Objects.equals(this.reason, that.reason)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
115 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
116 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
117 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
118 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
119 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 * Represents a call in the code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
125 public static final class Call extends Infopoint {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
126
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
127 private static final long serialVersionUID = 1440741241631046954L;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
128
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
129 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 * The target of the call.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 */
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
132 public final InvokeTarget target;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 * The size of the call instruction.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 public final int size;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
140 * Specifies if this call is direct or indirect. A direct call has an immediate operand
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
141 * encoding the absolute or relative (to the call itself) address of the target. An indirect
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
142 * call has a register or memory operand specifying the target address of the call.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 public final boolean direct;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
146 public Call(InvokeTarget target, int pcOffset, int size, boolean direct, DebugInfo debugInfo) {
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
147 super(pcOffset, debugInfo, InfopointReason.CALL);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
148 this.size = size;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149 this.target = target;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150 this.direct = direct;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
151 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
154 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
155 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
156 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
157 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
158 if (obj instanceof Call && super.equals(obj)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
159 Call that = (Call) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
160 if (this.size == that.size && this.direct == that.direct && Objects.equals(this.target, that.target)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
161 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
162 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
163 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
164 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
165 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
166
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
167 @Override
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
168 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
169 StringBuilder sb = new StringBuilder();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
170 sb.append(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
171 sb.append('[');
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 sb.append(target);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 sb.append(']');
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
174
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
175 if (debugInfo != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 appendDebugInfo(sb, debugInfo);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 return sb.toString();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
182
13588
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
183 /**
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
184 * Represents some external data that is referenced by the code.
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
185 */
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
186 public abstract static class Reference implements Serializable {
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
187
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
188 private static final long serialVersionUID = 4841246083028477946L;
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
189
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
190 @Override
18352
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
191 public abstract int hashCode();
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
192
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
193 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
194 public abstract boolean equals(Object obj);
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
195 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
196
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
197 public static final class ConstantReference extends Reference {
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
198
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
199 private static final long serialVersionUID = 5841121930949053612L;
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
200
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
201 private final VMConstant constant;
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
202
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
203 public ConstantReference(VMConstant constant) {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
204 this.constant = constant;
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
205 }
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
206
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
207 public VMConstant getConstant() {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
208 return constant;
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
209 }
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
210
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
211 @Override
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
212 public String toString() {
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
213 return constant.toString();
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
214 }
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
215
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
216 @Override
18352
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
217 public int hashCode() {
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
218 return constant.hashCode();
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
219 }
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
220
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
221 @Override
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
222 public boolean equals(Object obj) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
223 if (this == obj) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
224 return true;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
225 }
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
226 if (obj instanceof ConstantReference) {
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
227 ConstantReference that = (ConstantReference) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
228 return Objects.equals(this.constant, that.constant);
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
229 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
230 return false;
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
231 }
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
232 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
233
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
234 public static final class DataSectionReference extends Reference {
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
235
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
236 private static final long serialVersionUID = 9011681879878139182L;
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
237
18935
07f2a49f0bfb Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents: 18499
diff changeset
238 private boolean initialized;
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
239 private int offset;
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
240
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
241 public DataSectionReference() {
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
242 // will be set after the data section layout is fixed
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
243 offset = 0xDEADDEAD;
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
244 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
245
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
246 public int getOffset() {
18935
07f2a49f0bfb Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents: 18499
diff changeset
247 assert initialized;
07f2a49f0bfb Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents: 18499
diff changeset
248
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
249 return offset;
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
250 }
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
251
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
252 public void setOffset(int offset) {
18935
07f2a49f0bfb Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents: 18499
diff changeset
253 assert !initialized;
07f2a49f0bfb Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents: 18499
diff changeset
254 initialized = true;
07f2a49f0bfb Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents: 18499
diff changeset
255
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
256 this.offset = offset;
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
257 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
258
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
259 @Override
18352
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
260 public int hashCode() {
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
261 return offset;
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
262 }
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
263
8904705ea4a8 implemented hashCode() for CompilationResult.Reference subclasses
Doug Simon <doug.simon@oracle.com>
parents: 18342
diff changeset
264 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
265 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
266 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
267 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
268 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
269 if (obj instanceof DataSectionReference) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
270 DataSectionReference that = (DataSectionReference) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
271 return this.offset == that.offset;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
272 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
273 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
274 }
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
275 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
276
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
277 /**
13588
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
278 * Represents a code site that references some data. The associated data can be either a
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
279 * {@link DataSectionReference reference} to the data section, or it may be an inlined
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
280 * {@link JavaConstant} that needs to be patched.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
281 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
282 public static final class DataPatch extends Site {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
283
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
284 private static final long serialVersionUID = 5771730331604867476L;
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
285 public Reference reference;
10810
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
286
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
287 public DataPatch(int pcOffset, Reference reference) {
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
288 super(pcOffset);
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
289 this.reference = reference;
10861
6872c61c1d3e Fix null reference access when dumping raw data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 10834
diff changeset
290 }
6872c61c1d3e Fix null reference access when dumping raw data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 10834
diff changeset
291
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
292 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
293 public String toString() {
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
294 return String.format("%d[<data patch referring to %s>]", pcOffset, reference.toString());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
295 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
296
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
297 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
298 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
299 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
300 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
301 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
302 if (obj instanceof DataPatch) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
303 DataPatch that = (DataPatch) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
304 if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
305 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
306 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
307 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
308 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
309 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
310 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
311
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
312 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
313 * Provides extra information about instructions or data at specific positions in
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
314 * {@link CompilationResult#getTargetCode()}. This is optional information that can be used to
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
315 * enhance a disassembly of the code.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
316 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
317 public abstract static class CodeAnnotation implements Serializable {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
318
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
319 private static final long serialVersionUID = -7903959680749520748L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
320 public final int position;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
321
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
322 public CodeAnnotation(int position) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
323 this.position = position;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
324 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
325
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
326 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
327 public final int hashCode() {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
328 throw new UnsupportedOperationException("hashCode");
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
329 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
330
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
331 @Override
18499
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
332 public String toString() {
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
333 return identityHashCodeString(this);
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
334 }
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
335
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
336 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
337 public abstract boolean equals(Object obj);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
338 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 * A string comment about one or more instructions at a specific position in the code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
342 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
343 public static final class CodeComment extends CodeAnnotation {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
344
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
345 /**
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
346 *
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
347 */
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
348 private static final long serialVersionUID = 6802287188701961401L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
349 public final String value;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
350
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
351 public CodeComment(int position, String comment) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
352 super(position);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
353 this.value = comment;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
354 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
355
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
356 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
357 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
358 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
359 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
360 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
361 if (obj instanceof CodeComment) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
362 CodeComment that = (CodeComment) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
363 if (this.position == that.position && this.value.equals(that.value)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
364 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
365 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
366 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
367 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
368 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
369
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
370 @Override
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
371 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
372 return getClass().getSimpleName() + "@" + position + ": " + value;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
373 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
374 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
375
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
376 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
377 * Describes a table of signed offsets embedded in the code. The offsets are relative to the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
378 * starting address of the table. This type of table maybe generated when translating a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
379 * multi-way branch based on a key value from a dense value set (e.g. the {@code tableswitch}
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
380 * JVM instruction).
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
381 *
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
382 * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high}
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
383 * inclusive.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
384 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
385 public static final class JumpTable extends CodeAnnotation {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
386
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
387 private static final long serialVersionUID = 2222194398353801831L;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
388
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
389 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
390 * The low value in the key range (inclusive).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
391 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
392 public final int low;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
393
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
394 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
395 * The high value in the key range (inclusive).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
396 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
397 public final int high;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
398
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
399 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
400 * The size (in bytes) of each table entry.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
401 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
402 public final int entrySize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
403
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
404 public JumpTable(int position, int low, int high, int entrySize) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
405 super(position);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
406 this.low = low;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
407 this.high = high;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
408 this.entrySize = entrySize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
409 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
410
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
411 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
412 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
413 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
414 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
415 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
416 if (obj instanceof JumpTable) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
417 JumpTable that = (JumpTable) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
418 if (this.position == that.position && this.entrySize == that.entrySize && this.low == that.low && this.high == that.high) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
419 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
420 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
421 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
422 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
423 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
424
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
425 @Override
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
426 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
427 return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
428 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
429 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
430
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
431 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
432 * Represents exception handler information for a specific code position. It includes the catch
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
433 * code position as well as the caught exception type.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
434 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
435 public static final class ExceptionHandler extends Site {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
436
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
437 private static final long serialVersionUID = 4897339464722665281L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
438 public final int handlerPos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
439
4693
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
440 ExceptionHandler(int pcOffset, int handlerPos) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
441 super(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
442 this.handlerPos = handlerPos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
443 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
444
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
445 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
446 public String toString() {
4693
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
447 return String.format("%d[<exception edge to %d>]", pcOffset, handlerPos);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
448 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
449
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
450 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
451 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
452 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
453 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
454 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
455 if (obj instanceof ExceptionHandler) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
456 ExceptionHandler that = (ExceptionHandler) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
457 if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
458 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
459 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
460 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
461 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
462 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
463 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
464
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5719
diff changeset
465 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
466 * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
467 * mark can reference other marks.
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5719
diff changeset
468 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
469 public static final class Mark extends Site {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
470
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
471 private static final long serialVersionUID = 3612943150662354844L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
472 public final Object id;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
473
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
474 public Mark(int pcOffset, Object id) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
475 super(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
476 this.id = id;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
477 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
478
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
479 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
480 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
481 if (id == null) {
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
482 return String.format("%d[<mar>]", pcOffset);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
483 } else if (id instanceof Integer) {
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
484 return String.format("%d[<mark with id %s>]", pcOffset, Integer.toHexString((Integer) id));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
485 } else {
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
486 return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
487 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
488 }
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
489
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
490 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
491 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
492 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
493 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
494 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
495 if (obj instanceof Mark) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
496 Mark that = (Mark) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
497 if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
498 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
499 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
500 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
501 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
502 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
503 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
504
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
505 private int id = -1;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
506 private int entryBCI = -1;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
507
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
508 private final DataSection dataSection = new DataSection();
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
509
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
510 private final List<Infopoint> infopoints = new ArrayList<>();
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
511 private final List<DataPatch> dataPatches = new ArrayList<>();
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
512 private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
513 private final List<Mark> marks = new ArrayList<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
514
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
515 private int totalFrameSize = -1;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
516 private int customStackAreaOffset = -1;
6698
f5715c5a106a Make CalleeSaveLayout available in CompilationResult
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6658
diff changeset
517
12517
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
518 private final String name;
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
519
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
520 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
521 * The buffer containing the emitted machine code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
522 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
523 private byte[] targetCode;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
524
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
525 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
526 * The leading number of bytes in {@link #targetCode} containing the emitted machine code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
527 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
528 private int targetCodeSize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
529
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
530 private ArrayList<CodeAnnotation> annotations;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
531
19251
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
532 private Assumption[] assumptions;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
533
12517
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
534 public CompilationResult() {
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
535 this(null);
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
536 }
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
537
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
538 public CompilationResult(String name) {
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
539 this.name = name;
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
540 }
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
541
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
542 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
543 public int hashCode() {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
544 // CompilationResult instances should not be used as hash map keys
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
545 throw new UnsupportedOperationException("hashCode");
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
546 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
547
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
548 @Override
18499
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
549 public String toString() {
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
550 return identityHashCodeString(this);
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
551 }
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
552
bd74da0a76f3 implemented toString() for classes that throw UnsupportedError for hashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18352
diff changeset
553 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
554 public boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
555 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
556 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
557 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
558 if (obj != null && obj.getClass() == getClass()) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
559 CompilationResult that = (CompilationResult) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
560 // @formatter:off
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
561 if (this.entryBCI == that.entryBCI &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
562 this.id == that.id &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
563 this.customStackAreaOffset == that.customStackAreaOffset &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
564 this.totalFrameSize == that.totalFrameSize &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
565 this.targetCodeSize == that.targetCodeSize &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
566 Objects.equals(this.name, that.name) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
567 Objects.equals(this.annotations, that.annotations) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
568 Objects.equals(this.assumptions, that.assumptions) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
569 Objects.equals(this.dataSection, that.dataSection) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
570 Objects.equals(this.exceptionHandlers, that.exceptionHandlers) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
571 Objects.equals(this.dataPatches, that.dataPatches) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
572 Objects.equals(this.infopoints, that.infopoints) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
573 Objects.equals(this.marks, that.marks) &&
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
574 Arrays.equals(targetCode, that.targetCode)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
575 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
576 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
577 // @formatter:on
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
578 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
579 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
580 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 18252
diff changeset
581
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
582 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
583 * @return the compile id
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
584 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
585 public int getId() {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
586 return id;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
587 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
588
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
589 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
590 * @param id the compile id to set
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
591 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
592 public void setId(int id) {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
593 this.id = id;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
594 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
595
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
596 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
597 * @return the entryBCI
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
598 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
599 public int getEntryBCI() {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
600 return entryBCI;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
601 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
602
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
603 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
604 * @param entryBCI the entryBCI to set
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
605 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
606 public void setEntryBCI(int entryBCI) {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
607 this.entryBCI = entryBCI;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
608 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
609
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
610 public void setAssumptions(Assumptions assumptions) {
19251
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
611 this.assumptions = assumptions.getAssumptionsCopy();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
612 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
613
19251
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
614 /**
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
615 * Gets a fixed-size {@linkplain Arrays#asList(Object...) view} of the assumptions recorded in
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
616 * this object.
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
617 */
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
618 public Collection<Assumption> getAssumptions() {
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19189
diff changeset
619 return assumptions == null ? Collections.emptyList() : Arrays.asList(assumptions);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
620 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
621
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
622 public DataSection getDataSection() {
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
623 return dataSection;
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
624 }
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
625
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
626 /**
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
627 * The total frame size of the method in bytes. This includes the return address pushed onto the
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
628 * stack, if any.
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
629 *
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
630 * @return the frame size
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
631 */
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
632 public int getTotalFrameSize() {
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
633 assert totalFrameSize != -1 : "frame size not yet initialized!";
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
634 return totalFrameSize;
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
635 }
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
636
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
637 /**
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
638 * Sets the total frame size in bytes. This includes the return address pushed onto the stack,
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
639 * if any.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
640 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
641 * @param size the size of the frame in bytes
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
642 */
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
643 public void setTotalFrameSize(int size) {
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
644 totalFrameSize = size;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
645 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
646
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
647 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
648 * Sets the machine that has been generated by the compiler.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
649 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
650 * @param code the machine code generated
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
651 * @param size the size of the machine code
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
652 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
653 public void setTargetCode(byte[] code, int size) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
654 targetCode = code;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
655 targetCodeSize = size;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
656 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
657
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
658 /**
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
659 * Records a data patch in the code section. The data patch can refer to something in the
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
660 * {@link DataSectionReference data section} or directly to an {@link ConstantReference inlined
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
661 * constant}.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
662 *
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
663 * @param codePos The position in the code that needs to be patched.
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
664 * @param ref The reference that should be inserted in the code.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
665 */
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
666 public void recordDataPatch(int codePos, Reference ref) {
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
667 assert codePos >= 0 && ref != null;
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
668 dataPatches.add(new DataPatch(codePos, ref));
10810
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
669 }
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
670
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
671 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
672 * Records a call in the code array.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
673 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
674 * @param codePos the position of the call in the code array
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
675 * @param size the size of the call instruction
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
676 * @param target the being called
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
677 * @param debugInfo the debug info for the call
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
678 * @param direct specifies if this is a {@linkplain Call#direct direct} call
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
679 */
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
680 public void recordCall(int codePos, int size, InvokeTarget target, DebugInfo debugInfo, boolean direct) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
681 final Call call = new Call(target, codePos, size, direct, debugInfo);
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
682 addInfopoint(call);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
683 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
684
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
685 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
686 * Records an exception handler for this method.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
687 *
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
688 * @param codePos the position in the code that is covered by the handler
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
689 * @param handlerPos the position of the handler
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
690 */
4693
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
691 public void recordExceptionHandler(int codePos, int handlerPos) {
19189
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
692 assert validateExceptionHandlerAdd(codePos, handlerPos) : String.format("Duplicate exception handler for pc 0x%x handlerPos 0x%x", codePos, handlerPos);
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
693 exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
694 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
695
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
696 /**
19189
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
697 * Validate if the exception handler for codePos already exists and handlerPos is different.
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
698 *
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
699 * @param codePos
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
700 * @param handlerPos
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
701 * @return true if the validation is successful
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
702 */
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
703 private boolean validateExceptionHandlerAdd(int codePos, int handlerPos) {
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
704 ExceptionHandler exHandler = getExceptionHandlerForCodePos(codePos);
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
705 return exHandler == null || exHandler.handlerPos == handlerPos;
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
706 }
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
707
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
708 /**
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
709 * Returns the first ExceptionHandler which matches codePos.
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
710 *
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
711 * @param codePos position to search for
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
712 * @return first matching ExceptionHandler
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
713 */
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
714 private ExceptionHandler getExceptionHandlerForCodePos(int codePos) {
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
715 for (ExceptionHandler h : exceptionHandlers) {
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
716 if (h.pcOffset == codePos) {
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
717 return h;
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
718 }
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
719 }
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
720 return null;
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
721 }
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
722
7ebed83df427 [SPARC] fixing (wrong) duplicate exception handler for a particular PC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18935
diff changeset
723 /**
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
724 * Records an infopoint in the code array.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
725 *
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
726 * @param codePos the position of the infopoint in the code array
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
727 * @param debugInfo the debug info for the infopoint
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
728 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
729 public void recordInfopoint(int codePos, DebugInfo debugInfo, InfopointReason reason) {
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
730 addInfopoint(new Infopoint(codePos, debugInfo, reason));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
731 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
732
14758
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
733 /**
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
734 * Records a custom infopoint in the code section.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
735 *
14758
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
736 * Compiler implementations can use this method to record non-standard infopoints, which are not
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
737 * handled by the dedicated methods like {@link #recordCall}.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
738 *
14758
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
739 * @param infopoint the infopoint to record, usually a derived class from {@link Infopoint}
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
740 */
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
741 public void addInfopoint(Infopoint infopoint) {
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
742 // The infopoints list must always be sorted
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
743 if (!infopoints.isEmpty()) {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
744 Infopoint previousInfopoint = infopoints.get(infopoints.size() - 1);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
745 if (previousInfopoint.pcOffset > infopoint.pcOffset) {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
746 // This re-sorting should be very rare
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
747 Collections.sort(infopoints);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
748 previousInfopoint = infopoints.get(infopoints.size() - 1);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
749 }
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
750 if (previousInfopoint.pcOffset == infopoint.pcOffset) {
18252
ae8e86212c77 spelling fix: omited -> omitted
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
751 if (infopoint.reason.canBeOmitted()) {
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
752 return;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
753 }
18252
ae8e86212c77 spelling fix: omited -> omitted
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
754 if (previousInfopoint.reason.canBeOmitted()) {
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
755 Infopoint removed = infopoints.remove(infopoints.size() - 1);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
756 assert removed == previousInfopoint;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
757 } else {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
758 throw new RuntimeException("Infopoints that can not be omited should have distinct PCs");
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
759 }
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15838
diff changeset
760 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
761 }
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
762 infopoints.add(infopoint);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
763 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
764
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
765 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
766 * Records an instruction mark within this method.
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
767 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
768 * @param codePos the position in the code that is covered by the handler
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
769 * @param markId the identifier for this mark
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
770 */
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
771 public Mark recordMark(int codePos, Object markId) {
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
772 Mark mark = new Mark(codePos, markId);
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
773 marks.add(mark);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
774 return mark;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
775 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
776
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
777 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
778 * Offset in bytes for the custom stack area (relative to sp).
15176
f24d578e63a9 changed com.oracle.graal.api.code.CompilationResult.getFrameSize() to include the return address size if return address is puhsed onto the stack
twisti
parents: 14991
diff changeset
779 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
780 * @return the offset in bytes
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
781 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
782 public int getCustomStackAreaOffset() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
783 return customStackAreaOffset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
784 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
785
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
786 /**
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
787 * @see #getCustomStackAreaOffset()
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
788 * @param offset
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
789 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
790 public void setCustomStackAreaOffset(int offset) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
791 customStackAreaOffset = offset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
792 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
793
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
794 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
795 * @return the machine code generated for this method
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
796 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
797 public byte[] getTargetCode() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
798 return targetCode;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
799 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
800
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
801 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
802 * @return the size of the machine code generated for this method
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
803 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
804 public int getTargetCodeSize() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
805 return targetCodeSize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
806 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
807
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
808 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
809 * @return the code annotations or {@code null} if there are none
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
810 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
811 public List<CodeAnnotation> getAnnotations() {
9807
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9336
diff changeset
812 if (annotations == null) {
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9336
diff changeset
813 return Collections.emptyList();
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9336
diff changeset
814 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
815 return annotations;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
816 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
817
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
818 public void addAnnotation(CodeAnnotation annotation) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
819 assert annotation != null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
820 if (annotations == null) {
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
821 annotations = new ArrayList<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
822 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
823 annotations.add(annotation);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
824 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
825
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
826 private static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
827 if (info != null) {
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
828 ReferenceMap refMap = info.getReferenceMap();
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
829 if (refMap != null) {
14562
45812e05cdb3 Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14561
diff changeset
830 RefMapFormatter formatter = new CodeUtil.NumberedRefMapFormatter();
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
831 if (refMap.hasFrameRefMap()) {
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
832 sb.append(" stackMap[");
14562
45812e05cdb3 Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14561
diff changeset
833 refMap.appendFrameMap(sb, formatter);
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
834 sb.append(']');
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
835 }
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
836 if (refMap.hasRegisterRefMap()) {
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
837 sb.append(" registerMap[");
14562
45812e05cdb3 Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14561
diff changeset
838 refMap.appendRegisterMap(sb, formatter);
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
839 sb.append(']');
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
840 }
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
841 }
9336
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
842 RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
843 if (calleeSaveInfo != null) {
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
844 sb.append(" callee-save-info[");
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
845 String sep = "";
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
846 for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
847 sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
848 sep = ", ";
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
849 }
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
850 sb.append(']');
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
851 }
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
852 BytecodePosition codePos = info.getBytecodePosition();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
853 if (codePos != null) {
5719
429accae15aa moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents: 5711
diff changeset
854 MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
855 if (info.hasFrame()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
856 sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
857 if (info.frame().numLocks > 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
858 sb.append(" #locks=").append(info.frame().numLocks);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
859 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
860 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
861 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
862 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
863 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
864
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
865 /**
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
866 * @return the list of infopoints, sorted by {@link Site#pcOffset}
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
867 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
868 public List<Infopoint> getInfopoints() {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
869 if (infopoints.isEmpty()) {
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
870 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
871 }
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
872 return unmodifiableList(infopoints);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
873 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
874
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
875 /**
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
876 * @return the list of data references
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
877 */
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
878 public List<DataPatch> getDataPatches() {
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
879 if (dataPatches.isEmpty()) {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
880 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
881 }
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
882 return unmodifiableList(dataPatches);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
883 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
884
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
885 /**
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
886 * @return the list of exception handlers
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
887 */
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
888 public List<ExceptionHandler> getExceptionHandlers() {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
889 if (exceptionHandlers.isEmpty()) {
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
890 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
891 }
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
892 return unmodifiableList(exceptionHandlers);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
893 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
894
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
895 /**
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
896 * @return the list of marks
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
897 */
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
898 public List<Mark> getMarks() {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
899 if (marks.isEmpty()) {
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
900 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
901 }
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
902 return unmodifiableList(marks);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
903 }
12517
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
904
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
905 public String getName() {
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
906 return name;
b2882f4ab612 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10861
diff changeset
907 }
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
908
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
909 public void reset() {
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
910 infopoints.clear();
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17207
diff changeset
911 dataPatches.clear();
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
912 exceptionHandlers.clear();
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
913 marks.clear();
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
914 if (annotations != null) {
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
915 annotations.clear();
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
916 }
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16573
diff changeset
917 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
918 }