author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58299 | 6df94ce3ab2f |
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.sparc; |
26 |
||
27 |
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall; |
|
28 |
import static jdk.vm.ci.meta.Value.ILLEGAL; |
|
29 |
import static jdk.vm.ci.sparc.SPARC.i0; |
|
30 |
import static jdk.vm.ci.sparc.SPARC.i1; |
|
31 |
import static jdk.vm.ci.sparc.SPARC.o0; |
|
32 |
import static jdk.vm.ci.sparc.SPARC.o1; |
|
46344 | 33 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER; |
34 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER; |
|
35 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS; |
|
58299 | 36 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS; |
58040
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
54601
diff
changeset
|
37 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.NOT_REEXECUTABLE; |
54601 | 38 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO; |
50858 | 39 |
import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C; |
46344 | 40 |
import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32; |
49873 | 41 |
import static jdk.internal.vm.compiler.word.LocationIdentity.any; |
43972 | 42 |
|
43 |
import org.graalvm.compiler.core.common.LIRKind; |
|
46344 | 44 |
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
43972 | 45 |
import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl; |
46 |
import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; |
|
47 |
import org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider; |
|
48 |
import org.graalvm.compiler.hotspot.meta.HotSpotProviders; |
|
46344 | 49 |
import org.graalvm.compiler.options.OptionValues; |
43972 | 50 |
import org.graalvm.compiler.word.WordTypes; |
51 |
||
52 |
import jdk.vm.ci.code.CallingConvention; |
|
53 |
import jdk.vm.ci.code.CodeCacheProvider; |
|
54 |
import jdk.vm.ci.code.RegisterValue; |
|
55 |
import jdk.vm.ci.code.TargetDescription; |
|
50858 | 56 |
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
43972 | 57 |
import jdk.vm.ci.meta.JavaKind; |
58 |
import jdk.vm.ci.meta.MetaAccessProvider; |
|
59 |
import jdk.vm.ci.meta.PlatformKind; |
|
60 |
import jdk.vm.ci.meta.Value; |
|
61 |
||
62 |
public class SPARCHotSpotForeignCallsProvider extends HotSpotHostForeignCallsProvider { |
|
63 |
||
64 |
private final Value[] nativeABICallerSaveRegisters; |
|
65 |
||
50858 | 66 |
public SPARCHotSpotForeignCallsProvider(HotSpotJVMCIRuntime jvmciRuntime, HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, |
43972 | 67 |
WordTypes wordTypes, Value[] nativeABICallerSaveRegisters) { |
68 |
super(jvmciRuntime, runtime, metaAccess, codeCache, wordTypes); |
|
69 |
this.nativeABICallerSaveRegisters = nativeABICallerSaveRegisters; |
|
70 |
} |
|
71 |
||
72 |
@Override |
|
46344 | 73 |
public void initialize(HotSpotProviders providers, OptionValues options) { |
43972 | 74 |
GraalHotSpotVMConfig config = runtime.getVMConfig(); |
75 |
TargetDescription target = providers.getCodeCache().getTarget(); |
|
76 |
PlatformKind word = target.arch.getWordKind(); |
|
77 |
||
78 |
// The calling convention for the exception handler stub is (only?) defined in |
|
79 |
// TemplateInterpreterGenerator::generate_throw_exception() |
|
80 |
// in templateInterpreter_sparc.cpp around line 1925 |
|
81 |
RegisterValue outgoingException = o0.asValue(LIRKind.fromJavaKind(target.arch, JavaKind.Object)); |
|
82 |
RegisterValue outgoingExceptionPc = o1.asValue(LIRKind.value(word)); |
|
83 |
RegisterValue incomingException = i0.asValue(LIRKind.fromJavaKind(target.arch, JavaKind.Object)); |
|
84 |
RegisterValue incomingExceptionPc = i1.asValue(LIRKind.value(word)); |
|
85 |
CallingConvention outgoingExceptionCc = new CallingConvention(0, ILLEGAL, outgoingException, outgoingExceptionPc); |
|
86 |
CallingConvention incomingExceptionCc = new CallingConvention(0, ILLEGAL, incomingException, incomingExceptionPc); |
|
58299 | 87 |
register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, outgoingExceptionCc, |
88 |
incomingExceptionCc, |
|
89 |
any())); |
|
90 |
register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, outgoingExceptionCc, |
|
51436 | 91 |
incomingExceptionCc, any())); |
43972 | 92 |
|
93 |
if (config.useCRC32Intrinsics) { |
|
94 |
// This stub does callee saving |
|
58299 | 95 |
registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any()); |
43972 | 96 |
} |
48398 | 97 |
if (config.useCRC32CIntrinsics) { |
58299 | 98 |
registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any()); |
48398 | 99 |
} |
43972 | 100 |
|
46344 | 101 |
super.initialize(providers, options); |
43972 | 102 |
} |
103 |
||
104 |
@Override |
|
105 |
public Value[] getNativeABICallerSaveRegisters() { |
|
106 |
return nativeABICallerSaveRegisters; |
|
107 |
} |
|
108 |
} |