annotate jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/CompilationResult.java @ 22054:0e095e2c24e2

Rename com.oracle.jvmci to jdk.internal.jvmci
author twisti
date Mon, 22 Jun 2015 12:12:53 -0700
parents
children 598c75a3d1d1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
1 /*
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
4 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
8 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
13 * accompanied this code).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
14 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
18 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
21 * questions.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
22 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
23 package jdk.internal.jvmci.code;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
24
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
25 import static java.util.Collections.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
26 import static jdk.internal.jvmci.meta.MetaUtil.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
27
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
28 import java.util.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
29
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
30 import jdk.internal.jvmci.meta.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
31 import jdk.internal.jvmci.meta.Assumptions.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
32
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
33 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
34 * Represents the output from compiling a method, including the compiled machine code, associated
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
35 * data and references, relocation information, deoptimization information, etc.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
36 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
37 public class CompilationResult {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
38
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
39 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
40 * Represents a code position with associated additional information.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
41 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
42 public abstract static class Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
43
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
44 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
45 * The position (or offset) of this site with respect to the start of the target method.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
46 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
47 public final int pcOffset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
48
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
49 public Site(int pos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
50 this.pcOffset = pos;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
51 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
52
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
53 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
54 public final int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
55 throw new UnsupportedOperationException("hashCode");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
56 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
57
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
58 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
59 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
60 return identityHashCodeString(this);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
61 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
62
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
63 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
64 public abstract boolean equals(Object obj);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
65 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
66
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
67 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
68 * Represents an infopoint with associated debug info. Note that safepoints are also infopoints.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
69 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
70 public static class Infopoint extends Site implements Comparable<Infopoint> {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
71
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
72 public final DebugInfo debugInfo;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
73
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
74 public final InfopointReason reason;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
75
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
76 public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
77 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
78 this.debugInfo = debugInfo;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
79 this.reason = reason;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
80 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
81
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
82 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
83 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
84 StringBuilder sb = new StringBuilder();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
85 sb.append(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
86 sb.append("[<infopoint>]");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
87 appendDebugInfo(sb, debugInfo);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
88 return sb.toString();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
89 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
90
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
91 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
92 public int compareTo(Infopoint o) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
93 if (pcOffset < o.pcOffset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
94 return -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
95 } else if (pcOffset > o.pcOffset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
96 return 1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
97 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
98 return this.reason.compareTo(o.reason);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
99 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
100
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
101 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
102 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
103 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
104 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
105 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
106 if (obj != null && obj.getClass() == getClass()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
107 Infopoint that = (Infopoint) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
108 if (this.pcOffset == that.pcOffset && Objects.equals(this.debugInfo, that.debugInfo) && Objects.equals(this.reason, that.reason)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
109 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
110 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
111 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
112 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
113 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
114 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
115
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
116 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
117 * Represents a call in the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
118 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
119 public static final class Call extends Infopoint {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
120
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
121 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
122 * The target of the call.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
123 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
124 public final InvokeTarget target;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
125
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
126 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
127 * The size of the call instruction.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
128 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
129 public final int size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
130
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
131 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
132 * Specifies if this call is direct or indirect. A direct call has an immediate operand
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
133 * encoding the absolute or relative (to the call itself) address of the target. An indirect
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
134 * call has a register or memory operand specifying the target address of the call.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
135 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
136 public final boolean direct;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
137
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
138 public Call(InvokeTarget target, int pcOffset, int size, boolean direct, DebugInfo debugInfo) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
139 super(pcOffset, debugInfo, InfopointReason.CALL);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
140 this.size = size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
141 this.target = target;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
142 this.direct = direct;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
143 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
144
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
145 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
146 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
147 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
148 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
149 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
150 if (obj instanceof Call && super.equals(obj)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
151 Call that = (Call) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
152 if (this.size == that.size && this.direct == that.direct && Objects.equals(this.target, that.target)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
153 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
154 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
155 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
156 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
157 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
158
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
159 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
160 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
161 StringBuilder sb = new StringBuilder();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
162 sb.append(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
163 sb.append('[');
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
164 sb.append(target);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
165 sb.append(']');
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
166
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
167 if (debugInfo != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
168 appendDebugInfo(sb, debugInfo);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
169 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
170
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
171 return sb.toString();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
172 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
173 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
174
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
175 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
176 * Represents some external data that is referenced by the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
177 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
178 public abstract static class Reference {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
179
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
180 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
181 public abstract int hashCode();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
182
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
183 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
184 public abstract boolean equals(Object obj);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
185 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
186
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
187 public static final class ConstantReference extends Reference {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
188
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
189 private final VMConstant constant;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
190
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
191 public ConstantReference(VMConstant constant) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
192 this.constant = constant;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
193 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
194
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
195 public VMConstant getConstant() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
196 return constant;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
197 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
198
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
199 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
200 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
201 return constant.toString();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
202 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
203
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
204 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
205 public int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
206 return constant.hashCode();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
207 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
208
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
209 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
210 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
211 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
212 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
213 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
214 if (obj instanceof ConstantReference) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
215 ConstantReference that = (ConstantReference) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
216 return Objects.equals(this.constant, that.constant);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
217 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
218 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
219 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
220 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
221
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
222 public static final class DataSectionReference extends Reference {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
223
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
224 private boolean initialized;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
225 private int offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
226
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
227 public DataSectionReference() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
228 // will be set after the data section layout is fixed
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
229 offset = 0xDEADDEAD;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
230 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
231
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
232 public int getOffset() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
233 assert initialized;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
234
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
235 return offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
236 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
237
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
238 public void setOffset(int offset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
239 assert !initialized;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
240 initialized = true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
241
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
242 this.offset = offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
243 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
244
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
245 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
246 public int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
247 return offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
248 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
249
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
250 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
251 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
252 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
253 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
254 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
255 if (obj instanceof DataSectionReference) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
256 DataSectionReference that = (DataSectionReference) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
257 return this.offset == that.offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
258 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
259 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
260 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
261 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
262
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
263 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
264 * Represents a code site that references some data. The associated data can be either a
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
265 * {@link DataSectionReference reference} to the data section, or it may be an inlined
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
266 * {@link JavaConstant} that needs to be patched.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
267 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
268 public static final class DataPatch extends Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
269
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
270 public Reference reference;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
271
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
272 public DataPatch(int pcOffset, Reference reference) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
273 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
274 this.reference = reference;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
275 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
276
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
277 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
278 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
279 return String.format("%d[<data patch referring to %s>]", pcOffset, reference.toString());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
280 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
281
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
282 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
283 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
284 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
285 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
286 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
287 if (obj instanceof DataPatch) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
288 DataPatch that = (DataPatch) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
289 if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
290 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
291 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
292 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
293 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
294 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
295 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
296
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
297 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
298 * Provides extra information about instructions or data at specific positions in
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
299 * {@link CompilationResult#getTargetCode()}. This is optional information that can be used to
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
300 * enhance a disassembly of the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
301 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
302 public abstract static class CodeAnnotation {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
303
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
304 public final int position;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
305
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
306 public CodeAnnotation(int position) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
307 this.position = position;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
308 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
309
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
310 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
311 public final int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
312 throw new UnsupportedOperationException("hashCode");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
313 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
314
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
315 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
316 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
317 return identityHashCodeString(this);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
318 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
319
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
320 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
321 public abstract boolean equals(Object obj);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
322 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
323
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
324 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
325 * A string comment about one or more instructions at a specific position in the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
326 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
327 public static final class CodeComment extends CodeAnnotation {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
328
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
329 public final String value;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
330
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
331 public CodeComment(int position, String comment) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
332 super(position);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
333 this.value = comment;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
334 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
335
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
336 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
337 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
338 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
339 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
340 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
341 if (obj instanceof CodeComment) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
342 CodeComment that = (CodeComment) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
343 if (this.position == that.position && this.value.equals(that.value)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
344 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
345 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
346 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
347 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
348 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
349
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
350 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
351 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
352 return getClass().getSimpleName() + "@" + position + ": " + value;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
353 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
354 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
355
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
356 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
357 * Describes a table of signed offsets embedded in the code. The offsets are relative to the
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
358 * starting address of the table. This type of table maybe generated when translating a
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
359 * multi-way branch based on a key value from a dense value set (e.g. the {@code tableswitch}
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
360 * JVM instruction).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
361 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
362 * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high}
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
363 * inclusive.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
364 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
365 public static final class JumpTable extends CodeAnnotation {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
366
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
367 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
368 * The low value in the key range (inclusive).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
369 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
370 public final int low;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
371
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
372 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
373 * The high value in the key range (inclusive).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
374 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
375 public final int high;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
376
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
377 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
378 * The size (in bytes) of each table entry.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
379 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
380 public final int entrySize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
381
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
382 public JumpTable(int position, int low, int high, int entrySize) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
383 super(position);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
384 this.low = low;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
385 this.high = high;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
386 this.entrySize = entrySize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
387 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
388
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
389 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
390 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
391 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
392 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
393 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
394 if (obj instanceof JumpTable) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
395 JumpTable that = (JumpTable) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
396 if (this.position == that.position && this.entrySize == that.entrySize && this.low == that.low && this.high == that.high) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
397 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
398 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
399 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
400 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
401 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
402
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
403 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
404 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
405 return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
406 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
407 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
408
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
409 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
410 * Represents exception handler information for a specific code position. It includes the catch
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
411 * code position as well as the caught exception type.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
412 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
413 public static final class ExceptionHandler extends Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
414
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
415 public final int handlerPos;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
416
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
417 ExceptionHandler(int pcOffset, int handlerPos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
418 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
419 this.handlerPos = handlerPos;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
420 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
421
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
422 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
423 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
424 return String.format("%d[<exception edge to %d>]", pcOffset, handlerPos);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
425 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
426
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
427 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
428 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
429 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
430 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
431 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
432 if (obj instanceof ExceptionHandler) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
433 ExceptionHandler that = (ExceptionHandler) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
434 if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
435 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
436 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
437 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
438 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
439 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
440 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
441
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
442 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
443 * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
444 * mark can reference other marks.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
445 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
446 public static final class Mark extends Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
447
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
448 public final Object id;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
449
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
450 public Mark(int pcOffset, Object id) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
451 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
452 this.id = id;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
453 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
454
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
455 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
456 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
457 if (id == null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
458 return String.format("%d[<mar>]", pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
459 } else if (id instanceof Integer) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
460 return String.format("%d[<mark with id %s>]", pcOffset, Integer.toHexString((Integer) id));
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
461 } else {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
462 return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
463 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
464 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
465
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
466 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
467 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
468 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
469 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
470 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
471 if (obj instanceof Mark) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
472 Mark that = (Mark) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
473 if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
474 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
475 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
476 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
477 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
478 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
479 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
480
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
481 private int id = -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
482 private int entryBCI = -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
483
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
484 private final DataSection dataSection = new DataSection();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
485
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
486 private final List<Infopoint> infopoints = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
487 private final List<DataPatch> dataPatches = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
488 private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
489 private final List<Mark> marks = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
490
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
491 private int totalFrameSize = -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
492 private int customStackAreaOffset = -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
493
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
494 private final String name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
495
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
496 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
497 * The buffer containing the emitted machine code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
498 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
499 private byte[] targetCode;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
500
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
501 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
502 * The leading number of bytes in {@link #targetCode} containing the emitted machine code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
503 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
504 private int targetCodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
505
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
506 private ArrayList<CodeAnnotation> annotations;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
507
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
508 private Assumption[] assumptions;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
509
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
510 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
511 * The list of the methods whose bytecodes were used as input to the compilation. If
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
512 * {@code null}, then the compilation did not record method dependencies. Otherwise, the first
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
513 * element of this array is the root method of the compilation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
514 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
515 private ResolvedJavaMethod[] methods;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
516
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
517 private int bytecodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
518
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
519 private boolean hasUnsafeAccess;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
520
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
521 public CompilationResult() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
522 this(null);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
523 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
524
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
525 public CompilationResult(String name) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
526 this.name = name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
527 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
528
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
529 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
530 public int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
531 // CompilationResult instances should not be used as hash map keys
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
532 throw new UnsupportedOperationException("hashCode");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
533 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
534
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
535 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
536 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
537 if (methods != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
538 return getClass().getName() + "[" + methods[0].format("%H.%n(%p)%r") + "]";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
539 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
540 return identityHashCodeString(this);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
541 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
542
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
543 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
544 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
545 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
546 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
547 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
548 if (obj != null && obj.getClass() == getClass()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
549 CompilationResult that = (CompilationResult) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
550 // @formatter:off
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
551 if (this.entryBCI == that.entryBCI &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
552 this.id == that.id &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
553 this.customStackAreaOffset == that.customStackAreaOffset &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
554 this.totalFrameSize == that.totalFrameSize &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
555 this.targetCodeSize == that.targetCodeSize &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
556 Objects.equals(this.name, that.name) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
557 Objects.equals(this.annotations, that.annotations) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
558 Objects.equals(this.dataSection, that.dataSection) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
559 Objects.equals(this.exceptionHandlers, that.exceptionHandlers) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
560 Objects.equals(this.dataPatches, that.dataPatches) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
561 Objects.equals(this.infopoints, that.infopoints) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
562 Objects.equals(this.marks, that.marks) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
563 Arrays.equals(this.assumptions, that.assumptions) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
564 Arrays.equals(targetCode, that.targetCode)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
565 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
566 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
567 // @formatter:on
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
568 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
569 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
570 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
571
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
572 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
573 * @return the compile id
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
574 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
575 public int getId() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
576 return id;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
577 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
578
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
579 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
580 * @param id the compile id to set
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
581 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
582 public void setId(int id) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
583 this.id = id;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
584 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
585
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
586 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
587 * @return the entryBCI
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
588 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
589 public int getEntryBCI() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
590 return entryBCI;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
591 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
592
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
593 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
594 * @param entryBCI the entryBCI to set
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
595 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
596 public void setEntryBCI(int entryBCI) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
597 this.entryBCI = entryBCI;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
598 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
599
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
600 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
601 * Sets the assumptions made during compilation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
602 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
603 public void setAssumptions(Assumption[] assumptions) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
604 this.assumptions = assumptions;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
605 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
606
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
607 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
608 * Gets the assumptions made during compilation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
609 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
610 public Assumption[] getAssumptions() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
611 return assumptions;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
612 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
613
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
614 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
615 * Sets the methods whose bytecodes were used as input to the compilation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
616 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
617 * @param rootMethod the root method of the compilation
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
618 * @param inlinedMethods the methods inlined during compilation
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
619 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
620 public void setMethods(ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
621 assert rootMethod != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
622 assert inlinedMethods != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
623 if (inlinedMethods.contains(rootMethod)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
624 methods = inlinedMethods.toArray(new ResolvedJavaMethod[inlinedMethods.size()]);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
625 for (int i = 0; i < methods.length; i++) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
626 if (methods[i].equals(rootMethod)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
627 if (i != 0) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
628 ResolvedJavaMethod tmp = methods[0];
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
629 methods[0] = methods[i];
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
630 methods[i] = tmp;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
631 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
632 break;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
633 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
634 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
635 } else {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
636 methods = new ResolvedJavaMethod[1 + inlinedMethods.size()];
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
637 methods[0] = rootMethod;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
638 int i = 1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
639 for (ResolvedJavaMethod m : inlinedMethods) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
640 methods[i++] = m;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
641 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
642 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
643 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
644
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
645 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
646 * Gets the methods whose bytecodes were used as input to the compilation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
647 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
648 * @return {@code null} if the compilation did not record method dependencies otherwise the
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
649 * methods whose bytecodes were used as input to the compilation with the first element
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
650 * being the root method of the compilation
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
651 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
652 public ResolvedJavaMethod[] getMethods() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
653 return methods;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
654 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
655
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
656 public void setBytecodeSize(int bytecodeSize) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
657 this.bytecodeSize = bytecodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
658 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
659
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
660 public int getBytecodeSize() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
661 return bytecodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
662 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
663
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
664 public DataSection getDataSection() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
665 return dataSection;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
666 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
667
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
668 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
669 * The total frame size of the method in bytes. This includes the return address pushed onto the
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
670 * stack, if any.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
671 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
672 * @return the frame size
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
673 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
674 public int getTotalFrameSize() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
675 assert totalFrameSize != -1 : "frame size not yet initialized!";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
676 return totalFrameSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
677 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
678
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
679 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
680 * Sets the total frame size in bytes. This includes the return address pushed onto the stack,
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
681 * if any.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
682 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
683 * @param size the size of the frame in bytes
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
684 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
685 public void setTotalFrameSize(int size) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
686 totalFrameSize = size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
687 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
688
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
689 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
690 * Sets the machine that has been generated by the compiler.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
691 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
692 * @param code the machine code generated
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
693 * @param size the size of the machine code
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
694 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
695 public void setTargetCode(byte[] code, int size) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
696 targetCode = code;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
697 targetCodeSize = size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
698 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
699
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
700 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
701 * Records a data patch in the code section. The data patch can refer to something in the
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
702 * {@link DataSectionReference data section} or directly to an {@link ConstantReference inlined
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
703 * constant}.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
704 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
705 * @param codePos The position in the code that needs to be patched.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
706 * @param ref The reference that should be inserted in the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
707 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
708 public void recordDataPatch(int codePos, Reference ref) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
709 assert codePos >= 0 && ref != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
710 dataPatches.add(new DataPatch(codePos, ref));
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
711 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
712
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
713 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
714 * Records a call in the code array.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
715 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
716 * @param codePos the position of the call in the code array
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
717 * @param size the size of the call instruction
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
718 * @param target the being called
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
719 * @param debugInfo the debug info for the call
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
720 * @param direct specifies if this is a {@linkplain Call#direct direct} call
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
721 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
722 public void recordCall(int codePos, int size, InvokeTarget target, DebugInfo debugInfo, boolean direct) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
723 final Call call = new Call(target, codePos, size, direct, debugInfo);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
724 addInfopoint(call);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
725 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
726
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
727 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
728 * Records an exception handler for this method.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
729 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
730 * @param codePos the position in the code that is covered by the handler
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
731 * @param handlerPos the position of the handler
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
732 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
733 public void recordExceptionHandler(int codePos, int handlerPos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
734 assert validateExceptionHandlerAdd(codePos, handlerPos) : String.format("Duplicate exception handler for pc 0x%x handlerPos 0x%x", codePos, handlerPos);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
735 exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
736 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
737
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
738 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
739 * Validate if the exception handler for codePos already exists and handlerPos is different.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
740 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
741 * @param codePos
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
742 * @param handlerPos
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
743 * @return true if the validation is successful
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
744 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
745 private boolean validateExceptionHandlerAdd(int codePos, int handlerPos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
746 ExceptionHandler exHandler = getExceptionHandlerForCodePos(codePos);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
747 return exHandler == null || exHandler.handlerPos == handlerPos;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
748 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
749
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
750 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
751 * Returns the first ExceptionHandler which matches codePos.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
752 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
753 * @param codePos position to search for
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
754 * @return first matching ExceptionHandler
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
755 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
756 private ExceptionHandler getExceptionHandlerForCodePos(int codePos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
757 for (ExceptionHandler h : exceptionHandlers) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
758 if (h.pcOffset == codePos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
759 return h;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
760 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
761 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
762 return null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
763 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
764
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
765 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
766 * Records an infopoint in the code array.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
767 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
768 * @param codePos the position of the infopoint in the code array
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
769 * @param debugInfo the debug info for the infopoint
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
770 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
771 public void recordInfopoint(int codePos, DebugInfo debugInfo, InfopointReason reason) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
772 addInfopoint(new Infopoint(codePos, debugInfo, reason));
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
773 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
774
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
775 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
776 * Records a custom infopoint in the code section.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
777 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
778 * Compiler implementations can use this method to record non-standard infopoints, which are not
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
779 * handled by the dedicated methods like {@link #recordCall}.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
780 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
781 * @param infopoint the infopoint to record, usually a derived class from {@link Infopoint}
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
782 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
783 public void addInfopoint(Infopoint infopoint) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
784 // The infopoints list must always be sorted
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
785 if (!infopoints.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
786 Infopoint previousInfopoint = infopoints.get(infopoints.size() - 1);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
787 if (previousInfopoint.pcOffset > infopoint.pcOffset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
788 // This re-sorting should be very rare
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
789 Collections.sort(infopoints);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
790 previousInfopoint = infopoints.get(infopoints.size() - 1);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
791 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
792 if (previousInfopoint.pcOffset == infopoint.pcOffset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
793 if (infopoint.reason.canBeOmitted()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
794 return;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
795 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
796 if (previousInfopoint.reason.canBeOmitted()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
797 Infopoint removed = infopoints.remove(infopoints.size() - 1);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
798 assert removed == previousInfopoint;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
799 } else {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
800 throw new RuntimeException("Infopoints that can not be omited should have distinct PCs");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
801 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
802 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
803 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
804 infopoints.add(infopoint);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
805 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
806
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
807 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
808 * Records an instruction mark within this method.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
809 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
810 * @param codePos the position in the code that is covered by the handler
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
811 * @param markId the identifier for this mark
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
812 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
813 public Mark recordMark(int codePos, Object markId) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
814 Mark mark = new Mark(codePos, markId);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
815 marks.add(mark);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
816 return mark;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
817 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
818
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
819 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
820 * Offset in bytes for the custom stack area (relative to sp).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
821 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
822 * @return the offset in bytes
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
823 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
824 public int getCustomStackAreaOffset() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
825 return customStackAreaOffset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
826 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
827
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
828 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
829 * @see #getCustomStackAreaOffset()
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
830 * @param offset
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
831 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
832 public void setCustomStackAreaOffset(int offset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
833 customStackAreaOffset = offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
834 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
835
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
836 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
837 * @return the machine code generated for this method
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
838 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
839 public byte[] getTargetCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
840 return targetCode;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
841 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
842
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
843 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
844 * @return the size of the machine code generated for this method
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
845 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
846 public int getTargetCodeSize() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
847 return targetCodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
848 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
849
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
850 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
851 * @return the code annotations or {@code null} if there are none
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
852 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
853 public List<CodeAnnotation> getAnnotations() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
854 if (annotations == null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
855 return Collections.emptyList();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
856 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
857 return annotations;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
858 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
859
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
860 public void addAnnotation(CodeAnnotation annotation) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
861 assert annotation != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
862 if (annotations == null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
863 annotations = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
864 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
865 annotations.add(annotation);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
866 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
867
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
868 private static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
869 if (info != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
870 ReferenceMap refMap = info.getReferenceMap();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
871 if (refMap != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
872 sb.append(refMap.toString());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
873 sb.append(']');
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
874 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
875 RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
876 if (calleeSaveInfo != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
877 sb.append(" callee-save-info[");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
878 String sep = "";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
879 for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
880 sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
881 sep = ", ";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
882 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
883 sb.append(']');
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
884 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
885 BytecodePosition codePos = info.getBytecodePosition();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
886 if (codePos != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
887 MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
888 if (info.hasFrame()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
889 sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
890 if (info.frame().numLocks > 0) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
891 sb.append(" #locks=").append(info.frame().numLocks);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
892 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
893 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
894 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
895 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
896 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
897
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
898 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
899 * @return the list of infopoints, sorted by {@link Site#pcOffset}
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
900 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
901 public List<Infopoint> getInfopoints() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
902 if (infopoints.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
903 return emptyList();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
904 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
905 return unmodifiableList(infopoints);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
906 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
907
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
908 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
909 * @return the list of data references
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
910 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
911 public List<DataPatch> getDataPatches() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
912 if (dataPatches.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
913 return emptyList();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
914 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
915 return unmodifiableList(dataPatches);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
916 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
917
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
918 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
919 * @return the list of exception handlers
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
920 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
921 public List<ExceptionHandler> getExceptionHandlers() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
922 if (exceptionHandlers.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
923 return emptyList();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
924 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
925 return unmodifiableList(exceptionHandlers);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
926 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
927
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
928 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
929 * @return the list of marks
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
930 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
931 public List<Mark> getMarks() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
932 if (marks.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
933 return emptyList();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
934 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
935 return unmodifiableList(marks);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
936 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
937
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
938 public String getName() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
939 return name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
940 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
941
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
942 public void setHasUnsafeAccess(boolean hasUnsafeAccess) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
943 this.hasUnsafeAccess = hasUnsafeAccess;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
944 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
945
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
946 public boolean hasUnsafeAccess() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
947 return hasUnsafeAccess;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
948 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
949
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
950 public void reset() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
951 hasUnsafeAccess = false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
952 infopoints.clear();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
953 dataPatches.clear();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
954 exceptionHandlers.clear();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
955 marks.clear();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
956 if (annotations != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
957 annotations.clear();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
958 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
959 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
960 }