annotate jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationResult.java @ 22740:22110ef74a40

8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
author Doug Simon <doug.simon@oracle.com>
date Thu, 26 Nov 2015 00:47:01 +0100
parents f41ed1d87d68
children
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 */
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
23 package jdk.vm.ci.code;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
24
22569
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
25 import static java.util.Collections.emptyList;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
26 import static java.util.Collections.unmodifiableList;
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
27 import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
28
22569
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
29 import java.util.ArrayList;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
30 import java.util.Arrays;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
31 import java.util.Collection;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
32 import java.util.Collections;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
33 import java.util.List;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
34 import java.util.Map;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22113
diff changeset
35 import java.util.Objects;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
36
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
37 import jdk.vm.ci.meta.Assumptions.Assumption;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
38 import jdk.vm.ci.meta.InvokeTarget;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
39 import jdk.vm.ci.meta.JavaConstant;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
40 import jdk.vm.ci.meta.MetaUtil;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
41 import jdk.vm.ci.meta.ResolvedJavaMethod;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22663
diff changeset
42 import jdk.vm.ci.meta.VMConstant;
22054
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 * 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
46 * data and references, relocation information, deoptimization information, etc.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
47 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
48 public class CompilationResult {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
49
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
50 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
51 * Represents a code position with associated additional information.
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 public abstract static class Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
54
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
55 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
56 * 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
57 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
58 public final int pcOffset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
59
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
60 public Site(int pos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
61 this.pcOffset = pos;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
64 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
65 public final int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
66 throw new UnsupportedOperationException("hashCode");
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
69 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
70 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
71 return identityHashCodeString(this);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
72 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
75 public abstract boolean equals(Object obj);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
76 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
77
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
78 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
79 * 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
80 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
81 public static class Infopoint extends Site implements Comparable<Infopoint> {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
82
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
83 public final DebugInfo debugInfo;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
84
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
85 public final InfopointReason reason;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
86
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
87 public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
88 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
89 this.debugInfo = debugInfo;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
90 this.reason = reason;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
91 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
92
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
93 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
94 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
95 StringBuilder sb = new StringBuilder();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
96 sb.append(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
97 sb.append("[<infopoint>]");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
98 appendDebugInfo(sb, debugInfo);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
99 return sb.toString();
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
102 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
103 public int compareTo(Infopoint o) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
104 if (pcOffset < o.pcOffset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
105 return -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
106 } else if (pcOffset > o.pcOffset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
107 return 1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
108 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
109 return this.reason.compareTo(o.reason);
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
113 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
114 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
115 return true;
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 if (obj != null && obj.getClass() == getClass()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
118 Infopoint that = (Infopoint) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
119 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
120 return true;
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 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
123 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
124 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
128 * Represents a call in the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
129 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
130 public static final class Call extends Infopoint {
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
133 * The target of the call.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
134 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
135 public final InvokeTarget target;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
136
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 * The size of the call instruction.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
139 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
140 public final int size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
141
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
142 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
143 * 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
144 * 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
145 * 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
146 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
147 public final boolean direct;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
148
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
149 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
150 super(pcOffset, debugInfo, InfopointReason.CALL);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
151 this.size = size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
152 this.target = target;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
153 this.direct = direct;
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
157 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
158 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
159 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
160 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
161 if (obj instanceof Call && super.equals(obj)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
162 Call that = (Call) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
163 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
164 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
165 }
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 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
168 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
171 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
172 StringBuilder sb = new StringBuilder();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
173 sb.append(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
174 sb.append('[');
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
175 sb.append(target);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
176 sb.append(']');
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 if (debugInfo != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
179 appendDebugInfo(sb, debugInfo);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
180 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
181
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
182 return sb.toString();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
183 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
184 }
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 * Represents some external data that is referenced by the code.
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 public abstract static class Reference {
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
192 public abstract int hashCode();
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
195 public abstract boolean equals(Object obj);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
196 }
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 public static final class ConstantReference extends Reference {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
199
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
200 private final VMConstant constant;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
201
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
202 public ConstantReference(VMConstant constant) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
203 this.constant = constant;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
204 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
205
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
206 public VMConstant getConstant() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
207 return constant;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
210 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
211 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
212 return constant.toString();
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
215 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
216 public int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
217 return constant.hashCode();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
218 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
221 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
222 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
223 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
224 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
225 if (obj instanceof ConstantReference) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
226 ConstantReference that = (ConstantReference) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
227 return Objects.equals(this.constant, that.constant);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
228 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
229 return false;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
233 public static final class DataSectionReference extends Reference {
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 private boolean initialized;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
236 private int offset;
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 DataSectionReference() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
239 // will be set after the data section layout is fixed
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
240 offset = 0xDEADDEAD;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
243 public int getOffset() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
244 assert initialized;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
245
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
246 return offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
247 }
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 public void setOffset(int offset) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
250 assert !initialized;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
251 initialized = true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
252
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
253 this.offset = offset;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
256 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
257 public int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
258 return offset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
259 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
262 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
263 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
264 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
265 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
266 if (obj instanceof DataSectionReference) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
267 DataSectionReference that = (DataSectionReference) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
268 return this.offset == that.offset;
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 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
271 }
22663
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
272
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
273 @Override
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
274 public String toString() {
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
275 if (initialized) {
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
276 return String.format("DataSection[0x%x]", offset);
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
277 } else {
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
278 return "DataSection[?]";
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
279 }
41b97852175d Implement DataSectionReference.toString.
Roland Schatz <roland.schatz@oracle.com>
parents: 22625
diff changeset
280 }
22054
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
283 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
284 * 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
285 * {@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
286 * {@link JavaConstant} that needs to be patched.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
287 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
288 public static final class DataPatch extends Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
289
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
290 public Reference reference;
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 public DataPatch(int pcOffset, Reference reference) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
293 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
294 this.reference = reference;
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
298 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
299 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
300 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
303 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
304 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
305 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
306 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
307 if (obj instanceof DataPatch) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
308 DataPatch that = (DataPatch) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
309 if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
310 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
311 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
312 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
313 return false;
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 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
316
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
317 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
318 * Provides extra information about instructions or data at specific positions in
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
319 * {@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
320 * enhance a disassembly of the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
321 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
322 public abstract static class CodeAnnotation {
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 public final int position;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
325
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
326 public CodeAnnotation(int position) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
327 this.position = position;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
330 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
331 public final int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
332 throw new UnsupportedOperationException("hashCode");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
333 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
336 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
337 return identityHashCodeString(this);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
338 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
339
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
340 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
341 public abstract boolean equals(Object obj);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
342 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
343
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
344 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
345 * 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
346 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
347 public static final class CodeComment extends CodeAnnotation {
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 public final String value;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
350
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
351 public CodeComment(int position, String comment) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
352 super(position);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
353 this.value = comment;
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
357 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
358 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
359 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
360 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
361 if (obj instanceof CodeComment) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
362 CodeComment that = (CodeComment) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
363 if (this.position == that.position && this.value.equals(that.value)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
364 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
365 }
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 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
368 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
371 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
372 return getClass().getSimpleName() + "@" + position + ": " + value;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
373 }
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
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 * 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
378 * 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
379 * 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
380 * JVM instruction).
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 * 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
383 * inclusive.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
384 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
385 public static final class JumpTable extends CodeAnnotation {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
386
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 * The low value in the key range (inclusive).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
389 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
390 public final int low;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
391
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
392 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
393 * The high value in the key range (inclusive).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
394 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
395 public final int high;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
396
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
397 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
398 * The size (in bytes) of each table entry.
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 public final int entrySize;
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 public JumpTable(int position, int low, int high, int entrySize) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
403 super(position);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
404 this.low = low;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
405 this.high = high;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
406 this.entrySize = entrySize;
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
410 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
411 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
412 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
413 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
414 if (obj instanceof JumpTable) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
415 JumpTable that = (JumpTable) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
416 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
417 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
418 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
419 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
420 return false;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
423 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
424 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
425 return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
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 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
428
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
429 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
430 * 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
431 * code position as well as the caught exception type.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
432 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
433 public static final class ExceptionHandler extends Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
434
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
435 public final int handlerPos;
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 ExceptionHandler(int pcOffset, int handlerPos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
438 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
439 this.handlerPos = handlerPos;
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
443 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
444 return String.format("%d[<exception edge to %d>]", pcOffset, handlerPos);
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
447 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
448 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
449 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
450 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
451 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
452 if (obj instanceof ExceptionHandler) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
453 ExceptionHandler that = (ExceptionHandler) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
454 if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
455 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
456 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
457 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
458 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
459 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
460 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
461
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
462 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
463 * 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
464 * mark can reference other marks.
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 public static final class Mark extends Site {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
467
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
468 public final Object id;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
469
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
470 public Mark(int pcOffset, Object id) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
471 super(pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
472 this.id = id;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
473 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
474
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
475 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
476 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
477 if (id == null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
478 return String.format("%d[<mar>]", pcOffset);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
479 } else if (id instanceof Integer) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
480 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
481 } else {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
482 return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
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 }
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 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
487 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
488 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
489 return true;
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 if (obj instanceof Mark) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
492 Mark that = (Mark) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
493 if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
494 return true;
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 return false;
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 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
500
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
501 private boolean closed;
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
502
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
503 private int entryBCI = -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
504
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
505 private final DataSection dataSection = new DataSection();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
506
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
507 private final List<Infopoint> infopoints = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
508 private final List<DataPatch> dataPatches = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
509 private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
510 private final List<Mark> marks = new ArrayList<>();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
511
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
512 private int totalFrameSize = -1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
513 private int customStackAreaOffset = -1;
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 final String name;
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
518 * The buffer containing the emitted machine code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
519 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
520 private byte[] targetCode;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
521
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
522 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
523 * 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
524 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
525 private int targetCodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
526
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
527 private ArrayList<CodeAnnotation> annotations;
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 private Assumption[] assumptions;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
530
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
531 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
532 * 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
533 * {@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
534 * element of this array is the root method of the compilation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
535 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
536 private ResolvedJavaMethod[] methods;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
537
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
538 private int bytecodeSize;
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 private boolean hasUnsafeAccess;
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 public CompilationResult() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
543 this(null);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
544 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
545
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
546 public CompilationResult(String name) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
547 this.name = name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
548 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
549
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
550 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
551 public int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
552 // CompilationResult instances should not be used as hash map keys
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
553 throw new UnsupportedOperationException("hashCode");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
554 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
555
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
556 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
557 public String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
558 if (methods != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
559 return getClass().getName() + "[" + methods[0].format("%H.%n(%p)%r") + "]";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
560 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
561 return identityHashCodeString(this);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
562 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
563
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
564 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
565 public boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
566 if (this == obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
567 return true;
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 if (obj != null && obj.getClass() == getClass()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
570 CompilationResult that = (CompilationResult) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
571 // @formatter:off
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
572 if (this.entryBCI == that.entryBCI &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
573 this.customStackAreaOffset == that.customStackAreaOffset &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
574 this.totalFrameSize == that.totalFrameSize &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
575 this.targetCodeSize == that.targetCodeSize &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
576 Objects.equals(this.name, that.name) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
577 Objects.equals(this.annotations, that.annotations) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
578 Objects.equals(this.dataSection, that.dataSection) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
579 Objects.equals(this.exceptionHandlers, that.exceptionHandlers) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
580 Objects.equals(this.dataPatches, that.dataPatches) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
581 Objects.equals(this.infopoints, that.infopoints) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
582 Objects.equals(this.marks, that.marks) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
583 Arrays.equals(this.assumptions, that.assumptions) &&
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
584 Arrays.equals(targetCode, that.targetCode)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
585 return true;
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 // @formatter:on
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 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
590 }
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 * @return the entryBCI
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
594 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
595 public int getEntryBCI() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
596 return entryBCI;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
597 }
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 * @param entryBCI the entryBCI to set
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
601 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
602 public void setEntryBCI(int entryBCI) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
603 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
604 this.entryBCI = entryBCI;
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 * Sets 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 void setAssumptions(Assumption[] assumptions) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
611 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
612 this.assumptions = assumptions;
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
616 * Gets the assumptions made during compilation.
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
617 *
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
618 * The caller must not modify the contents of the returned array.
22054
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 Assumption[] getAssumptions() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
621 return assumptions;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
622 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
623
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
624 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
625 * 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
626 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
627 * @param rootMethod the root method of the compilation
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
628 * @param inlinedMethods the methods inlined during compilation
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
629 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
630 public void setMethods(ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
631 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
632 assert rootMethod != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
633 assert inlinedMethods != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
634 if (inlinedMethods.contains(rootMethod)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
635 methods = inlinedMethods.toArray(new ResolvedJavaMethod[inlinedMethods.size()]);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
636 for (int i = 0; i < methods.length; i++) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
637 if (methods[i].equals(rootMethod)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
638 if (i != 0) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
639 ResolvedJavaMethod tmp = methods[0];
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
640 methods[0] = methods[i];
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
641 methods[i] = tmp;
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 break;
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 } else {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
647 methods = new ResolvedJavaMethod[1 + inlinedMethods.size()];
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
648 methods[0] = rootMethod;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
649 int i = 1;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
650 for (ResolvedJavaMethod m : inlinedMethods) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
651 methods[i++] = m;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
652 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
653 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
657 * 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
658 *
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
659 * The caller must not modify the contents of the returned array.
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
660 *
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
661 * @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
662 * 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
663 * being the root method of the compilation
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
664 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
665 public ResolvedJavaMethod[] getMethods() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
666 return methods;
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 public void setBytecodeSize(int bytecodeSize) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
670 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
671 this.bytecodeSize = bytecodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
672 }
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 getBytecodeSize() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
675 return bytecodeSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
676 }
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 public DataSection getDataSection() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
679 return dataSection;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
680 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
681
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 * 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
684 * stack, if any.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
685 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
686 * @return the frame 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 public int getTotalFrameSize() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
689 assert totalFrameSize != -1 : "frame size not yet initialized!";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
690 return totalFrameSize;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
693 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
694 * 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
695 * if any.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
696 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
697 * @param size the size of the frame in bytes
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 public void setTotalFrameSize(int size) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
700 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
701 totalFrameSize = size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
702 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
703
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 * Sets the machine that has been generated by the compiler.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
706 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
707 * @param code the machine code generated
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
708 * @param size the size of the machine code
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
709 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
710 public void setTargetCode(byte[] code, int size) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
711 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
712 targetCode = code;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
713 targetCodeSize = size;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
714 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
717 * 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
718 * {@link DataSectionReference data section} or directly to an {@link ConstantReference inlined
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
719 * constant}.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
720 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
721 * @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
722 * @param ref The reference that should be inserted in the code.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
723 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
724 public void recordDataPatch(int codePos, Reference ref) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
725 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
726 assert codePos >= 0 && ref != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
727 dataPatches.add(new DataPatch(codePos, ref));
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
728 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
731 * Records a call in the code array.
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 * @param codePos the position of the call in the code array
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
734 * @param size the size of the call instruction
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
735 * @param target the being called
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
736 * @param debugInfo the debug info for the call
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
737 * @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
738 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
739 public void recordCall(int codePos, int size, InvokeTarget target, DebugInfo debugInfo, boolean direct) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
740 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
741 final Call call = new Call(target, codePos, size, direct, debugInfo);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
742 addInfopoint(call);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
743 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
746 * Records an exception handler for this method.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
747 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
748 * @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
749 * @param handlerPos the position of the handler
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 public void recordExceptionHandler(int codePos, int handlerPos) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
752 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
753 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
754 exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
757 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
758 * 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
759 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
760 * @param codePos
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
761 * @param handlerPos
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
762 * @return true if the validation is successful
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 private boolean validateExceptionHandlerAdd(int codePos, int handlerPos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
765 ExceptionHandler exHandler = getExceptionHandlerForCodePos(codePos);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
766 return exHandler == null || exHandler.handlerPos == handlerPos;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
769 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
770 * Returns the first ExceptionHandler which matches codePos.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
771 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
772 * @param codePos position to search for
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
773 * @return first matching ExceptionHandler
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 private ExceptionHandler getExceptionHandlerForCodePos(int codePos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
776 for (ExceptionHandler h : exceptionHandlers) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
777 if (h.pcOffset == codePos) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
778 return h;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
779 }
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 return null;
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
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
784 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
785 * Records an infopoint in the code array.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
786 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
787 * @param codePos the position of the infopoint in the code array
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
788 * @param debugInfo the debug info for the infopoint
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
789 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
790 public void recordInfopoint(int codePos, DebugInfo debugInfo, InfopointReason reason) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
791 addInfopoint(new Infopoint(codePos, debugInfo, reason));
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
792 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
793
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
794 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
795 * Records a custom infopoint in the code section.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
796 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
797 * Compiler implementations can use this method to record non-standard infopoints, which are not
22739
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22737
diff changeset
798 * handled by dedicated methods like {@link #recordCall}.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
799 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
800 * @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
801 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
802 public void addInfopoint(Infopoint infopoint) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
803 checkOpen();
22054
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) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
814 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
815 Mark mark = new Mark(codePos, markId);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
816 marks.add(mark);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
817 return mark;
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
821 * Offset in bytes for the custom stack area (relative to sp).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
822 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
823 * @return the offset in bytes
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
824 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
825 public int getCustomStackAreaOffset() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
826 return customStackAreaOffset;
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
830 * @see #getCustomStackAreaOffset()
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
831 * @param offset
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
832 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
833 public void setCustomStackAreaOffset(int offset) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
834 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
835 customStackAreaOffset = offset;
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
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 * @return the machine code generated for this method
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
840 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
841 public byte[] getTargetCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
842 return targetCode;
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
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 * @return the size of the machine code generated for this method
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
847 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
848 public int getTargetCodeSize() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
849 return targetCodeSize;
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
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 * @return the code annotations or {@code null} if there are none
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
854 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
855 public List<CodeAnnotation> getAnnotations() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
856 if (annotations == null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
857 return Collections.emptyList();
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 return annotations;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
860 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
861
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
862 public void addAnnotation(CodeAnnotation annotation) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
863 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
864 assert annotation != null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
865 if (annotations == null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
866 annotations = new ArrayList<>();
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 annotations.add(annotation);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
869 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
870
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
871 private static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
872 if (info != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
873 ReferenceMap refMap = info.getReferenceMap();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
874 if (refMap != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
875 sb.append(refMap.toString());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
876 sb.append(']');
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
877 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
878 RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
879 if (calleeSaveInfo != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
880 sb.append(" callee-save-info[");
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
881 String sep = "";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
882 for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
883 sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
884 sep = ", ";
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
885 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
886 sb.append(']');
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
887 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
888 BytecodePosition codePos = info.getBytecodePosition();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
889 if (codePos != null) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
890 MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
891 if (info.hasFrame()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
892 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
893 if (info.frame().numLocks > 0) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
894 sb.append(" #locks=").append(info.frame().numLocks);
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 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
902 * @return the list of infopoints, sorted by {@link Site#pcOffset}
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
903 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
904 public List<Infopoint> getInfopoints() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
905 if (infopoints.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
906 return emptyList();
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 return unmodifiableList(infopoints);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
909 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
912 * @return the list of data references
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
913 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
914 public List<DataPatch> getDataPatches() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
915 if (dataPatches.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
916 return emptyList();
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 return unmodifiableList(dataPatches);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
919 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
922 * @return the list of exception handlers
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
923 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
924 public List<ExceptionHandler> getExceptionHandlers() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
925 if (exceptionHandlers.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
926 return emptyList();
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 return unmodifiableList(exceptionHandlers);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
929 }
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 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
932 * @return the list of marks
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
933 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
934 public List<Mark> getMarks() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
935 if (marks.isEmpty()) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
936 return emptyList();
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 return unmodifiableList(marks);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
939 }
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 public String getName() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
942 return name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
943 }
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 public void setHasUnsafeAccess(boolean hasUnsafeAccess) {
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
946 checkOpen();
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
947 this.hasUnsafeAccess = 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 boolean hasUnsafeAccess() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
951 return hasUnsafeAccess;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
952 }
22740
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
953
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
954 /**
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
955 * Clears the information in this object pertaining to generating code. That is, the
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
956 * {@linkplain #getMarks() marks}, {@linkplain #getInfopoints() infopoints},
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
957 * {@linkplain #getExceptionHandlers() exception handlers}, {@linkplain #getDataPatches() data
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
958 * patches} and {@linkplain #getAnnotations() annotations} recorded in this object are cleared.
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
959 */
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
960 public void resetForEmittingCode() {
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
961 checkOpen();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
962 infopoints.clear();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
963 dataPatches.clear();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
964 exceptionHandlers.clear();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
965 marks.clear();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
966 dataSection.clear();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
967 if (annotations != null) {
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
968 annotations.clear();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
969 }
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
970 }
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
971
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
972 private void checkOpen() {
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
973 if (closed) {
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
974 throw new IllegalStateException();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
975 }
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
976 }
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
977
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
978 /**
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
979 * Closes this compilation result to future updates.
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
980 */
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
981 public void close() {
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
982 if (closed) {
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
983 throw new IllegalStateException("Cannot re-close compilation result " + this);
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
984 }
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
985 dataSection.close();
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
986 closed = true;
22110ef74a40 8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents: 22739
diff changeset
987 }
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
988 }