43972
|
1 |
/*
|
58299
|
2 |
* Copyright (c) 2014, 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.lir.framemap;
|
|
26 |
|
|
27 |
import org.graalvm.compiler.lir.VirtualStackSlot;
|
|
28 |
import org.graalvm.compiler.lir.gen.LIRGenerationResult;
|
|
29 |
|
|
30 |
import jdk.vm.ci.code.CallingConvention;
|
|
31 |
import jdk.vm.ci.code.CodeCacheProvider;
|
|
32 |
import jdk.vm.ci.code.RegisterConfig;
|
|
33 |
import jdk.vm.ci.meta.ValueKind;
|
|
34 |
|
|
35 |
/**
|
|
36 |
* A {@link FrameMapBuilder} is used to collect all information necessary to
|
|
37 |
* {@linkplain #buildFrameMap create} a {@link FrameMap}.
|
|
38 |
*/
|
|
39 |
public abstract class FrameMapBuilder {
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned
|
|
43 |
* on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary, unless
|
|
44 |
* overridden by a subclass.
|
|
45 |
*
|
|
46 |
* @param kind The kind of the spill slot to be reserved.
|
|
47 |
* @return A spill slot denoting the reserved memory area.
|
|
48 |
*/
|
|
49 |
public abstract VirtualStackSlot allocateSpillSlot(ValueKind<?> kind);
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Reserves a number of contiguous slots in the frame of the method being compiled. If the
|
|
53 |
* requested number of slots is 0, this method returns {@code null}.
|
|
54 |
*
|
|
55 |
* @param slots the number of slots to reserve
|
|
56 |
* @return the first reserved stack slot (i.e., at the lowest address)
|
|
57 |
*/
|
55509
|
58 |
public abstract VirtualStackSlot allocateStackSlots(int slots);
|
43972
|
59 |
|
|
60 |
public abstract RegisterConfig getRegisterConfig();
|
|
61 |
|
|
62 |
public abstract CodeCacheProvider getCodeCache();
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Informs the frame map that the compiled code calls a particular method, which may need stack
|
|
66 |
* space for outgoing arguments.
|
|
67 |
*
|
|
68 |
* @param cc The calling convention for the called method.
|
|
69 |
*/
|
|
70 |
public abstract void callsMethod(CallingConvention cc);
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Creates a {@linkplain FrameMap} based on the information collected by this
|
|
74 |
* {@linkplain FrameMapBuilder}.
|
|
75 |
*/
|
|
76 |
public abstract FrameMap buildFrameMap(LIRGenerationResult result);
|
|
77 |
}
|