1 /* |
1 /* |
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
42 import org.graalvm.compiler.asm.aarch64.AArch64Assembler; |
42 import org.graalvm.compiler.asm.aarch64.AArch64Assembler; |
43 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler; |
43 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler; |
44 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister; |
44 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister; |
45 import org.graalvm.compiler.code.CompilationResult; |
45 import org.graalvm.compiler.code.CompilationResult; |
46 import org.graalvm.compiler.core.aarch64.AArch64NodeMatchRules; |
46 import org.graalvm.compiler.core.aarch64.AArch64NodeMatchRules; |
47 import org.graalvm.compiler.core.common.CompilationIdentifier; |
|
48 import org.graalvm.compiler.core.common.LIRKind; |
47 import org.graalvm.compiler.core.common.LIRKind; |
49 import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig; |
48 import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig; |
50 import org.graalvm.compiler.core.common.spi.ForeignCallLinkage; |
49 import org.graalvm.compiler.core.common.spi.ForeignCallLinkage; |
51 import org.graalvm.compiler.core.gen.LIRGenerationProvider; |
50 import org.graalvm.compiler.core.gen.LIRGenerationProvider; |
52 import org.graalvm.compiler.debug.DebugContext; |
51 import org.graalvm.compiler.debug.DebugContext; |
87 import jdk.vm.ci.hotspot.HotSpotSentinelConstant; |
86 import jdk.vm.ci.hotspot.HotSpotSentinelConstant; |
88 import jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig; |
87 import jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig; |
89 import jdk.vm.ci.meta.JavaKind; |
88 import jdk.vm.ci.meta.JavaKind; |
90 import jdk.vm.ci.meta.JavaType; |
89 import jdk.vm.ci.meta.JavaType; |
91 import jdk.vm.ci.meta.ResolvedJavaMethod; |
90 import jdk.vm.ci.meta.ResolvedJavaMethod; |
92 |
|
93 import sun.misc.Unsafe; |
91 import sun.misc.Unsafe; |
94 |
92 |
95 /** |
93 /** |
96 * HotSpot AArch64 specific backend. |
94 * HotSpot AArch64 specific backend. |
97 */ |
95 */ |
99 |
97 |
100 public AArch64HotSpotBackend(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) { |
98 public AArch64HotSpotBackend(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) { |
101 super(config, runtime, providers); |
99 super(config, runtime, providers); |
102 } |
100 } |
103 |
101 |
104 private FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) { |
102 @Override |
|
103 protected FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) { |
105 RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; |
104 RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; |
106 FrameMap frameMap = new AArch64FrameMap(getCodeCache(), registerConfigNonNull, this); |
105 FrameMap frameMap = new AArch64FrameMap(getCodeCache(), registerConfigNonNull, this); |
107 return new AArch64FrameMapBuilder(frameMap, getCodeCache(), registerConfigNonNull); |
106 return new AArch64FrameMapBuilder(frameMap, getCodeCache(), registerConfigNonNull); |
108 } |
107 } |
109 |
108 |
110 @Override |
109 @Override |
111 public LIRGeneratorTool newLIRGenerator(LIRGenerationResult lirGenRes) { |
110 public LIRGeneratorTool newLIRGenerator(LIRGenerationResult lirGenRes) { |
112 return new AArch64HotSpotLIRGenerator(getProviders(), config, lirGenRes); |
111 return new AArch64HotSpotLIRGenerator(getProviders(), config, lirGenRes); |
113 } |
|
114 |
|
115 @Override |
|
116 public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, RegisterConfig registerConfig, StructuredGraph graph, Object stub) { |
|
117 return new HotSpotLIRGenerationResult(compilationId, lir, newFrameMapBuilder(registerConfig), makeCallingConvention(graph, (Stub) stub), stub, |
|
118 config.requiresReservedStackCheck(graph.getMethods())); |
|
119 } |
112 } |
120 |
113 |
121 @Override |
114 @Override |
122 public NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen) { |
115 public NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen) { |
123 return new AArch64HotSpotNodeLIRBuilder(graph, lirGen, new AArch64NodeMatchRules(lirGen)); |
116 return new AArch64HotSpotNodeLIRBuilder(graph, lirGen, new AArch64NodeMatchRules(lirGen)); |
282 if (deoptimizationRescueSlot != null && stub == null) { |
275 if (deoptimizationRescueSlot != null && stub == null) { |
283 crb.compilationResult.setCustomStackAreaOffset(deoptimizationRescueSlot); |
276 crb.compilationResult.setCustomStackAreaOffset(deoptimizationRescueSlot); |
284 } |
277 } |
285 |
278 |
286 if (stub != null) { |
279 if (stub != null) { |
287 EconomicSet<Register> destroyedCallerRegisters = gatherDestroyedCallerRegisters(lir); |
280 updateStub(stub, gen, frameMap); |
288 updateStub(stub, destroyedCallerRegisters, gen.getCalleeSaveInfo(), frameMap); |
|
289 } |
281 } |
290 return crb; |
282 return crb; |
291 } |
283 } |
292 |
284 |
293 @Override |
285 @Override |