ForeignCallLinkage.java revision 12651:6ef01bd40ce2
1/*
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
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 */
23package org.graalvm.compiler.core.common.spi;
24
25import jdk.vm.ci.code.CallingConvention;
26import jdk.vm.ci.meta.InvokeTarget;
27import jdk.vm.ci.meta.Value;
28
29/**
30 * The runtime specific details of a {@linkplain ForeignCallDescriptor foreign} call.
31 */
32public interface ForeignCallLinkage extends InvokeTarget {
33
34    /**
35     * Gets the details of where parameters are passed and value(s) are returned from the caller's
36     * perspective.
37     */
38    CallingConvention getOutgoingCallingConvention();
39
40    /**
41     * Gets the details of where parameters are passed and value(s) are returned from the callee's
42     * perspective.
43     */
44    CallingConvention getIncomingCallingConvention();
45
46    /**
47     * Returns the maximum absolute offset of a PC relative call to this stub from any position in
48     * the code cache or -1 when not applicable. Intended for determining the required size of
49     * address/offset fields.
50     */
51    long getMaxCallTargetOffset();
52
53    ForeignCallDescriptor getDescriptor();
54
55    /**
56     * Gets the values used/killed by this foreign call.
57     */
58    Value[] getTemporaries();
59
60    /**
61     * Determines if the foreign call target destroys all registers.
62     *
63     * @return {@code true} if the register allocator must save all live registers around a call to
64     *         this target
65     */
66    boolean destroysRegisters();
67
68    /**
69     * Determines if debug info needs to be associated with this call. Debug info is required if the
70     * function can raise an exception, try to lock, trigger GC or do anything else that requires
71     * the VM to be able to inspect the thread's execution state.
72     */
73    boolean needsDebugInfo();
74}
75