annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java @ 23348:9306a9611097

Update JVMCI import: Make CallingConvention.Type extensible; remove unused stackOnly parameter
author Christian Wimmer <christian.wimmer@oracle.com>
date Thu, 21 Jan 2016 14:24:24 -0800
parents f0dad49ca665
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.meta;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
22637
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
25 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
23134
f0dad49ca665 Not all foreign calls are safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22790
diff changeset
26 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.SAFEPOINT;
23348
9306a9611097 Update JVMCI import: Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 23134
diff changeset
27 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCall;
9306a9611097 Update JVMCI import: Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 23134
diff changeset
28 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCallee;
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29
22637
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
30 import java.util.HashMap;
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
31 import java.util.Map;
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32
22790
615f3bbbb174 Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22723
diff changeset
33 import jdk.vm.ci.code.CallingConvention;
615f3bbbb174 Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22723
diff changeset
34 import jdk.vm.ci.code.CodeCacheProvider;
615f3bbbb174 Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22723
diff changeset
35 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
615f3bbbb174 Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22723
diff changeset
36 import jdk.vm.ci.meta.LocationIdentity;
615f3bbbb174 Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22723
diff changeset
37 import jdk.vm.ci.meta.MetaAccessProvider;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21556
diff changeset
38
22637
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
39 import com.oracle.graal.compiler.common.spi.ForeignCallDescriptor;
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
40 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage;
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition;
22637
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
43 import com.oracle.graal.hotspot.HotSpotForeignCallLinkageImpl;
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
44 import com.oracle.graal.hotspot.HotSpotGraalRuntimeProvider;
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
45 import com.oracle.graal.hotspot.stubs.ForeignCallStub;
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
46 import com.oracle.graal.hotspot.stubs.Stub;
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
47 import com.oracle.graal.word.Word;
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49 /**
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 * HotSpot implementation of {@link HotSpotForeignCallsProvider}.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51 */
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52 public abstract class HotSpotForeignCallsProviderImpl implements HotSpotForeignCallsProvider {
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54 public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
55 public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56 public static final ForeignCallDescriptor VERIFY_OOP = new ForeignCallDescriptor("verify_oop", Object.class, Object.class);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
57 public static final ForeignCallDescriptor LOAD_AND_CLEAR_EXCEPTION = new ForeignCallDescriptor("load_and_clear_exception", Object.class, Word.class);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58
18227
bcb1e5c232d8 Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18114
diff changeset
59 public static final ForeignCallDescriptor TEST_DEOPTIMIZE_CALL_INT = new ForeignCallDescriptor("test_deoptimize_call_int", int.class, int.class);
bcb1e5c232d8 Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18114
diff changeset
60
22637
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
61 protected final HotSpotJVMCIRuntimeProvider jvmciRuntime;
18524
c538c2c6b7e2 changed most references to HotSpotGraalRuntime to use HotSpotGraalRuntimeProvider instead
Doug Simon <doug.simon@oracle.com>
parents: 18350
diff changeset
62 protected final HotSpotGraalRuntimeProvider runtime;
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
63
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
64 protected final Map<ForeignCallDescriptor, HotSpotForeignCallLinkage> foreignCalls = new HashMap<>();
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
65 protected final MetaAccessProvider metaAccess;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
66 protected final CodeCacheProvider codeCache;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
67
22637
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
68 public HotSpotForeignCallsProviderImpl(HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, CodeCacheProvider codeCache) {
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
69 this.jvmciRuntime = jvmciRuntime;
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
70 this.runtime = runtime;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
71 this.metaAccess = metaAccess;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
72 this.codeCache = codeCache;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
73 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
74
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
75 /**
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
76 * Registers the linkage for a foreign call.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
77 */
13624
220ed109bf77 initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents: 13301
diff changeset
78 public HotSpotForeignCallLinkage register(HotSpotForeignCallLinkage linkage) {
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
79 assert !foreignCalls.containsKey(linkage.getDescriptor()) : "already registered linkage for " + linkage.getDescriptor();
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
80 foreignCalls.put(linkage.getDescriptor(), linkage);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
81 return linkage;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
82 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
83
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
84 /**
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
85 * Creates and registers the details for linking a foreign call to a {@link Stub}.
16315
b955d649fca8 Fixing BC_i2f, BC_i2c, BC_fadd
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14157
diff changeset
86 *
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87 * @param descriptor the signature of the call to the stub
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
88 * @param reexecutable specifies if the stub call can be re-executed without (meaningful) side
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
89 * effects. Deoptimization will not return to a point before a stub call that cannot
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
90 * be re-executed.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91 * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
92 * @param killedLocations the memory locations killed by the stub call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
93 */
13624
220ed109bf77 initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents: 13301
diff changeset
94 public HotSpotForeignCallLinkage registerStubCall(ForeignCallDescriptor descriptor, boolean reexecutable, Transition transition, LocationIdentity... killedLocations) {
22723
638bfbc67270 added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents: 22637
diff changeset
95 return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, this, descriptor, 0L, PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutable, killedLocations));
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
97
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
98 /**
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
99 * Creates and registers the linkage for a foreign call.
16315
b955d649fca8 Fixing BC_i2f, BC_i2c, BC_fadd
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14157
diff changeset
100 *
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
101 * @param descriptor the signature of the foreign call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
102 * @param address the address of the code to call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
103 * @param outgoingCcType outgoing (caller) calling convention type
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
104 * @param effect specifies if the call destroys or preserves all registers (apart from
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
105 * temporaries which are always destroyed)
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
106 * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
107 * @param reexecutable specifies if the foreign call can be re-executed without (meaningful)
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
108 * side effects. Deoptimization will not return to a point before a foreign call that
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
109 * cannot be re-executed.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
110 * @param killedLocations the memory locations killed by the foreign call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
111 */
13624
220ed109bf77 initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents: 13301
diff changeset
112 public HotSpotForeignCallLinkage registerForeignCall(ForeignCallDescriptor descriptor, long address, CallingConvention.Type outgoingCcType, RegisterEffect effect, Transition transition,
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
113 boolean reexecutable, LocationIdentity... killedLocations) {
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
114 Class<?> resultType = descriptor.getResultType();
18114
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16315
diff changeset
115 assert address != 0;
23134
f0dad49ca665 Not all foreign calls are safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22790
diff changeset
116 assert transition != SAFEPOINT || resultType.isPrimitive() || Word.class.isAssignableFrom(resultType) : "non-leaf foreign calls must return objects in thread local storage: " + descriptor;
22723
638bfbc67270 added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents: 22637
diff changeset
117 return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, this, descriptor, address, effect, outgoingCcType, null, transition, reexecutable, killedLocations));
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
118 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
119
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
120 /**
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
121 * Creates a {@linkplain ForeignCallStub stub} for a foreign call.
16315
b955d649fca8 Fixing BC_i2f, BC_i2c, BC_fadd
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 14157
diff changeset
122 *
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
123 * @param descriptor the signature of the call to the stub
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
124 * @param address the address of the foreign code to call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
125 * @param prependThread true if the JavaThread value for the current thread is to be prepended
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
126 * to the arguments for the call to {@code address}
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
127 * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
128 * @param reexecutable specifies if the foreign call can be re-executed without (meaningful)
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
129 * side effects. Deoptimization will not return to a point before a foreign call that
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
130 * cannot be re-executed.
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
131 * @param killedLocations the memory locations killed by the foreign call
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
132 */
13624
220ed109bf77 initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents: 13301
diff changeset
133 public void linkForeignCall(HotSpotProviders providers, ForeignCallDescriptor descriptor, long address, boolean prependThread, Transition transition, boolean reexecutable,
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134 LocationIdentity... killedLocations) {
22637
4dab2545d435 removed HotSpotGraalRuntime singleton - it's now owned by a HotSpotGraalCompiler instance (GRAAL-1235)
Doug Simon <doug.simon@oracle.com>
parents: 22317
diff changeset
135 ForeignCallStub stub = new ForeignCallStub(jvmciRuntime, providers, address, descriptor, prependThread, transition, reexecutable, killedLocations);
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
136 HotSpotForeignCallLinkage linkage = stub.getLinkage();
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
137 HotSpotForeignCallLinkage targetLinkage = stub.getTargetLinkage();
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
138 linkage.setCompiledStub(stub);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
139 register(linkage);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
140 register(targetLinkage);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
141 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
142
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
143 public static final boolean PREPEND_THREAD = true;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
144 public static final boolean DONT_PREPEND_THREAD = !PREPEND_THREAD;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
145
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 public static final boolean REEXECUTABLE = true;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147 public static final boolean NOT_REEXECUTABLE = !REEXECUTABLE;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
148
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149 public static final LocationIdentity[] NO_LOCATIONS = {};
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
150
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
151 public HotSpotForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor) {
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13624
diff changeset
152 assert foreignCalls != null : descriptor;
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153 HotSpotForeignCallLinkage callTarget = foreignCalls.get(descriptor);
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154 callTarget.finalizeAddress(runtime.getHostBackend());
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
155 return callTarget;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
156 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
157
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
158 @Override
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
159 public boolean isReexecutable(ForeignCallDescriptor descriptor) {
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
160 assert foreignCalls.containsKey(descriptor) : "unknown foreign call: " + descriptor;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
161 return foreignCalls.get(descriptor).isReexecutable();
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
162 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
163
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
164 public boolean canDeoptimize(ForeignCallDescriptor descriptor) {
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
165 assert foreignCalls.containsKey(descriptor) : "unknown foreign call: " + descriptor;
22112
91b8a0d1abc5 renamed ForeignCallLinkage.canDeoptimize -> needsDebugInfo
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
166 return foreignCalls.get(descriptor).needsDebugInfo();
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
167 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
168
23134
f0dad49ca665 Not all foreign calls are safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22790
diff changeset
169 public boolean isGuaranteedSafepoint(ForeignCallDescriptor descriptor) {
f0dad49ca665 Not all foreign calls are safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22790
diff changeset
170 assert foreignCalls.containsKey(descriptor) : "unknown foreign call: " + descriptor;
f0dad49ca665 Not all foreign calls are safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22790
diff changeset
171 return foreignCalls.get(descriptor).isGuaranteedSafepoint();
f0dad49ca665 Not all foreign calls are safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22790
diff changeset
172 }
f0dad49ca665 Not all foreign calls are safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22790
diff changeset
173
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
174 public LocationIdentity[] getKilledLocations(ForeignCallDescriptor descriptor) {
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
175 assert foreignCalls.containsKey(descriptor) : "unknown foreign call: " + descriptor;
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
176 return foreignCalls.get(descriptor).getKilledLocations();
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
177 }
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
178 }