author | dlong |
Tue, 24 Sep 2019 12:47:15 -0400 | |
changeset 58299 | 6df94ce3ab2f |
parent 58040 | d99af76d7689 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
43972 | 1 |
/* |
58299 | 2 |
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. |
43972 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
50858 | 23 |
|
24 |
||
43972 | 25 |
package org.graalvm.compiler.hotspot.aarch64; |
26 |
||
27 |
import static jdk.vm.ci.aarch64.AArch64.r0; |
|
28 |
import static jdk.vm.ci.aarch64.AArch64.r3; |
|
29 |
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall; |
|
30 |
import static jdk.vm.ci.meta.Value.ILLEGAL; |
|
46344 | 31 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS; |
58040
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
52910
diff
changeset
|
32 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.NOT_REEXECUTABLE; |
58299 | 33 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS; |
46344 | 34 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF; |
50858 | 35 |
import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C; |
46344 | 36 |
import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32; |
49873 | 37 |
import static jdk.internal.vm.compiler.word.LocationIdentity.any; |
43972 | 38 |
|
39 |
import org.graalvm.compiler.core.common.LIRKind; |
|
46344 | 40 |
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
43972 | 41 |
import org.graalvm.compiler.hotspot.HotSpotBackend; |
42 |
import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl; |
|
43 |
import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; |
|
44 |
import org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider; |
|
45 |
import org.graalvm.compiler.hotspot.meta.HotSpotProviders; |
|
46344 | 46 |
import org.graalvm.compiler.options.OptionValues; |
43972 | 47 |
import org.graalvm.compiler.word.WordTypes; |
48 |
||
49 |
import jdk.vm.ci.code.CallingConvention; |
|
50 |
import jdk.vm.ci.code.CodeCacheProvider; |
|
51 |
import jdk.vm.ci.code.RegisterValue; |
|
52 |
import jdk.vm.ci.code.TargetDescription; |
|
50858 | 53 |
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
43972 | 54 |
import jdk.vm.ci.meta.MetaAccessProvider; |
55 |
import jdk.vm.ci.meta.PlatformKind; |
|
56 |
import jdk.vm.ci.meta.Value; |
|
57 |
||
58 |
public class AArch64HotSpotForeignCallsProvider extends HotSpotHostForeignCallsProvider { |
|
59 |
||
60 |
private final Value[] nativeABICallerSaveRegisters; |
|
61 |
||
50858 | 62 |
public AArch64HotSpotForeignCallsProvider(HotSpotJVMCIRuntime jvmciRuntime, HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, |
43972 | 63 |
WordTypes wordTypes, Value[] nativeABICallerSaveRegisters) { |
64 |
super(jvmciRuntime, runtime, metaAccess, codeCache, wordTypes); |
|
65 |
this.nativeABICallerSaveRegisters = nativeABICallerSaveRegisters; |
|
66 |
} |
|
67 |
||
68 |
@Override |
|
46344 | 69 |
public void initialize(HotSpotProviders providers, OptionValues options) { |
43972 | 70 |
GraalHotSpotVMConfig config = runtime.getVMConfig(); |
71 |
TargetDescription target = providers.getCodeCache().getTarget(); |
|
72 |
PlatformKind word = target.arch.getWordKind(); |
|
73 |
||
74 |
// The calling convention for the exception handler stub is (only?) defined in |
|
75 |
// TemplateInterpreterGenerator::generate_throw_exception() |
|
76 |
RegisterValue exception = r0.asValue(LIRKind.reference(word)); |
|
77 |
RegisterValue exceptionPc = r3.asValue(LIRKind.value(word)); |
|
78 |
CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc); |
|
58299 | 79 |
register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER, 0L, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF, NOT_REEXECUTABLE, exceptionCc, null, any())); |
80 |
register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF, NOT_REEXECUTABLE, exceptionCc, |
|
81 |
null, |
|
82 |
any())); |
|
43972 | 83 |
|
84 |
// These stubs do callee saving |
|
85 |
if (config.useCRC32Intrinsics) { |
|
58299 | 86 |
registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, LEAF, NOT_REEXECUTABLE, any()); |
43972 | 87 |
} |
48398 | 88 |
if (config.useCRC32CIntrinsics) { |
58299 | 89 |
registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, LEAF, NOT_REEXECUTABLE, any()); |
48398 | 90 |
} |
43972 | 91 |
|
46344 | 92 |
super.initialize(providers, options); |
43972 | 93 |
} |
94 |
||
95 |
@Override |
|
96 |
public Value[] getNativeABICallerSaveRegisters() { |
|
97 |
return nativeABICallerSaveRegisters; |
|
98 |
} |
|
99 |
||
100 |
} |