Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java @ 2516:a384fac3fd34
Removed anything OSR-related.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 27 Apr 2011 15:49:27 +0200 |
parents | 4fdef1464592 |
children | 274360f98f97 |
comparison
equal
deleted
inserted
replaced
2515:4fdef1464592 | 2516:a384fac3fd34 |
---|---|
51 public final CiTarget target; | 51 public final CiTarget target; |
52 public final RiRuntime runtime; | 52 public final RiRuntime runtime; |
53 public final RiMethod method; | 53 public final RiMethod method; |
54 public final RiRegisterConfig registerConfig; | 54 public final RiRegisterConfig registerConfig; |
55 public final CiStatistics stats; | 55 public final CiStatistics stats; |
56 public final int osrBCI; | |
57 public final CiAssumptions assumptions = new CiAssumptions(); | 56 public final CiAssumptions assumptions = new CiAssumptions(); |
58 public final FrameState placeholderState; | 57 public final FrameState placeholderState; |
59 | 58 |
60 private boolean hasExceptionHandlers; | 59 private boolean hasExceptionHandlers; |
61 private final C1XCompilation parent; | 60 private final C1XCompilation parent; |
82 * @param method the method to be compiled or {@code null} if generating code for a stub | 81 * @param method the method to be compiled or {@code null} if generating code for a stub |
83 * @param osrBCI the bytecode index for on-stack replacement, if requested | 82 * @param osrBCI the bytecode index for on-stack replacement, if requested |
84 * @param stats externally supplied statistics object to be used if not {@code null} | 83 * @param stats externally supplied statistics object to be used if not {@code null} |
85 */ | 84 */ |
86 public C1XCompilation(C1XCompiler compiler, RiMethod method, int osrBCI, CiStatistics stats) { | 85 public C1XCompilation(C1XCompiler compiler, RiMethod method, int osrBCI, CiStatistics stats) { |
86 if (osrBCI != -1) { | |
87 throw new CiBailout("No OSR supported"); | |
88 } | |
87 this.parent = currentCompilation.get(); | 89 this.parent = currentCompilation.get(); |
88 currentCompilation.set(this); | 90 currentCompilation.set(this); |
89 this.compiler = compiler; | 91 this.compiler = compiler; |
90 this.target = compiler.target; | 92 this.target = compiler.target; |
91 this.runtime = compiler.runtime; | 93 this.runtime = compiler.runtime; |
92 this.method = method; | 94 this.method = method; |
93 this.osrBCI = osrBCI; | |
94 this.stats = stats == null ? new CiStatistics() : stats; | 95 this.stats = stats == null ? new CiStatistics() : stats; |
95 this.registerConfig = method == null ? compiler.globalStubRegisterConfig : runtime.getRegisterConfig(method); | 96 this.registerConfig = method == null ? compiler.globalStubRegisterConfig : runtime.getRegisterConfig(method); |
96 this.placeholderState = method != null && method.minimalDebugInfo() ? new MutableFrameState(new IRScope(null, null, method, -1), 0, 0, 0) : null; | 97 this.placeholderState = method != null && method.minimalDebugInfo() ? new MutableFrameState(new IRScope(null, null, method, -1), 0, 0, 0) : null; |
97 | 98 |
98 if (compiler.isObserved()) { | 99 if (compiler.isObserved()) { |
111 /** | 112 /** |
112 * Records that this compilation has exception handlers. | 113 * Records that this compilation has exception handlers. |
113 */ | 114 */ |
114 public void setHasExceptionHandlers() { | 115 public void setHasExceptionHandlers() { |
115 hasExceptionHandlers = true; | 116 hasExceptionHandlers = true; |
116 } | |
117 | |
118 /** | |
119 * Checks whether this compilation is for an on-stack replacement. | |
120 * | |
121 * @return {@code true} if this compilation is for an on-stack replacement | |
122 */ | |
123 public boolean isOsrCompilation() { | |
124 return osrBCI >= 0; | |
125 } | 117 } |
126 | 118 |
127 /** | 119 /** |
128 * Translates a given kind to a canonical architecture kind. | 120 * Translates a given kind to a canonical architecture kind. |
129 * This is an identity function for all but {@link CiKind#Word} | 121 * This is an identity function for all but {@link CiKind#Word} |
144 public boolean archKindsEqual(CiKind kind1, CiKind kind2) { | 136 public boolean archKindsEqual(CiKind kind1, CiKind kind2) { |
145 return archKind(kind1) == archKind(kind2); | 137 return archKind(kind1) == archKind(kind2); |
146 } | 138 } |
147 | 139 |
148 /** | 140 /** |
149 * Gets the frame which describes the layout of the OSR interpreter frame for this method. | |
150 * | |
151 * @return the OSR frame | |
152 */ | |
153 public RiOsrFrame getOsrFrame() { | |
154 return runtime.getOsrFrame(method, osrBCI); | |
155 } | |
156 | |
157 /** | |
158 * Records an assumption that the specified type has no finalizable subclasses. | 141 * Records an assumption that the specified type has no finalizable subclasses. |
159 * | 142 * |
160 * @param receiverType the type that is assumed to have no finalizable subclasses | 143 * @param receiverType the type that is assumed to have no finalizable subclasses |
161 * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise | 144 * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise |
162 */ | 145 */ |
169 * | 152 * |
170 * @return a string representation of this compilation | 153 * @return a string representation of this compilation |
171 */ | 154 */ |
172 @Override | 155 @Override |
173 public String toString() { | 156 public String toString() { |
174 if (isOsrCompilation()) { | |
175 return "osr-compile @ " + osrBCI + ": " + method; | |
176 } | |
177 return "compile: " + method; | 157 return "compile: " + method; |
178 } | 158 } |
179 | 159 |
180 /** | 160 /** |
181 * Builds the block map for the specified method. | 161 * Builds the block map for the specified method. |
182 * | 162 * |
183 * @param method the method for which to build the block map | 163 * @param method the method for which to build the block map |
184 * @param osrBCI the OSR bytecode index; {@code -1} if this is not an OSR | 164 * @param osrBCI the OSR bytecode index; {@code -1} if this is not an OSR |
185 * @return the block map for the specified method | 165 * @return the block map for the specified method |
186 */ | 166 */ |
187 public BlockMap getBlockMap(RiMethod method, int osrBCI) { | 167 public BlockMap getBlockMap(RiMethod method) { |
188 // PERF: cache the block map for methods that are compiled or inlined often | 168 // PERF: cache the block map for methods that are compiled or inlined often |
189 BlockMap map = new BlockMap(method, hir.numberOfBlocks()); | 169 BlockMap map = new BlockMap(method, hir.numberOfBlocks()); |
190 boolean isOsrCompilation = false; | 170 if (!map.build(C1XOptions.PhiLoopStores)) { |
191 if (osrBCI >= 0) { | |
192 map.addEntrypoint(osrBCI, BlockBegin.BlockFlag.OsrEntry); | |
193 isOsrCompilation = true; | |
194 } | |
195 if (!map.build(!isOsrCompilation && C1XOptions.PhiLoopStores)) { | |
196 throw new CiBailout("build of BlockMap failed for " + method); | 171 throw new CiBailout("build of BlockMap failed for " + method); |
197 } else { | 172 } else { |
198 if (compiler.isObserved()) { | 173 if (compiler.isObserved()) { |
199 String label = CiUtil.format("BlockListBuilder %f %r %H.%n(%p)", method, true); | 174 String label = CiUtil.format("BlockListBuilder %f %r %H.%n(%p)", method, true); |
200 compiler.fireCompilationEvent(new CompilationEvent(this, label, map, method.code().length)); | 175 compiler.fireCompilationEvent(new CompilationEvent(this, label, map, method.code().length)); |