annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java @ 18156:115c9fac7542

Move FrameMapBuilderImpl to com.oracle.graal.lir.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 22 Oct 2014 18:04:46 +0200
parents 448be95baef8
children 9619ba4daf4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6494
diff changeset
23 package com.oracle.graal.hotspot.amd64;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
25 import static com.oracle.graal.amd64.AMD64.*;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
26 import static com.oracle.graal.api.code.CallingConvention.Type.*;
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
27 import static com.oracle.graal.api.code.ValueUtil.*;
15259
d90e5c22ba55 Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15180
diff changeset
28 import static com.oracle.graal.compiler.common.GraalOptions.*;
16395
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 15838
diff changeset
29 import static com.oracle.graal.compiler.common.UnsafeAccess.*;
15838
15771ff797b4 Pass the compiled method to LIR factory
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15456
diff changeset
30
9200
9be78aeab2e1 temporaries are recorded for compiled stubs, allowing for better register allocation around calls to such stubs (GRAAL-210)
Doug Simon <doug.simon@oracle.com>
parents: 8370
diff changeset
31 import java.util.*;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
33 import com.oracle.graal.amd64.*;
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
34 import com.oracle.graal.api.code.*;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
35 import com.oracle.graal.api.meta.*;
6531
4afe23aa0a00 renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents: 6525
diff changeset
36 import com.oracle.graal.asm.*;
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 8166
diff changeset
37 import com.oracle.graal.asm.amd64.*;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6676
diff changeset
38 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 import com.oracle.graal.compiler.gen.*;
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
40 import com.oracle.graal.compiler.target.*;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 import com.oracle.graal.hotspot.*;
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14927
diff changeset
42 import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId;
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
43 import com.oracle.graal.hotspot.meta.*;
13895
4731c1a0b1f3 consolidated GNFI code into graal.hotspot project and cleaned up the documentation and code
Doug Simon <doug.simon@oracle.com>
parents: 13872
diff changeset
44 import com.oracle.graal.hotspot.nfi.*;
9200
9be78aeab2e1 temporaries are recorded for compiled stubs, allowing for better register allocation around calls to such stubs (GRAAL-210)
Doug Simon <doug.simon@oracle.com>
parents: 8370
diff changeset
45 import com.oracle.graal.hotspot.stubs.*;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 import com.oracle.graal.lir.*;
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47 import com.oracle.graal.lir.amd64.*;
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48 import com.oracle.graal.lir.asm.*;
15292
a38d791982e1 Move LIRGenerationResult* to graal.lir.
Josef Eisl <josef.eisl@jku.at>
parents: 15259
diff changeset
49 import com.oracle.graal.lir.gen.*;
5236
f9aae727d035 removed XIR safepoint operation
Doug Simon <doug.simon@oracle.com>
parents: 5235
diff changeset
50 import com.oracle.graal.nodes.*;
15337
c4be3c1b2d6d Use NodeLIRBuilderTool instead of NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 15333
diff changeset
51 import com.oracle.graal.nodes.spi.*;
16691
dd8449afc086 GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16395
diff changeset
52 import com.oracle.nfi.api.*;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53
5844
a432e6d43aa1 fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents: 5841
diff changeset
54 /**
a432e6d43aa1 fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents: 5841
diff changeset
55 * HotSpot AMD64 specific backend.
a432e6d43aa1 fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents: 5841
diff changeset
56 */
12580
7876c59a7a2f refactored all deferred initialization of backends into HotSpotBackend
Doug Simon <doug.simon@oracle.com>
parents: 12557
diff changeset
57 public class AMD64HotSpotBackend extends HotSpotHostBackend {
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
59 public AMD64HotSpotBackend(HotSpotGraalRuntime runtime, HotSpotProviders providers) {
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
60 super(runtime, providers);
6483
e11b2c8f374b modified NewInstanceStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents: 6482
diff changeset
61 }
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
63 @Override
11775
b04b94b71649 Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents: 11537
diff changeset
64 public boolean shouldAllocateRegisters() {
b04b94b71649 Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents: 11537
diff changeset
65 return true;
b04b94b71649 Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents: 11537
diff changeset
66 }
b04b94b71649 Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents: 11537
diff changeset
67
b04b94b71649 Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents: 11537
diff changeset
68 @Override
18155
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
69 public FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
18156
115c9fac7542 Move FrameMapBuilderImpl to com.oracle.graal.lir.
Josef Eisl <josef.eisl@jku.at>
parents: 18155
diff changeset
70 return new FrameMapBuilderImpl(this::newFrameMap, getCodeCache(), registerConfig);
18155
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
71 }
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
72
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
73 @Override
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
74 public FrameMap newFrameMap(FrameMapBuilder frameMapBuilder) {
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
75 return new AMD64FrameMap(getCodeCache(), frameMapBuilder.getRegisterConfig());
10956
563c6d1994c0 added architecture specific frame maps
twisti
parents: 10761
diff changeset
76 }
563c6d1994c0 added architecture specific frame maps
twisti
parents: 10761
diff changeset
77
563c6d1994c0 added architecture specific frame maps
twisti
parents: 10761
diff changeset
78 @Override
15333
06ecedffb109 Use LIRGeneratorTool in Backend.
Josef Eisl <josef.eisl@jku.at>
parents: 15311
diff changeset
79 public LIRGeneratorTool newLIRGenerator(CallingConvention cc, LIRGenerationResult lirGenRes) {
14842
f2e61bf2a2d8 Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents: 14841
diff changeset
80 return new AMD64HotSpotLIRGenerator(getProviders(), getRuntime().getConfig(), cc, lirGenRes);
14809
73774616a6b3 Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents: 14807
diff changeset
81 }
73774616a6b3 Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents: 14807
diff changeset
82
73774616a6b3 Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents: 14807
diff changeset
83 @Override
18152
04b54406c292 Use FrameMapBuilder in Backend.newLIRGenerationResult().
Josef Eisl <josef.eisl@jku.at>
parents: 18149
diff changeset
84 public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMapBuilder frameMapBuilder, ResolvedJavaMethod method, Object stub) {
04b54406c292 Use FrameMapBuilder in Backend.newLIRGenerationResult().
Josef Eisl <josef.eisl@jku.at>
parents: 18149
diff changeset
85 return new AMD64HotSpotLIRGenerationResult(lir, frameMapBuilder, stub);
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
86 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
88 @Override
15338
5e544920ad9f Rename Backend.newNodeLIRGenerator to Backend.newNodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 15337
diff changeset
89 public NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen) {
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
90 return new AMD64HotSpotNodeLIRBuilder(graph, lirGen);
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
91 }
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
92
14927
93de07975ea9 Create dedicated BaselineBytecodeParser, BytecodeLIRBuilder and amd64 specialization.
Josef Eisl <josef.eisl@jku.at>
parents: 14921
diff changeset
93 @Override
15333
06ecedffb109 Use LIRGeneratorTool in Backend.
Josef Eisl <josef.eisl@jku.at>
parents: 15311
diff changeset
94 public BytecodeLIRBuilder newBytecodeLIRBuilder(LIRGeneratorTool gen, BytecodeParserTool parser) {
14927
93de07975ea9 Create dedicated BaselineBytecodeParser, BytecodeLIRBuilder and amd64 specialization.
Josef Eisl <josef.eisl@jku.at>
parents: 14921
diff changeset
95 return new AMD64HotSpotBytecodeLIRBuilder(gen, parser);
93de07975ea9 Create dedicated BaselineBytecodeParser, BytecodeLIRBuilder and amd64 specialization.
Josef Eisl <josef.eisl@jku.at>
parents: 14921
diff changeset
96
93de07975ea9 Create dedicated BaselineBytecodeParser, BytecodeLIRBuilder and amd64 specialization.
Josef Eisl <josef.eisl@jku.at>
parents: 14921
diff changeset
97 }
93de07975ea9 Create dedicated BaselineBytecodeParser, BytecodeLIRBuilder and amd64 specialization.
Josef Eisl <josef.eisl@jku.at>
parents: 14921
diff changeset
98
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
99 /**
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
100 * Emits code to do stack overflow checking.
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
101 *
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
102 * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
103 * the current frame
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
104 * @param isVerifiedEntryPoint specifies if the code buffer is currently at the verified entry
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
105 * point
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
106 */
13310
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
107 protected static void emitStackOverflowCheck(CompilationResultBuilder crb, int pagesToBang, boolean afterFrameInit, boolean isVerifiedEntryPoint) {
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
108 if (pagesToBang > 0) {
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
109
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
110 AMD64MacroAssembler asm = (AMD64MacroAssembler) crb.asm;
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
111 int frameSize = crb.frameMap.frameSize();
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
112 if (frameSize > 0) {
7841
674a8b9e62f8 Remove unused fields in TargetDescription. Use Unsafe.pageSize().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7839
diff changeset
113 int lastFramePage = frameSize / unsafe.pageSize();
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
114 // emit multiple stack bangs for methods with frames larger than a page
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
115 for (int i = 0; i <= lastFramePage; i++) {
13310
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
116 int disp = (i + pagesToBang) * unsafe.pageSize();
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
117 if (afterFrameInit) {
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
118 disp -= frameSize;
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
119 }
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
120 crb.blockComment("[stack overflow check]");
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 13895
diff changeset
121 int pos = asm.position();
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 8166
diff changeset
122 asm.movq(new AMD64Address(rsp, -disp), AMD64.rax);
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 13895
diff changeset
123 assert i > 0 || !isVerifiedEntryPoint || asm.position() - pos >= PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE;
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
124 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
125 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
126 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
127 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
128
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
129 /**
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
130 * The size of the instruction used to patch the verified entry point of an nmethod when the
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
131 * nmethod is made non-entrant or a zombie (e.g. during deopt or class unloading). The first
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
132 * instruction emitted at an nmethod's verified entry point must be at least this length to
13245
af7d328b2cc7 minor renamings
Doug Simon <doug.simon@oracle.com>
parents: 13234
diff changeset
133 * ensure mt-safe patching.
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
134 */
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
135 public static final int PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE = 5;
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
136
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
137 /**
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
138 * Emits code at the verified entry point and return point(s) of a method.
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
139 */
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
140 class HotSpotFrameContext implements FrameContext {
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
141
9451
3ccda80d466b stack overflow check and deopt/exception handler entry points are omitted from compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9415
diff changeset
142 final boolean isStub;
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
143 final boolean omitFrame;
9451
3ccda80d466b stack overflow check and deopt/exception handler entry points are omitted from compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9415
diff changeset
144
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
145 HotSpotFrameContext(boolean isStub, boolean omitFrame) {
9451
3ccda80d466b stack overflow check and deopt/exception handler entry points are omitted from compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9415
diff changeset
146 this.isStub = isStub;
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
147 this.omitFrame = omitFrame;
9451
3ccda80d466b stack overflow check and deopt/exception handler entry points are omitted from compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9415
diff changeset
148 }
3ccda80d466b stack overflow check and deopt/exception handler entry points are omitted from compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9415
diff changeset
149
13234
7e237378923d made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents: 13229
diff changeset
150 public boolean hasFrame() {
7e237378923d made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents: 13229
diff changeset
151 return !omitFrame;
7e237378923d made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents: 13229
diff changeset
152 }
7e237378923d made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents: 13229
diff changeset
153
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
155 public void enter(CompilationResultBuilder crb) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
156 FrameMap frameMap = crb.frameMap;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
157 int frameSize = frameMap.frameSize();
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
158 AMD64MacroAssembler asm = (AMD64MacroAssembler) crb.asm;
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
159 if (omitFrame) {
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
160 if (!isStub) {
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
161 asm.nop(PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE);
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
162 }
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
163 } else {
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 13895
diff changeset
164 int verifiedEntryPointOffset = asm.position();
13310
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
165 if (!isStub && pagesToBang > 0) {
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
166 emitStackOverflowCheck(crb, pagesToBang, false, true);
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 13895
diff changeset
167 assert asm.position() - verifiedEntryPointOffset >= PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE;
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
168 }
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 13895
diff changeset
169 if (!isStub && asm.position() == verifiedEntryPointOffset) {
13310
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
170 asm.subqWide(rsp, frameSize);
14031
390c4b742890 made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents: 13895
diff changeset
171 assert asm.position() - verifiedEntryPointOffset >= PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE;
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
172 } else {
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
173 asm.decrementq(rsp, frameSize);
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
174 }
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
175 if (ZapStackOnMethodEntry.getValue()) {
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
176 final int intSize = 4;
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
177 for (int i = 0; i < frameSize / intSize; ++i) {
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
178 asm.movl(new AMD64Address(rsp, i * intSize), 0xC1C1C1C1);
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
179 }
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
180 }
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 16895
diff changeset
181 CalleeSaveLayout csl = frameMap.getRegisterConfig().getCalleeSaveLayout();
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
182 if (csl != null && csl.size != 0) {
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
183 int frameToCSA = frameMap.offsetToCalleeSaveArea();
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
184 assert frameToCSA >= 0;
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
185 asm.save(csl, frameToCSA);
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
186 }
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
187 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
188 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
189
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
190 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
191 public void leave(CompilationResultBuilder crb) {
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
192 if (!omitFrame) {
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
193 AMD64MacroAssembler asm = (AMD64MacroAssembler) crb.asm;
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 16895
diff changeset
194 CalleeSaveLayout csl = crb.frameMap.getRegisterConfig().getCalleeSaveLayout();
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
195
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
196 if (csl != null && csl.size != 0) {
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
197 // saved all registers, restore all registers
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
198 int frameToCSA = crb.frameMap.offsetToCalleeSaveArea();
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
199 asm.restore(csl, frameToCSA);
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
200 }
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
201
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
202 int frameSize = crb.frameMap.frameSize();
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
203 asm.incrementq(rsp, frameSize);
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
204 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
205 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
206 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
207
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
208 @Override
14032
d1c1f103d42c renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents: 14031
diff changeset
209 protected Assembler createAssembler(FrameMap frameMap) {
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 16895
diff changeset
210 return new AMD64MacroAssembler(getTarget(), frameMap.getRegisterConfig());
9432
6680389bd36f Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9415
diff changeset
211 }
6680389bd36f Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9415
diff changeset
212
6680389bd36f Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9415
diff changeset
213 @Override
18149
aed00dc20923 Pass FrameMap to Backend.newCompilationResultBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18148
diff changeset
214 public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenRen, FrameMap frameMap, CompilationResult compilationResult, CompilationResultBuilderFactory factory) {
5251
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5242
diff changeset
215 // Omit the frame if the method:
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
216 // - has no spill slots or other slots allocated during register allocation
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
217 // - has no callee-saved registers
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
218 // - has no incoming arguments passed on the stack
10761
dd7a8807378b cannot omit frame for compiled methods that make a foreign call (GRAAL-362)
Doug Simon <doug.simon@oracle.com>
parents: 10732
diff changeset
219 // - has no deoptimization points
dd7a8807378b cannot omit frame for compiled methods that make a foreign call (GRAAL-362)
Doug Simon <doug.simon@oracle.com>
parents: 10732
diff changeset
220 // - makes no foreign calls (which require an aligned stack)
14809
73774616a6b3 Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents: 14807
diff changeset
221 AMD64HotSpotLIRGenerationResult gen = (AMD64HotSpotLIRGenerationResult) lirGenRen;
14796
f5b3292b4ded Restrict access to members of LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents: 14142
diff changeset
222 LIR lir = gen.getLIR();
14807
c3242028cc44 Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents: 14804
diff changeset
223 assert gen.getDeoptimizationRescueSlot() == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame";
10761
dd7a8807378b cannot omit frame for compiled methods that make a foreign call (GRAAL-362)
Doug Simon <doug.simon@oracle.com>
parents: 10732
diff changeset
224 boolean omitFrame = CanOmitFrame.getValue() && !frameMap.frameNeedsAllocating() && !lir.hasArgInCallerFrame() && !gen.hasForeignCall();
5251
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5242
diff changeset
225
9613
0c17815817a4 removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents: 9612
diff changeset
226 Stub stub = gen.getStub();
14032
d1c1f103d42c renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents: 14031
diff changeset
227 Assembler masm = createAssembler(frameMap);
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
228 HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null, omitFrame);
13229
325b4e4efb60 added CompilationResultBuilderFactory to support peep-hole instrumentation of methods as their code is emitted
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
229 CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, frameContext, compilationResult);
15180
7a9531f50cd8 renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents: 15176
diff changeset
230 crb.setTotalFrameSize(frameMap.totalFrameSize());
14807
c3242028cc44 Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents: 14804
diff changeset
231 StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot();
9451
3ccda80d466b stack overflow check and deopt/exception handler entry points are omitted from compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9415
diff changeset
232 if (deoptimizationRescueSlot != null && stub == null) {
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
233 crb.compilationResult.setCustomStackAreaOffset(frameMap.offsetForStackSlot(deoptimizationRescueSlot));
8282
59744882ddeb moved logic for reserving a special area/slot in a frame (e.g., for use during deoptimization) out of FrameMap and into platform specific backend class
Doug Simon <doug.simon@oracle.com>
parents: 8281
diff changeset
234 }
9200
9be78aeab2e1 temporaries are recorded for compiled stubs, allowing for better register allocation around calls to such stubs (GRAAL-210)
Doug Simon <doug.simon@oracle.com>
parents: 8370
diff changeset
235
9be78aeab2e1 temporaries are recorded for compiled stubs, allowing for better register allocation around calls to such stubs (GRAAL-210)
Doug Simon <doug.simon@oracle.com>
parents: 8370
diff changeset
236 if (stub != null) {
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 12580
diff changeset
237 Set<Register> definedRegisters = gatherDefinedRegisters(lir);
14807
c3242028cc44 Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents: 14804
diff changeset
238 updateStub(stub, definedRegisters, gen.getCalleeSaveInfo(), frameMap);
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9200
diff changeset
239 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9200
diff changeset
240
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
241 return crb;
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9200
diff changeset
242 }
9200
9be78aeab2e1 temporaries are recorded for compiled stubs, allowing for better register allocation around calls to such stubs (GRAAL-210)
Doug Simon <doug.simon@oracle.com>
parents: 8370
diff changeset
243
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
244 @Override
14065
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
245 public void emitCode(CompilationResultBuilder crb, LIR lir, ResolvedJavaMethod installedCodeOwner) {
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
246 AMD64MacroAssembler asm = (AMD64MacroAssembler) crb.asm;
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
247 FrameMap frameMap = crb.frameMap;
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 16895
diff changeset
248 RegisterConfig regConfig = frameMap.getRegisterConfig();
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
249 HotSpotVMConfig config = getRuntime().getConfig();
13245
af7d328b2cc7 minor renamings
Doug Simon <doug.simon@oracle.com>
parents: 13234
diff changeset
250 Label verifiedEntry = new Label();
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
251
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
252 // Emit the prefix
13245
af7d328b2cc7 minor renamings
Doug Simon <doug.simon@oracle.com>
parents: 13234
diff changeset
253 emitCodePrefix(installedCodeOwner, crb, asm, regConfig, config, verifiedEntry);
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
254
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
255 // Emit code for the LIR
14065
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
256 emitCodeBody(installedCodeOwner, crb, lir);
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
257
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
258 // Emit the suffix
14065
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
259 emitCodeSuffix(installedCodeOwner, crb, asm, frameMap);
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
260 }
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
261
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
262 /**
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
263 * Emits the code prior to the verified entry point.
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
264 *
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
265 * @param installedCodeOwner see {@link Backend#emitCode}
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
266 */
13245
af7d328b2cc7 minor renamings
Doug Simon <doug.simon@oracle.com>
parents: 13234
diff changeset
267 public void emitCodePrefix(ResolvedJavaMethod installedCodeOwner, CompilationResultBuilder crb, AMD64MacroAssembler asm, RegisterConfig regConfig, HotSpotVMConfig config, Label verifiedEntry) {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
268 HotSpotProviders providers = getProviders();
15311
820c6d353358 added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents: 15292
diff changeset
269 if (installedCodeOwner != null && !installedCodeOwner.isStatic()) {
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14142
diff changeset
270 MarkId.recordMark(crb, MarkId.UNVERIFIED_ENTRY);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
271 CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{providers.getMetaAccess().lookupJavaType(Object.class)}, getTarget(), false);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
272 Register inlineCacheKlass = rax; // see definition of IC_Klass in
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
273 // c1_LIRAssembler_x86.cpp
6470
b1010f7bc0bf expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents: 6462
diff changeset
274 Register receiver = asRegister(cc.getArgument(0));
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 8166
diff changeset
275 AMD64Address src = new AMD64Address(receiver, config.hubOffset);
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
276
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
277 if (config.useCompressedClassPointers) {
10732
0bd794eb8222 Add compressed oop support in HotSpot Backend
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10666
diff changeset
278 Register register = r10;
13520
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13318
diff changeset
279 AMD64HotSpotMove.decodeKlassPointer(asm, register, providers.getRegisters().getHeapBaseRegister(), src, config.getKlassEncoding());
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13318
diff changeset
280 if (config.narrowKlassBase != 0) {
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13318
diff changeset
281 // The heap base register was destroyed above, so restore it
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13318
diff changeset
282 asm.movq(providers.getRegisters().getHeapBaseRegister(), config.narrowOopBase);
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13318
diff changeset
283 }
10732
0bd794eb8222 Add compressed oop support in HotSpot Backend
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10666
diff changeset
284 asm.cmpq(inlineCacheKlass, register);
0bd794eb8222 Add compressed oop support in HotSpot Backend
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10666
diff changeset
285 } else {
0bd794eb8222 Add compressed oop support in HotSpot Backend
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10666
diff changeset
286 asm.cmpq(inlineCacheKlass, src);
0bd794eb8222 Add compressed oop support in HotSpot Backend
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10666
diff changeset
287 }
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
288 AMD64Call.directConditionalJmp(crb, asm, getForeignCalls().lookupForeignCall(IC_MISS_HANDLER), ConditionFlag.NotEqual);
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
289 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
290
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
291 asm.align(config.codeEntryAlignment);
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14142
diff changeset
292 MarkId.recordMark(crb, MarkId.OSR_ENTRY);
13245
af7d328b2cc7 minor renamings
Doug Simon <doug.simon@oracle.com>
parents: 13234
diff changeset
293 asm.bind(verifiedEntry);
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14142
diff changeset
294 MarkId.recordMark(crb, MarkId.VERIFIED_ENTRY);
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
295 }
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
296
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
297 /**
13223
78c808233ff1 ensure instruction at verified entry point is safely patchable (GRAAL-605)
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
298 * Emits the code which starts at the verified entry point.
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
299 *
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
300 * @param installedCodeOwner see {@link Backend#emitCode}
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
301 */
14065
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
302 public void emitCodeBody(ResolvedJavaMethod installedCodeOwner, CompilationResultBuilder crb, LIR lir) {
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
303 crb.emit(lir);
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
304 }
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
305
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
306 /**
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
307 * @param installedCodeOwner see {@link Backend#emitCode}
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
308 */
14065
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
309 public void emitCodeSuffix(ResolvedJavaMethod installedCodeOwner, CompilationResultBuilder crb, AMD64MacroAssembler asm, FrameMap frameMap) {
12502
28f56bf7c06a added support code for Truffle to inject special tail-call code into the prefix of OptimizedCallTarget.call(PackedFrame, Arguments)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
310 HotSpotProviders providers = getProviders();
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
311 HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
13234
7e237378923d made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents: 13229
diff changeset
312 if (!frameContext.isStub) {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
313 HotSpotForeignCallsProvider foreignCalls = providers.getForeignCalls();
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14142
diff changeset
314 MarkId.recordMark(crb, MarkId.EXCEPTION_HANDLER_ENTRY);
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13223
diff changeset
315 AMD64Call.directCall(crb, asm, foreignCalls.lookupForeignCall(EXCEPTION_HANDLER), null, false, null);
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14142
diff changeset
316 MarkId.recordMark(crb, MarkId.DEOPT_HANDLER_ENTRY);
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15338
diff changeset
317 AMD64Call.directCall(crb, asm, foreignCalls.lookupForeignCall(DEOPTIMIZATION_HANDLER), null, false, null);
5251
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5242
diff changeset
318 } else {
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5242
diff changeset
319 // No need to emit the stubs for entries back into the method since
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5242
diff changeset
320 // it has no calls that can cause such "return" entries
13829
fd267819dbdb fixed or removed incorrect assertions
Doug Simon <doug.simon@oracle.com>
parents: 13520
diff changeset
321
fd267819dbdb fixed or removed incorrect assertions
Doug Simon <doug.simon@oracle.com>
parents: 13520
diff changeset
322 if (frameContext.omitFrame) {
fd267819dbdb fixed or removed incorrect assertions
Doug Simon <doug.simon@oracle.com>
parents: 13520
diff changeset
323 // Cannot access slots in caller's frame if my frame is omitted
14065
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
324 assert !frameMap.accessesCallerFrame();
13829
fd267819dbdb fixed or removed incorrect assertions
Doug Simon <doug.simon@oracle.com>
parents: 13520
diff changeset
325 }
5251
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5242
diff changeset
326 }
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
327 }
13837
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13829
diff changeset
328
16704
3cd605c98060 NFI: cleanup
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16691
diff changeset
329 /**
3cd605c98060 NFI: cleanup
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16691
diff changeset
330 * Called from the VM.
3cd605c98060 NFI: cleanup
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16691
diff changeset
331 */
16691
dd8449afc086 GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16395
diff changeset
332 public static NativeFunctionInterface createNativeFunctionInterface() {
dd8449afc086 GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16395
diff changeset
333 HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig();
13895
4731c1a0b1f3 consolidated GNFI code into graal.hotspot project and cleaned up the documentation and code
Doug Simon <doug.simon@oracle.com>
parents: 13872
diff changeset
334 RawNativeCallNodeFactory factory = new RawNativeCallNodeFactory() {
4731c1a0b1f3 consolidated GNFI code into graal.hotspot project and cleaned up the documentation and code
Doug Simon <doug.simon@oracle.com>
parents: 13872
diff changeset
335 public FixedWithNextNode createRawCallNode(Kind returnType, Constant functionPointer, ValueNode... args) {
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16704
diff changeset
336 return AMD64RawNativeCallNode.create(returnType, functionPointer, args);
13895
4731c1a0b1f3 consolidated GNFI code into graal.hotspot project and cleaned up the documentation and code
Doug Simon <doug.simon@oracle.com>
parents: 13872
diff changeset
337 }
4731c1a0b1f3 consolidated GNFI code into graal.hotspot project and cleaned up the documentation and code
Doug Simon <doug.simon@oracle.com>
parents: 13872
diff changeset
338 };
16691
dd8449afc086 GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16395
diff changeset
339 Backend backend = HotSpotGraalRuntime.runtime().getBackend(AMD64.class);
dd8449afc086 GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 16395
diff changeset
340 return new HotSpotNativeFunctionInterface(HotSpotGraalRuntime.runtime().getHostProviders(), factory, backend, config.dllLoad, config.dllLookup, config.rtldDefault);
13837
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13829
diff changeset
341 }
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
342
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
343 }