annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java @ 16573:a2ec1ac769e4

Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 18 Jul 2014 11:14:54 +0200
parents 15771ff797b4
children 5a7b82c1514e
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 /*
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
2 * Copyright (c) 2009, 2013, 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
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
25 import static java.util.Collections.*;
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
26
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import java.io.*;
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
28 import java.nio.*;
3733
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
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14758
diff changeset
31 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
32 import com.oracle.graal.api.meta.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
35 * 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
36 * 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
37 */
5546
e42c0df7212a Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5542
diff changeset
38 public class CompilationResult implements Serializable {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
40 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
41
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
42 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 * Represents a code position with associated additional information.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 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
46
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
47 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
48 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 * 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
50 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 public final int pcOffset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 public Site(int pos) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 this.pcOffset = pos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 /**
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
59 * 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
60 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
61 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
62
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
63 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
64 public final DebugInfo debugInfo;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
66 public final InfopointReason reason;
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
67
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
68 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
69 super(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
70 this.debugInfo = debugInfo;
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
71 this.reason = reason;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 StringBuilder sb = new StringBuilder();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 sb.append(pcOffset);
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
78 sb.append("[<infopoint>]");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 appendDebugInfo(sb, debugInfo);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 return sb.toString();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 @Override
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
84 public int compareTo(Infopoint o) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 if (pcOffset < o.pcOffset) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 return -1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 } else if (pcOffset > o.pcOffset) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 return 1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 }
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
90 return this.reason.compareTo(o.reason);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 * Represents a call in the code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
97 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
98
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
99 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
100
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
101 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 * The target of the call.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 */
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
104 public final InvokeTarget target;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 * The size of the call instruction.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 public final int size;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
111 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
112 * 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
113 * 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
114 * 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
115 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116 public final boolean direct;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
118 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
119 super(pcOffset, debugInfo, InfopointReason.CALL);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 this.size = size;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 this.target = target;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 this.direct = direct;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127 StringBuilder sb = new StringBuilder();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128 sb.append(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 sb.append('[');
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 sb.append(target);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 sb.append(']');
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133 if (debugInfo != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 appendDebugInfo(sb, debugInfo);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 }
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 return sb.toString();
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 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140
13588
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
141 /**
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
142 * 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
143 */
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
144 public abstract static class Data {
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
145
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
146 private final int alignment;
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
147
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
148 protected Data(int alignment) {
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
149 this.alignment = alignment;
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
150 }
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
151
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
152 public int getAlignment() {
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
153 return alignment;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
154 }
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
155
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
156 public abstract int getSize(TargetDescription target);
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
157
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
158 public abstract Kind getKind();
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
159
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
160 public abstract void emit(TargetDescription target, ByteBuffer buffer);
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
161 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
162
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
163 public abstract static class ConstantData extends Data {
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
164
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
165 private final Constant constant;
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
166
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
167 protected ConstantData(Constant constant, int alignment) {
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
168 super(alignment);
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
169 this.constant = constant;
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
170 }
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
171
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
172 public Constant getConstant() {
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
173 return constant;
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
174 }
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
175 }
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
176
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
177 /**
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
178 * Represents a Java primitive value used in a {@link DataPatch}. This implementation uses
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
179 * {@link Kind#getByteCount()} bytes to encode each value.
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
180 */
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
181 public static final class PrimitiveData extends ConstantData {
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
182
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
183 public PrimitiveData(Constant constant, int alignment) {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
184 super(constant, alignment);
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
185 assert constant.getKind().isPrimitive();
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
186 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
187
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
188 @Override
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
189 public int getSize(TargetDescription target) {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
190 return getConstant().getKind().getByteCount();
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
191 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
192
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
193 @Override
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
194 public Kind getKind() {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
195 return getConstant().getKind();
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
196 }
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
197
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
198 @Override
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
199 public void emit(TargetDescription target, ByteBuffer buffer) {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
200 switch (getConstant().getKind()) {
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
201 case Boolean:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
202 buffer.put(getConstant().asBoolean() ? (byte) 1 : (byte) 0);
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
203 break;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
204 case Byte:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
205 buffer.put((byte) getConstant().asInt());
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
206 break;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
207 case Char:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
208 buffer.putChar((char) getConstant().asInt());
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
209 break;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
210 case Short:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
211 buffer.putShort((short) getConstant().asInt());
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
212 break;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
213 case Int:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
214 buffer.putInt(getConstant().asInt());
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
215 break;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
216 case Long:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
217 buffer.putLong(getConstant().asLong());
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
218 break;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
219 case Float:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
220 buffer.putFloat(getConstant().asFloat());
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
221 break;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
222 case Double:
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
223 buffer.putDouble(getConstant().asDouble());
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
224 break;
13588
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
225 }
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
226 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
227
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
228 @Override
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
229 public String toString() {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
230 return getConstant().toString();
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
231 }
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
232
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
233 @Override
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
234 public int hashCode() {
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
235 return getConstant().hashCode();
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
236 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
237
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
238 @Override
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
239 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
240 if (this == obj) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
241 return true;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
242 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
243 if (obj instanceof PrimitiveData) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
244 PrimitiveData other = (PrimitiveData) obj;
14736
5ba874df3b2b Introduce base class ConstantData
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14562
diff changeset
245 return getConstant().equals(other.getConstant());
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
246 } else {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
247 return false;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
248 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
249 }
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
250 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
251
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
252 public static final class RawData extends Data {
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
253
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
254 public final byte[] data;
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
255
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
256 public RawData(byte[] data, int alignment) {
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
257 super(alignment);
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
258 this.data = data;
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
259 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
260
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
261 @Override
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
262 public int getSize(TargetDescription target) {
13676
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
263 return data.length;
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
264 }
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
265
f30814642122 Tightly pack data references that are smaller than 8 bytes.
Roland Schatz <roland.schatz@oracle.com>
parents: 13630
diff changeset
266 @Override
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
267 public Kind getKind() {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
268 return Kind.Illegal;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
269 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
270
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
271 @Override
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
272 public void emit(TargetDescription target, ByteBuffer buffer) {
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
273 buffer.put(data);
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
274 }
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 @Override
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
277 public String toString() {
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
278 Formatter ret = new Formatter();
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
279 boolean first = true;
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
280 for (byte b : data) {
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
281 ret.format(first ? "%02X" : " %02X", b);
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
282 first = false;
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
283 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
284 return ret.toString();
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
285 }
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
286
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
287 @Override
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
288 public int hashCode() {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
289 return Arrays.hashCode(data);
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
290 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
291
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
292 @Override
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
293 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
294 if (this == obj) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
295 return true;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
296 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
297 if (obj instanceof RawData) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
298 RawData other = (RawData) obj;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
299 return Arrays.equals(data, other.data);
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
300 } else {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
301 return false;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
302 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
303 }
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
304 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
305
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
306 /**
13588
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
307 * Represents a code site that references some data. The associated data can be either a
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
308 * reference to an external {@link Data} item in the data section, or it may be an inlined
8aee7169dbe4 Improve documentation of data section building code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
309 * {@link Constant} that needs to be patched.
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 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
312
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
313 private static final long serialVersionUID = 5771730331604867476L;
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
314 public Data data;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
315 public boolean inline;
10810
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
316
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
317 public DataPatch(int pcOffset, Data data, boolean inline) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
318 super(pcOffset);
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
319 this.data = data;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
320 this.inline = inline;
10861
6872c61c1d3e Fix null reference access when dumping raw data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 10834
diff changeset
321 }
6872c61c1d3e Fix null reference access when dumping raw data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 10834
diff changeset
322
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
323 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
324 public String toString() {
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
325 return String.format("%d[<data patch referring to %s data %s>]", pcOffset, inline ? "inline" : "external", data.toString());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
326 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
327 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
328
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
329 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
330 * 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
331 * {@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
332 * enhance a disassembly of the code.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
333 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
334 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
335
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
336 private static final long serialVersionUID = -7903959680749520748L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
337 public final int position;
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 public CodeAnnotation(int position) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340 this.position = position;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 }
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
344 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
345 * 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
346 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
347 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
348
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
349 /**
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
350 *
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
351 */
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
352 private static final long serialVersionUID = 6802287188701961401L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
353 public final String value;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
354
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
355 public CodeComment(int position, String comment) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
356 super(position);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
357 this.value = comment;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
358 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
359
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
360 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
361 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
362 return getClass().getSimpleName() + "@" + position + ": " + value;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
363 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
364 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
365
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
366 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
367 * 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
368 * 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
369 * 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
370 * 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
371 *
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
372 * 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
373 * inclusive.
3733
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 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
376
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
377 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
378
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
379 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
380 * The low value in the key range (inclusive).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
381 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
382 public final int low;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
383
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 * The high value in the key range (inclusive).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
386 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
387 public final int high;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
388
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
389 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
390 * The size (in bytes) of each table entry.
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 entrySize;
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 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
395 super(position);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
396 this.low = low;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
397 this.high = high;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
398 this.entrySize = entrySize;
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
401 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
402 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
403 return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
404 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
405 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
406
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
407 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
408 * 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
409 * 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
410 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
411 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
412
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
413 private static final long serialVersionUID = 4897339464722665281L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
414 public final int handlerPos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
415
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
416 ExceptionHandler(int pcOffset, int handlerPos) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
417 super(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
418 this.handlerPos = handlerPos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
419 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
420
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
421 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
422 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
423 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
424 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
425 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
426
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5719
diff changeset
427 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
428 * 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
429 * 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
430 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
431 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
432
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
433 private static final long serialVersionUID = 3612943150662354844L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
434 public final Object id;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
435
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
436 public Mark(int pcOffset, Object id) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
437 super(pcOffset);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
438 this.id = id;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
439 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
440
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
441 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
442 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
443 if (id == null) {
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
444 return String.format("%d[<mar>]", pcOffset);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
445 } else if (id instanceof Integer) {
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
446 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
447 } else {
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
448 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
449 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
450 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
451 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
452
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
453 private int id = -1;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
454 private int entryBCI = -1;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
455
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
456 private final List<Infopoint> infopoints = new ArrayList<>();
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
457 private final List<DataPatch> dataReferences = new ArrayList<>();
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
458 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
459 private final List<Mark> marks = new ArrayList<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
460
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
461 private int totalFrameSize = -1;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
462 private int customStackAreaOffset = -1;
6698
f5715c5a106a Make CalleeSaveLayout available in CompilationResult
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6658
diff changeset
463
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
464 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
465
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
466 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
467 * The buffer containing the emitted machine code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
468 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
469 private byte[] targetCode;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
470
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
471 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
472 * 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
473 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
474 private int targetCodeSize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
475
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
476 private ArrayList<CodeAnnotation> annotations;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
477
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
478 private Assumptions assumptions;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
479
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
480 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
481 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
482 }
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
483
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
484 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
485 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
486 }
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
487
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
488 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
489 * @return the compile id
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
490 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
491 public int getId() {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
492 return id;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
493 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
494
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
495 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
496 * @param id the compile id to set
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
497 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
498 public void setId(int id) {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
499 this.id = id;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
500 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
501
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
502 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
503 * @return the entryBCI
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
504 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
505 public int getEntryBCI() {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
506 return entryBCI;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
507 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
508
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
509 /**
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
510 * @param entryBCI the entryBCI to set
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
511 */
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
512 public void setEntryBCI(int entryBCI) {
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
513 this.entryBCI = entryBCI;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
514 }
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13588
diff changeset
515
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
516 public void setAssumptions(Assumptions assumptions) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
517 this.assumptions = assumptions;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
518 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
519
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
520 public Assumptions getAssumptions() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
521 return assumptions;
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
524 /**
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
525 * 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
526 * 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
527 *
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
528 * @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
529 */
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
530 public int getTotalFrameSize() {
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
531 assert totalFrameSize != -1 : "frame size not yet initialized!";
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
532 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
533 }
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
534
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
535 /**
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
536 * 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
537 * 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
538 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
539 * @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
540 */
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
541 public void setTotalFrameSize(int size) {
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
542 totalFrameSize = size;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
543 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
544
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
545 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
546 * 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
547 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
548 * @param code the machine code generated
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
549 * @param size the size of the machine code
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
550 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
551 public void setTargetCode(byte[] code, int size) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
552 targetCode = code;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
553 targetCodeSize = size;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
554 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
555
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
556 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
557 * Records a reference to the data section in the code section (e.g. to load an integer or
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
558 * floating point 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
559 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
560 * @param codePos the position in the code where the data reference occurs
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
561 * @param data the data that is referenced
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
562 */
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
563 public void recordDataReference(int codePos, Data data) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
564 assert codePos >= 0 && data != null;
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
565 dataReferences.add(new DataPatch(codePos, data, false));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
566 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
567
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
568 /**
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
569 * Records a reference to an inlined constant in the code section (e.g. to load a constant oop).
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
570 *
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 12517
diff changeset
571 * @param codePos the position in the code where the inlined constant occurs
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
572 * @param data the data that is referenced
10810
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
573 */
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
574 public void recordInlineData(int codePos, Data data) {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
575 assert codePos >= 0 && data != null;
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
576 dataReferences.add(new DataPatch(codePos, data, true));
10810
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
577 }
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
578
4e1db4c9d4c5 Support data patches for values larger than long.
Roland Schatz <roland.schatz@oracle.com>
parents: 9807
diff changeset
579 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
580 * 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
581 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
582 * @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
583 * @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
584 * @param target the being called
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
585 * @param debugInfo the debug info for the call
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
586 * @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
587 */
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
588 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
589 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
590 addInfopoint(call);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
591 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
592
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
593 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
594 * 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
595 *
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6996
diff changeset
596 * @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
597 * @param handlerPos the position of the handler
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
598 */
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
599 public void recordExceptionHandler(int codePos, int handlerPos) {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
600 exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
601 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
602
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
603 /**
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
604 * 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
605 *
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
606 * @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
607 * @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
608 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
609 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
610 addInfopoint(new Infopoint(codePos, debugInfo, reason));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
611 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
612
14758
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
613 /**
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
614 * 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
615 *
14758
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
616 * 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
617 * 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
618 *
14758
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
619 * @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
620 */
c612c2742a4f extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents: 14736
diff changeset
621 public void addInfopoint(Infopoint infopoint) {
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
622 // 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
623 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
624 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
625 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
626 // 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
627 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
628 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
629 }
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
630 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
631 if (infopoint.reason.canBeOmited()) {
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
632 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
633 }
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
634 if (previousInfopoint.reason.canBeOmited()) {
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
635 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
636 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
637 } 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
638 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
639 }
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
640 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
641 }
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
642 infopoints.add(infopoint);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
643 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
644
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 * 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
647 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
648 * @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
649 * @param markId the identifier for this mark
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
650 */
15375
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
651 public Mark recordMark(int codePos, Object markId) {
1b82cd9e72e9 Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
652 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
653 marks.add(mark);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
654 return mark;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
655 }
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 * 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
659 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
660 * @return the offset in bytes
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
661 */
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
662 public int getCustomStackAreaOffset() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
663 return customStackAreaOffset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
664 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
665
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
666 /**
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
667 * @see #getCustomStackAreaOffset()
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
668 * @param offset
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
669 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
670 public void setCustomStackAreaOffset(int offset) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
671 customStackAreaOffset = offset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
672 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
673
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
674 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
675 * @return the machine code generated for this method
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
676 */
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
677 public byte[] getTargetCode() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
678 return targetCode;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
679 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
680
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
681 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
682 * @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
683 */
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
684 public int getTargetCodeSize() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
685 return targetCodeSize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
686 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
687
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
688 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
689 * @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
690 */
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
691 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
692 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
693 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
694 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
695 return annotations;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
696 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
697
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
698 public void addAnnotation(CodeAnnotation annotation) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
699 assert annotation != null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
700 if (annotations == null) {
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
701 annotations = new ArrayList<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
702 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
703 annotations.add(annotation);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
704 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
705
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
706 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
707 if (info != null) {
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
708 ReferenceMap refMap = info.getReferenceMap();
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
709 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
710 RefMapFormatter formatter = new CodeUtil.NumberedRefMapFormatter();
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
711 if (refMap.hasFrameRefMap()) {
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
712 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
713 refMap.appendFrameMap(sb, formatter);
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
714 sb.append(']');
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
715 }
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
716 if (refMap.hasRegisterRefMap()) {
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
717 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
718 refMap.appendRegisterMap(sb, formatter);
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
719 sb.append(']');
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
720 }
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13676
diff changeset
721 }
9336
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
722 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
723 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
724 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
725 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
726 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
727 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
728 sep = ", ";
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
729 }
47e7933283f1 added support for adding callee save information to a DebugInfo (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9300
diff changeset
730 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
731 }
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
732 BytecodePosition codePos = info.getBytecodePosition();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
733 if (codePos != null) {
5719
429accae15aa moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents: 5711
diff changeset
734 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
735 if (info.hasFrame()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
736 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
737 if (info.frame().numLocks > 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
738 sb.append(" #locks=").append(info.frame().numLocks);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
739 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
740 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
741 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
742 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
743 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
744
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
745 /**
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
746 * @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
747 */
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 7826
diff changeset
748 public List<Infopoint> getInfopoints() {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
749 if (infopoints.isEmpty()) {
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
750 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
751 }
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
752 return unmodifiableList(infopoints);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
753 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
754
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
755 /**
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
756 * @return the list of data references
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
757 */
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
758 public List<DataPatch> getDataReferences() {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
759 if (dataReferences.isEmpty()) {
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
760 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
761 }
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
762 return unmodifiableList(dataReferences);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
763 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
764
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
765 /**
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
766 * @return the list of exception handlers
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
767 */
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
768 public List<ExceptionHandler> getExceptionHandlers() {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
769 if (exceptionHandlers.isEmpty()) {
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
770 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
771 }
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
772 return unmodifiableList(exceptionHandlers);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
773 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
774
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
775 /**
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
776 * @return the list of marks
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
777 */
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
778 public List<Mark> getMarks() {
9300
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
779 if (marks.isEmpty()) {
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
780 return emptyList();
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
781 }
d73ad771a602 return immutable collections from (some) CompilationResult getters
Doug Simon <doug.simon@oracle.com>
parents: 9003
diff changeset
782 return unmodifiableList(marks);
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
783 }
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
784
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
785 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
786 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
787 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
788 }