Mercurial > hg > truffle
comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java @ 15011:c8e575742f36
allow compilation with custom RegisterConfig
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Mon, 07 Apr 2014 19:21:22 +0200 |
parents | 883fbd3e06e0 |
children | 2c940b1a48d8 |
comparison
equal
deleted
inserted
replaced
15010:f36e56e9dd9a | 15011:c8e575742f36 |
---|---|
22 */ | 22 */ |
23 package com.oracle.graal.hotspot.stubs; | 23 package com.oracle.graal.hotspot.stubs; |
24 | 24 |
25 import static com.oracle.graal.compiler.GraalCompiler.*; | 25 import static com.oracle.graal.compiler.GraalCompiler.*; |
26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; | 26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
27 import static com.oracle.graal.phases.GraalOptions.*; | |
27 | 28 |
28 import java.util.*; | 29 import java.util.*; |
29 | 30 |
30 import com.oracle.graal.api.code.*; | 31 import com.oracle.graal.api.code.*; |
31 import com.oracle.graal.api.meta.*; | 32 import com.oracle.graal.api.meta.*; |
39 import com.oracle.graal.hotspot.meta.*; | 40 import com.oracle.graal.hotspot.meta.*; |
40 import com.oracle.graal.hotspot.nodes.*; | 41 import com.oracle.graal.hotspot.nodes.*; |
41 import com.oracle.graal.lir.asm.*; | 42 import com.oracle.graal.lir.asm.*; |
42 import com.oracle.graal.nodes.*; | 43 import com.oracle.graal.nodes.*; |
43 import com.oracle.graal.phases.*; | 44 import com.oracle.graal.phases.*; |
45 import com.oracle.graal.phases.schedule.*; | |
44 | 46 |
45 //JaCoCo Exclude | 47 //JaCoCo Exclude |
46 | 48 |
47 /** | 49 /** |
48 * Base class for implementing some low level code providing the out-of-line slow path for a snippet | 50 * Base class for implementing some low level code providing the out-of-line slow path for a snippet |
106 */ | 108 */ |
107 public HotSpotForeignCallLinkage getLinkage() { | 109 public HotSpotForeignCallLinkage getLinkage() { |
108 return linkage; | 110 return linkage; |
109 } | 111 } |
110 | 112 |
113 public RegisterConfig getRegisterConfig() { | |
114 return null; | |
115 } | |
116 | |
111 /** | 117 /** |
112 * Gets the graph that from which the code for this stub will be compiled. | 118 * Gets the graph that from which the code for this stub will be compiled. |
113 */ | 119 */ |
114 protected abstract StructuredGraph getGraph(); | 120 protected abstract StructuredGraph getGraph(); |
115 | 121 |
143 } | 149 } |
144 | 150 |
145 CodeCacheProvider codeCache = providers.getCodeCache(); | 151 CodeCacheProvider codeCache = providers.getCodeCache(); |
146 // The stub itself needs the incoming calling convention. | 152 // The stub itself needs the incoming calling convention. |
147 CallingConvention incomingCc = linkage.getIncomingCallingConvention(); | 153 CallingConvention incomingCc = linkage.getIncomingCallingConvention(); |
148 final CompilationResult compResult = compileGraph(graph, Stub.this, incomingCc, getInstalledCodeOwner(), providers, backend, codeCache.getTarget(), null, | 154 TargetDescription target = codeCache.getTarget(); |
149 providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), null, providers.getSuites().getDefaultSuites(), | 155 |
150 new CompilationResult(), CompilationResultBuilderFactory.Default); | 156 final CompilationResult compResult = new CompilationResult(); |
157 try (Scope s0 = Debug.scope("StubCompilation", graph, providers.getCodeCache())) { | |
158 Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); | |
159 SchedulePhase schedule = emitFrontEnd(providers, target, graph, assumptions, null, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, | |
160 getProfilingInfo(graph), null, providers.getSuites().getDefaultSuites()); | |
161 emitBackEnd(graph, Stub.this, incomingCc, getInstalledCodeOwner(), backend, target, compResult, CompilationResultBuilderFactory.Default, assumptions, schedule, getRegisterConfig()); | |
162 } catch (Throwable e) { | |
163 throw Debug.handle(e); | |
164 } | |
151 | 165 |
152 assert destroyedRegisters != null; | 166 assert destroyedRegisters != null; |
153 try (Scope s = Debug.scope("CodeInstall")) { | 167 try (Scope s = Debug.scope("CodeInstall")) { |
154 Stub stub = Stub.this; | 168 Stub stub = Stub.this; |
155 HotSpotRuntimeStub installedCode = new HotSpotRuntimeStub(stub); | 169 HotSpotRuntimeStub installedCode = new HotSpotRuntimeStub(stub); |