annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java @ 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
author Doug Simon <doug.simon@oracle.com>
date Thu, 14 Mar 2013 14:35:53 +0100
parents 8fde1be81b2d
children 9882af5c8504
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.*;
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
28
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
29 import java.lang.reflect.*;
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
30
7841
674a8b9e62f8 Remove unused fields in TargetDescription. Use Unsafe.pageSize().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7839
diff changeset
31 import sun.misc.*;
674a8b9e62f8 Remove unused fields in TargetDescription. Use Unsafe.pageSize().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7839
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.*;
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8136
diff changeset
35 import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
36 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
37 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
38 import com.oracle.graal.asm.amd64.*;
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 8166
diff changeset
39 import com.oracle.graal.asm.amd64.AMD64Address.Scale;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6676
diff changeset
40 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
6532
0c6030872cd0 renamed package: com.oracle.graal.compiler.target.amd64 -> com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6531
diff changeset
41 import com.oracle.graal.compiler.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
42 import com.oracle.graal.compiler.gen.*;
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
43 import com.oracle.graal.hotspot.*;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6413
diff changeset
44 import com.oracle.graal.hotspot.bridge.*;
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
45 import com.oracle.graal.hotspot.meta.*;
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6364
diff changeset
46 import com.oracle.graal.hotspot.nodes.*;
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
47 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
48 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
49 import com.oracle.graal.lir.amd64.*;
6492
dc409418cc2c removed MethodEntryCounters
Doug Simon <doug.simon@oracle.com>
parents: 6491
diff changeset
50 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp;
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
51 import com.oracle.graal.lir.asm.*;
5236
f9aae727d035 removed XIR safepoint operation
Doug Simon <doug.simon@oracle.com>
parents: 5235
diff changeset
52 import com.oracle.graal.nodes.*;
5242
f46d82be6e19 ExceptionObjectNode is now lowered without XIR
Doug Simon <doug.simon@oracle.com>
parents: 5236
diff changeset
53 import com.oracle.graal.nodes.java.*;
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
54 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6521
diff changeset
55 import com.oracle.graal.phases.*;
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
56
5844
a432e6d43aa1 fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents: 5841
diff changeset
57 /**
a432e6d43aa1 fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents: 5841
diff changeset
58 * 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
59 */
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
60 public class AMD64HotSpotBackend extends HotSpotBackend {
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
61
7841
674a8b9e62f8 Remove unused fields in TargetDescription. Use Unsafe.pageSize().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7839
diff changeset
62 private static final Unsafe unsafe = Unsafe.getUnsafe();
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
63 public static final Descriptor EXCEPTION_HANDLER = new Descriptor("exceptionHandler", true, void.class);
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
64 public static final Descriptor DEOPT_HANDLER = new Descriptor("deoptHandler", true, void.class);
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
65 public static final Descriptor IC_MISS_HANDLER = new Descriptor("icMissHandler", true, void.class);
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
66
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
67 public AMD64HotSpotBackend(HotSpotRuntime runtime, TargetDescription 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
68 super(runtime, target);
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
69 }
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
70
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
71 @Override
6675
6eb83c6eb177 change LIRGenerator to take StructuredGraph instead of Graph
Lukas Stadler <lukas.stadler@jku.at>
parents: 6580
diff changeset
72 public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
73 return new HotSpotAMD64LIRGenerator(graph, runtime(), target, frameMap, method, lir);
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
74 }
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
75
6489
1f0edd29cc66 defined new HotSpot specific interface extending the contract of a LIR generator
Doug Simon <doug.simon@oracle.com>
parents: 6487
diff changeset
76 static final class HotSpotAMD64LIRGenerator extends AMD64LIRGenerator implements HotSpotLIRGenerator {
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
77
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
78 private HotSpotRuntime runtime() {
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
79 return (HotSpotRuntime) runtime;
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
80 }
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
81
6675
6eb83c6eb177 change LIRGenerator to take StructuredGraph instead of Graph
Lukas Stadler <lukas.stadler@jku.at>
parents: 6580
diff changeset
82 private HotSpotAMD64LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6413
diff changeset
83 super(graph, runtime, target, frameMap, method, lir);
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
84 }
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
85
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
86 @Override
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
87 protected boolean needOnlyOopMaps() {
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
88 // Stubs only need oop maps
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
89 return runtime().asStub(method) != null;
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
90 }
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
91
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
92 @Override
6676
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
93 protected CallingConvention createCallingConvention() {
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
94 Stub stub = runtime().asStub(method);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
95 if (stub != null) {
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
96 return stub.getLinkage().getCallingConvention();
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
97 }
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
98
6676
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
99 if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) {
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
100 return super.createCallingConvention();
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
101 } else {
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7154
diff changeset
102 return frameMap.registerConfig.getCallingConvention(JavaCallee, method.getSignature().getReturnType(null), new JavaType[]{runtime.lookupJavaType(long.class)}, target, false);
6676
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
103 }
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
104 }
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
105
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
106 @Override
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
107 public void visitSafepointNode(SafepointNode i) {
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
108 LIRFrameState info = state();
7938
24e93ac47e95 Allocate temporary register for safepoint operation instead of using scratch register.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7937
diff changeset
109 append(new AMD64SafepointOp(info, runtime().config, this));
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
110 }
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
111
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
112 @Override
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
113 public void visitExceptionObject(ExceptionObjectNode x) {
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
114 HotSpotVMConfig config = runtime().config;
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
115 RegisterValue thread = runtime().threadRegister().asValue();
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7841
diff changeset
116 Value exception = emitLoad(Kind.Object, thread, config.threadExceptionOopOffset, Value.ILLEGAL, 0, false);
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7841
diff changeset
117 emitStore(Kind.Object, thread, config.threadExceptionOopOffset, Value.ILLEGAL, 0, Constant.NULL_OBJECT, false);
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7841
diff changeset
118 emitStore(Kind.Long, thread, config.threadExceptionPcOffset, Value.ILLEGAL, 0, Constant.LONG_0, false);
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
119 setResult(x, exception);
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
120 }
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
121
6491
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
122 @SuppressWarnings("hiding")
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
123 @Override
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
124 public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) {
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
125 Kind kind = x.newValue().kind();
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
126 assert kind == x.expectedValue().kind();
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
127
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
128 Value expected = loadNonConst(operand(x.expectedValue()));
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
129 Variable newVal = load(operand(x.newValue()));
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
130
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
131 int disp = 0;
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8136
diff changeset
132 AMD64AddressValue address;
6491
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
133 Value index = operand(x.offset());
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
134 if (ValueUtil.isConstant(index) && NumUtil.isInt(ValueUtil.asConstant(index).asLong() + disp)) {
7074
1361501d6bd5 added some more assertions to ensure that metadata constant are not emitted inline
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6950
diff changeset
135 assert !runtime.needsDataPatch(asConstant(index));
6491
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
136 disp += (int) ValueUtil.asConstant(index).asLong();
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8136
diff changeset
137 address = new AMD64AddressValue(kind, load(operand(x.object())), disp);
6491
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
138 } else {
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8136
diff changeset
139 address = new AMD64AddressValue(kind, load(operand(x.object())), load(index), Scale.Times1, disp);
6491
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
140 }
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
141
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
142 RegisterValue rax = AMD64.rax.asValue(kind);
7883
cc9b45598a4f Change argument order to be consistent with the rest of the backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7880
diff changeset
143 emitMove(rax, expected);
6491
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
144 append(new CompareAndSwapOp(rax, address, rax, newVal));
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
145
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
146 Variable result = newVariable(x.kind());
7883
cc9b45598a4f Change argument order to be consistent with the rest of the backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7880
diff changeset
147 emitMove(result, rax);
6491
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
148 setResult(x, result);
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
149 }
e61ef9ba27a8 refactored lowering of DirectCompareAndSwap node into HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 6490
diff changeset
150
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
151 @Override
6489
1f0edd29cc66 defined new HotSpot specific interface extending the contract of a LIR generator
Doug Simon <doug.simon@oracle.com>
parents: 6487
diff changeset
152 public void emitTailcall(Value[] args, Value address) {
1f0edd29cc66 defined new HotSpot specific interface extending the contract of a LIR generator
Doug Simon <doug.simon@oracle.com>
parents: 6487
diff changeset
153 append(new AMD64TailcallOp(args, address));
1f0edd29cc66 defined new HotSpot specific interface extending the contract of a LIR generator
Doug Simon <doug.simon@oracle.com>
parents: 6487
diff changeset
154
1f0edd29cc66 defined new HotSpot specific interface extending the contract of a LIR generator
Doug Simon <doug.simon@oracle.com>
parents: 6487
diff changeset
155 }
1f0edd29cc66 defined new HotSpot specific interface extending the contract of a LIR generator
Doug Simon <doug.simon@oracle.com>
parents: 6487
diff changeset
156
1f0edd29cc66 defined new HotSpot specific interface extending the contract of a LIR generator
Doug Simon <doug.simon@oracle.com>
parents: 6487
diff changeset
157 @Override
6478
62878ae057a5 added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents: 6470
diff changeset
158 protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
159 InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind();
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
160 if (invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual) {
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
161 append(new AMD64HotspotDirectVirtualCallOp(callTarget.target(), result, parameters, temps, callState, invokeKind));
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
162 } else {
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
163 assert invokeKind == InvokeKind.Static || invokeKind == InvokeKind.Special;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
164 HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) callTarget.target();
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
165 Constant metaspaceMethod = resolvedMethod.getMetaspaceMethodConstant();
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
166 append(new AMD64HotspotDirectStaticCallOp(callTarget.target(), result, parameters, temps, callState, invokeKind, metaspaceMethod));
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8128
diff changeset
167 }
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6364
diff changeset
168 }
5841
f84d11672a86 vtable dispatch inlining for megamorphic virtual calls now works and is enabled by default
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
169
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6364
diff changeset
170 @Override
6478
62878ae057a5 added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents: 6470
diff changeset
171 protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6676
diff changeset
172 Value metaspaceMethod = AMD64.rbx.asValue();
7883
cc9b45598a4f Change argument order to be consistent with the rest of the backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7880
diff changeset
173 emitMove(metaspaceMethod, operand(((HotSpotIndirectCallTargetNode) callTarget).metaspaceMethod()));
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6364
diff changeset
174 Value targetAddress = AMD64.rax.asValue();
7883
cc9b45598a4f Change argument order to be consistent with the rest of the backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7880
diff changeset
175 emitMove(targetAddress, operand(callTarget.computedAddress()));
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6676
diff changeset
176 append(new AMD64IndirectCallOp(callTarget.target(), result, parameters, temps, metaspaceMethod, targetAddress, callState));
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
177 }
8127
3d41998c30de Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7940
diff changeset
178
3d41998c30de Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7940
diff changeset
179 @Override
3d41998c30de Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7940
diff changeset
180 public void emitUnwind(Value exception) {
3d41998c30de Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7940
diff changeset
181 RegisterValue exceptionParameter = AMD64.rax.asValue();
3d41998c30de Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7940
diff changeset
182 emitMove(exceptionParameter, exception);
3d41998c30de Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7940
diff changeset
183 append(new AMD64HotSpotUnwindOp(exceptionParameter));
3d41998c30de Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7940
diff changeset
184 }
8209
5ceaf43459b5 Use a DeoptimizeOp to avoid spilling before the deoptimize runtime call
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8201
diff changeset
185
5ceaf43459b5 Use a DeoptimizeOp to avoid spilling before the deoptimize runtime call
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8201
diff changeset
186 @Override
5ceaf43459b5 Use a DeoptimizeOp to avoid spilling before the deoptimize runtime call
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8201
diff changeset
187 public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason) {
8217
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8209
diff changeset
188 append(new AMD64DeoptimizeOp(action, reason, state(reason)));
8209
5ceaf43459b5 Use a DeoptimizeOp to avoid spilling before the deoptimize runtime call
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8201
diff changeset
189 }
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
190
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
191 /**
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
192 * The slot reserved for storing the original return address when a frame is marked for
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
193 * deoptimization. The return address slot in the callee is overwritten with the address of
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
194 * a deoptimization stub.
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
195 */
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
196 StackSlot deoptimizationRescueSlot;
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
197
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
198 @Override
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
199 public void beforeRegisterAllocation() {
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
200 if (lir.hasDebugInfo()) {
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
201 deoptimizationRescueSlot = frameMap.allocateSpillSlot(Kind.Long);
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
202 }
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
203 }
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
204 }
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
205
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
206 /**
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
207 * Emits code to do stack overflow checking.
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
208 *
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
209 * @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
210 * the current frame
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
211 */
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
212 protected static void emitStackOverflowCheck(TargetMethodAssembler tasm, boolean afterFrameInit) {
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
213 if (GraalOptions.StackShadowPages > 0) {
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
214
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
215 AMD64MacroAssembler asm = (AMD64MacroAssembler) tasm.asm;
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
216 int frameSize = tasm.frameMap.frameSize();
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
217 if (frameSize > 0) {
7841
674a8b9e62f8 Remove unused fields in TargetDescription. Use Unsafe.pageSize().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7839
diff changeset
218 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
219 // 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
220 for (int i = 0; i <= lastFramePage; i++) {
7841
674a8b9e62f8 Remove unused fields in TargetDescription. Use Unsafe.pageSize().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7839
diff changeset
221 int disp = (i + GraalOptions.StackShadowPages) * unsafe.pageSize();
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
222 if (afterFrameInit) {
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
223 disp -= frameSize;
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
224 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
225 tasm.blockComment("[stack overflow check]");
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 8166
diff changeset
226 asm.movq(new AMD64Address(rsp, -disp), AMD64.rax);
7808
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
227 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
228 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
229 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
230 }
932a45568706 Move stack banging code to the AMD64-specific code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
231
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
232 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
233
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
234 @Override
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
235 public void enter(TargetMethodAssembler tasm) {
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
236 FrameMap frameMap = tasm.frameMap;
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
237 int frameSize = frameMap.frameSize();
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
238
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
239 AMD64MacroAssembler asm = (AMD64MacroAssembler) tasm.asm;
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
240 emitStackOverflowCheck(tasm, false);
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
241 asm.push(rbp);
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
242 asm.decrementq(rsp, frameSize - 8); // account for the push of RBP above
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
243 if (GraalOptions.ZapStackOnMethodEntry) {
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
244 final int intSize = 4;
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
245 for (int i = 0; i < frameSize / intSize; ++i) {
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 8166
diff changeset
246 asm.movl(new AMD64Address(rsp, i * intSize), 0xC1C1C1C1);
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
247 }
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
248 }
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
249 CalleeSaveLayout csl = frameMap.registerConfig.getCalleeSaveLayout();
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
250 if (csl != null && csl.size != 0) {
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
251 int frameToCSA = frameMap.offsetToCalleeSaveArea();
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
252 assert frameToCSA >= 0;
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
253 asm.save(csl, frameToCSA);
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
254 }
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
255 }
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
256
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
257 @Override
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
258 public void leave(TargetMethodAssembler tasm) {
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
259 int frameSize = tasm.frameMap.frameSize();
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
260 AMD64MacroAssembler asm = (AMD64MacroAssembler) tasm.asm;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
261 CalleeSaveLayout csl = tasm.frameMap.registerConfig.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
262
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
263 if (csl != null && csl.size != 0) {
7809
0fb4d10bd256 Small clean up of assembler and LIR.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7808
diff changeset
264 tasm.compilationResult.setRegisterRestoreEpilogueOffset(asm.codeBuffer.position());
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
265 // saved all registers, restore all registers
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
266 int frameToCSA = tasm.frameMap.offsetToCalleeSaveArea();
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
267 asm.restore(csl, frameToCSA);
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
268 }
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
269
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
270 asm.incrementq(rsp, frameSize - 8); // account for the pop of RBP below
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
271 asm.pop(rbp);
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
272 }
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
273 }
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
274
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
275 @Override
8281
8fde1be81b2d LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
276 public TargetMethodAssembler newAssembler(LIRGenerator lirGen, CompilationResult compilationResult) {
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
277 // 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
278 // - 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
279 // - has no callee-saved registers
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
280 // - has no incoming arguments passed on the stack
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
281 // - has no instructions with debug info
8281
8fde1be81b2d LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
282 FrameMap frameMap = lirGen.frameMap;
8fde1be81b2d LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
283 LIR lir = lirGen.lir;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
284 boolean omitFrame = GraalOptions.CanOmitFrame && frameMap.frameSize() == frameMap.initialFrameSize && frameMap.registerConfig.getCalleeSaveLayout().registers.length == 0 &&
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
285 !lir.hasArgInCallerFrame() && !lir.hasDebugInfo();
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
286
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
287 AbstractAssembler masm = new AMD64MacroAssembler(target, frameMap.registerConfig);
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
288 HotSpotFrameContext frameContext = omitFrame ? null : new HotSpotFrameContext();
8281
8fde1be81b2d LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
289 TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime(), frameMap, masm, frameContext, compilationResult);
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
290 tasm.setFrameSize(frameMap.frameSize());
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
291 StackSlot deoptimizationRescueSlot = ((HotSpotAMD64LIRGenerator) lirGen).deoptimizationRescueSlot;
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
292 if (deoptimizationRescueSlot != null) {
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
293 tasm.compilationResult.setCustomStackAreaOffset(frameMap.offsetForStackSlot(deoptimizationRescueSlot));
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
294 }
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
295 return tasm;
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 }
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
297
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
298 @Override
8281
8fde1be81b2d LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
299 public void emitCode(TargetMethodAssembler tasm, ResolvedJavaMethod method, LIRGenerator lirGen) {
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
300 AMD64MacroAssembler asm = (AMD64MacroAssembler) tasm.asm;
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
301 FrameMap frameMap = tasm.frameMap;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
302 RegisterConfig regConfig = frameMap.registerConfig;
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
303 HotSpotVMConfig config = runtime().config;
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
304 boolean isStatic = Modifier.isStatic(method.getModifiers());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
305 Label unverifiedStub = isStatic ? null : 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
306
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
307 // Emit the prefix
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
308
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
309 if (!isStatic) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6413
diff changeset
310 tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
311 CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{runtime().lookupJavaType(Object.class)}, target, false);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
312 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
313 // 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
314 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
315 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
316
5235
15c857decc43 fixed bug in call to unwindExceptionStub (exceptionOop arg was not be passed correctly)
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
317 asm.cmpq(inlineCacheKlass, src);
7824
dc497f975c37 Changes in backend due to assembly renamings. Use jccb in two places for smaller code size.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7817
diff changeset
318 asm.jcc(ConditionFlag.NotEqual, unverifiedStub);
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
319 }
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
320
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
321 asm.align(config.codeEntryAlignment);
6676
090868cbcda6 Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6675
diff changeset
322 tasm.recordMark(Marks.MARK_OSR_ENTRY);
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6413
diff changeset
323 tasm.recordMark(Marks.MARK_VERIFIED_ENTRY);
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
324
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
325 // Emit code for the LIR
8281
8fde1be81b2d LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
326 lirGen.lir.emitCode(tasm);
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
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
328 boolean frameOmitted = tasm.frameContext == null;
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
329 if (!frameOmitted) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6413
diff changeset
330 tasm.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY);
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
331 AMD64Call.directCall(tasm, asm, runtime().lookupRuntimeCall(EXCEPTION_HANDLER), null);
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
332
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6413
diff changeset
333 tasm.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY);
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
334 AMD64Call.directCall(tasm, asm, runtime().lookupRuntimeCall(DEOPT_HANDLER), 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
335 } 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
336 // 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
337 // it has no calls that can cause such "return" entries
8281
8fde1be81b2d LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
338 assert !frameMap.accessesCallerFrame() : method;
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
339 }
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
340
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
341 if (unverifiedStub != null) {
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
342 asm.bind(unverifiedStub);
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
343 AMD64Call.directJmp(tasm, asm, runtime().lookupRuntimeCall(IC_MISS_HANDLER));
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
344 }
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
345
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
346 for (int i = 0; i < GraalOptions.MethodEndBreakpointGuards; ++i) {
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
347 asm.int3();
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
348 }
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7121
diff changeset
349
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
350 }
7814
bab2a51f8dbe Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7809
diff changeset
351
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
352 }