Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/mx.compiler/mx_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,8 @@ def __init__(self, option_strings, nargs=None, **kwargs):
def __call__(self, parser, namespace, values, option_string=None):
# do not override existing values
old_values = getattr(namespace, self.dest)
# shlex.split interprets '\' as an escape char so it needs to be escaped itself
values = values.replace("\\", "\\\\")
setattr(namespace, self.dest, (old_values if old_values else []) + shlex.split(values))

mx_gate.add_gate_runner(_suite, _graal_gate_runner)
Expand Down
2 changes: 1 addition & 1 deletion compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
],
"requiresConcealed" : {
"java.base" : [
"jdk.internal.misc",
"jdk.internal.misc"
],
"jdk.internal.vm.ci" : [
"jdk.vm.ci.meta",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ protected PhaseSuite<HighTierContext> getDefaultGraphBuilderSuite() {
}

protected LIRSuites getLIRSuites() {
return request.lirSuites;
return request.lirSuites();
}

private Request<CompilationResult> request;
Expand All @@ -325,15 +325,15 @@ protected final void prepareRequest() {
ResolvedJavaMethod installedCodeOwner = graph.method();
request = new Request<>(graph, installedCodeOwner, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL,
graph.getProfilingInfo(), createSuites(getOptions()), createLIRSuites(getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default,
null, true);
null, null, true);
}

/**
* Executes the high-level (FrontEnd) part of the compiler.
*/
protected final void emitFrontEnd() {
GraalCompiler.emitFrontEnd(request.providers, request.backend, request.graph, request.graphBuilderSuite, request.optimisticOpts, request.profilingInfo, request.suites);
request.graph.freeze();
GraalCompiler.emitFrontEnd(request.providers(), request.backend(), request.graph(), request.graphBuilderSuite(), request.optimisticOpts(), request.profilingInfo(), request.suites());
request.graph().freeze();
}

/**
Expand Down Expand Up @@ -364,24 +364,24 @@ protected final void generateLIR() {
* Sets up {@link LIR} generation.
*/
protected final void preLIRGeneration() {
assert request.graph.isFrozen() : "Graph not frozen.";
assert request.graph().isFrozen() : "Graph not frozen.";
Object stub = null;
schedule = request.graph.getLastSchedule();
schedule = request.graph().getLastSchedule();
ControlFlowGraph cfg = deepCopy(schedule.getCFG());
HIRBlock[] blocks = cfg.getBlocks();
HIRBlock startBlock = cfg.getStartBlock();
assert startBlock != null;
assert startBlock.getPredecessorCount() == 0;

blockOrder = request.backend.newBlockOrder(blocks.length, startBlock);
blockOrder = request.backend().newBlockOrder(blocks.length, startBlock);
linearScanOrder = LinearScanOrder.computeLinearScanOrder(blocks.length, startBlock);

LIR lir = new LIR(cfg, linearScanOrder, getGraphOptions(), getGraphDebug());
LIRGenerationProvider lirBackend = (LIRGenerationProvider) request.backend;
RegisterAllocationConfig registerAllocationConfig = request.backend.newRegisterAllocationConfig(registerConfig, null, stub);
lirGenRes = lirBackend.newLIRGenerationResult(graph.compilationId(), lir, registerAllocationConfig, request.graph, stub);
LIRGenerationProvider lirBackend = (LIRGenerationProvider) request.backend();
RegisterAllocationConfig registerAllocationConfig = request.backend().newRegisterAllocationConfig(registerConfig, null, stub);
lirGenRes = lirBackend.newLIRGenerationResult(graph.compilationId(), lir, registerAllocationConfig, request.graph(), stub);
lirGenTool = lirBackend.newLIRGenerator(lirGenRes);
nodeLirGen = lirBackend.newNodeLIRBuilder(request.graph, lirGenTool);
nodeLirGen = lirBackend.newNodeLIRBuilder(request.graph(), lirGenTool);
}

protected OptionValues getGraphOptions() {
Expand All @@ -401,8 +401,8 @@ private static ControlFlowGraph deepCopy(ControlFlowGraph cfg) {
* Executes the {@link LIRGenerationPhase}.
*/
protected final void lirGeneration() {
LIRGenerationContext context = new LIRGenerationContext(lirGenTool, nodeLirGen, request.graph, schedule);
new LIRGenerationPhase().apply(request.backend.getTarget(), lirGenRes, context);
LIRGenerationContext context = new LIRGenerationContext(lirGenTool, nodeLirGen, request.graph(), schedule);
new LIRGenerationPhase().apply(request.backend().getTarget(), lirGenRes, context);
}

/**
Expand All @@ -418,7 +418,7 @@ protected final void emitLowLevel() {
* Executes a {@link LIRPhase} within a given {@code context}.
*/
protected <C> void applyLIRPhase(LIRPhase<C> phase, C context) {
phase.apply(request.backend.getTarget(), lirGenRes, context);
phase.apply(request.backend().getTarget(), lirGenRes, context);
}

/**
Expand Down Expand Up @@ -464,12 +464,12 @@ protected PostAllocationOptimizationContext createPostAllocationOptimizationCont
* Emits the machine code.
*/
protected final void emitCode() {
int bytecodeSize = request.graph.method() == null ? 0 : request.graph.getBytecodeSize();
int bytecodeSize = request.graph().method() == null ? 0 : request.graph().getBytecodeSize();
SpeculationLog speculationLog = null;
request.compilationResult.setHasUnsafeAccess(request.graph.hasUnsafeAccess());
LIRCompilerBackend.emitCode(request.backend, request.graph.getAssumptions(), request.graph.method(), request.graph.getMethods(), speculationLog,
bytecodeSize, lirGenRes, request.compilationResult,
request.installedCodeOwner, request.factory, request.entryPointDecorator);
request.compilationResult().setHasUnsafeAccess(request.graph().hasUnsafeAccess());
LIRCompilerBackend.emitCode(request.backend(), request.graph().getAssumptions(), request.graph().method(), request.graph().getMethods(), speculationLog,
bytecodeSize, lirGenRes, request.compilationResult(),
request.installedCodeOwner(), request.factory(), request.entryPointDecorator());
}

protected StructuredGraph graph() {
Expand All @@ -495,7 +495,7 @@ public void setup() {
public CompilationResult compile() {
emitFrontEnd();
emitBackEnd();
return super.request.compilationResult;
return super.request.compilationResult();
}

}
Expand Down Expand Up @@ -538,7 +538,7 @@ public void setupGraph() {

public CompilationResult compile() {
emitBackEnd();
return super.request.compilationResult;
return super.request.compilationResult();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ private void createFiles(MatchRuleDescriptor info) {
out.println("import jdk.graal.compiler.core.match.*;");
out.println("import jdk.graal.compiler.core.gen.NodeMatchRules;");
out.println("import jdk.graal.compiler.graph.Position;");

for (String p : info.requiredPackages) {
if (p.equals(pkg)) {
continue;
Expand Down Expand Up @@ -593,6 +594,17 @@ private void createFiles(MatchRuleDescriptor info) {

out.println();

out.println(" @Override");
out.println(" public String getArchitecture() {");
String archStr = topDeclaringClass.toString().replace("NodeMatchRules", "");
if (!archStr.equals("AMD64")) {
// The AMD64 JVMCI class is the exception in terms of using an uppercase value
// for the name field.
archStr = archStr.toLowerCase();
}
out.println(" return " + '"' + archStr + "\";");
out.println(" }");

out.println("}");
}
this.createProviderFile(pkg + "." + matchStatementClassName, "jdk.graal.compiler.core.match.MatchStatementSet", originatingElements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ protected CompilationResult compile(ResolvedJavaMethod installedCodeOwner, Struc
}

Request<CompilationResult> request = new Request<>(graphToCompile, installedCodeOwner, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), getOptimisticOptimizations(),
graphToCompile.getProfilingInfo(), suites, createLIRSuites(options), compilationResult, CompilationResultBuilderFactory.Default, null, true);
graphToCompile.getProfilingInfo(), suites, createLIRSuites(options), compilationResult, CompilationResultBuilderFactory.Default, null, null, true);
CompilationResult result = GraalCompiler.compile(request);
graphToCompile.getOptimizationLog().emit(new StableMethodNameFormatter(getDefaultGraphBuilderPhase(), getProviders(), graphToCompile.getDebug()));
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,24 @@
*/
package jdk.graal.compiler.core.test;

import static jdk.graal.compiler.core.GraalCompiler.compileGraph;
import static jdk.graal.compiler.core.common.GraalOptions.OptAssumptions;
import static org.junit.Assert.assertNotNull;

import jdk.graal.compiler.code.CompilationResult;
import jdk.graal.compiler.core.GraalCompiler;
import jdk.graal.compiler.core.target.Backend;
import jdk.graal.compiler.lir.asm.CompilationResultBuilderFactory;
import jdk.graal.compiler.lir.phases.LIRSuites;
import jdk.graal.compiler.nodes.FullInfopointNode;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.StructuredGraph.AllowAssumptions;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
import jdk.graal.compiler.phases.OptimisticOptimizations;
import jdk.graal.compiler.phases.PhaseSuite;
import jdk.graal.compiler.phases.tiers.HighTierContext;
import jdk.graal.compiler.phases.tiers.Suites;
import jdk.graal.compiler.phases.util.Providers;
import jdk.vm.ci.meta.ProfilingInfo;
import org.junit.Test;

import jdk.vm.ci.code.site.Call;
Expand Down Expand Up @@ -70,8 +75,25 @@ public String testMethod() {
public void callInfopoints() {
final ResolvedJavaMethod method = getResolvedJavaMethod("testMethod");
final StructuredGraph graph = parseEager(method, AllowAssumptions.YES);
final CompilationResult cr = compileGraph(graph, graph.method(), getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, graph.getProfilingInfo(),
createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default, true);
Providers providers = getProviders();
Backend backend = getBackend();
PhaseSuite<HighTierContext> graphBuilderSuite = getDefaultGraphBuilderSuite();
ProfilingInfo profilingInfo = graph.getProfilingInfo();
Suites suites = createSuites(graph.getOptions());
LIRSuites lirSuites = createLIRSuites(graph.getOptions());
CompilationResult compilationResult = new CompilationResult(graph.compilationId());
final CompilationResult cr = GraalCompiler.compile(new GraalCompiler.Request<>(graph,
graph.method(),
providers,
backend,
graphBuilderSuite,
OptimisticOptimizations.ALL,
profilingInfo,
suites,
lirSuites,
compilationResult,
CompilationResultBuilderFactory.Default,
true));
for (Infopoint sp : cr.getInfopoints()) {
assertNotNull(sp.reason);
if (sp instanceof Call) {
Expand All @@ -92,8 +114,24 @@ public void lineInfopoints() {
}
assertTrue(graphLineSPs > 0);
PhaseSuite<HighTierContext> graphBuilderSuite = getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withFullInfopoints(true));
final CompilationResult cr = compileGraph(graph, graph.method(), getProviders(), getBackend(), graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(),
createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default, true);
Providers providers = getProviders();
Backend backend = getBackend();
ProfilingInfo profilingInfo = graph.getProfilingInfo();
Suites suites = createSuites(graph.getOptions());
LIRSuites lirSuites = createLIRSuites(graph.getOptions());
CompilationResult compilationResult = new CompilationResult(graph.compilationId());
final CompilationResult cr = GraalCompiler.compile(new GraalCompiler.Request<>(graph,
graph.method(),
providers,
backend,
graphBuilderSuite,
OptimisticOptimizations.ALL,
profilingInfo,
suites,
lirSuites,
compilationResult,
CompilationResultBuilderFactory.Default,
true));
int lineSPs = 0;
for (Infopoint sp : cr.getInfopoints()) {
assertNotNull(sp.reason);
Expand Down
Loading