Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java @ 6478:62878ae057a5
added support for temps in LIR call instructions
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 02 Oct 2012 13:58:36 +0200 |
parents | b1010f7bc0bf |
children | e8be2bb3760e |
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 */ |
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
|
23 package com.oracle.graal.hotspot.target.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
|
24 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
25 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
|
26 import static com.oracle.graal.api.code.ValueUtil.*; |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
27 import static com.oracle.graal.api.meta.Value.*; |
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 import static com.oracle.max.asm.target.amd64.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
|
29 |
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 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
|
31 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
32 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
|
33 import com.oracle.graal.api.meta.*; |
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
|
34 import com.oracle.graal.compiler.*; |
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
|
35 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
|
36 import com.oracle.graal.compiler.target.*; |
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
|
37 import com.oracle.graal.compiler.target.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
|
38 import com.oracle.graal.graph.*; |
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.hotspot.*; |
6462 | 40 import com.oracle.graal.hotspot.bridge.*; |
5318
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5273
diff
changeset
|
41 import com.oracle.graal.hotspot.counters.*; |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
42 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
|
43 import com.oracle.graal.hotspot.nodes.*; |
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
|
44 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
|
45 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
|
46 import com.oracle.graal.lir.asm.*; |
5236
f9aae727d035
removed XIR safepoint operation
Doug Simon <doug.simon@oracle.com>
parents:
5235
diff
changeset
|
47 import com.oracle.graal.nodes.*; |
5242
f46d82be6e19
ExceptionObjectNode is now lowered without XIR
Doug Simon <doug.simon@oracle.com>
parents:
5236
diff
changeset
|
48 import com.oracle.graal.nodes.java.*; |
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
|
49 import com.oracle.max.asm.*; |
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
|
50 import com.oracle.max.asm.target.amd64.*; |
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
|
51 import com.oracle.max.asm.target.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
|
52 |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
5841
diff
changeset
|
53 /** |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
5841
diff
changeset
|
54 * 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
|
55 */ |
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 public class HotSpotAMD64Backend extends Backend { |
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
|
57 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
58 public HotSpotAMD64Backend(CodeCacheProvider 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
|
59 super(runtime, target); |
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
|
60 } |
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 |
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 @Override |
6462 | 63 public LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) { |
64 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
|
65 } |
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
|
66 |
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
|
67 static final class HotSpotAMD64LIRGenerator extends AMD64LIRGenerator { |
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
|
68 |
6462 | 69 private HotSpotAMD64LIRGenerator(Graph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) { |
70 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
|
71 } |
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
|
72 |
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
|
73 @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
|
74 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
|
75 LIRFrameState info = state(); |
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
|
76 append(new AMD64SafepointOp(info, ((HotSpotRuntime) runtime).config)); |
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 } |
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
|
78 |
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
|
79 @Override |
6413
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
80 public void visitBreakpointNode(BreakpointNode i) { |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
81 Kind[] sig = new Kind[i.arguments.size()]; |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
82 int pos = 0; |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
83 for (ValueNode arg : i.arguments) { |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
84 sig[pos++] = arg.kind(); |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
85 } |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
86 |
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
|
87 CallingConvention cc = frameMap.registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, Kind.Void, sig, target(), false); |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
88 Value[] parameters = visitInvokeArguments(cc, i.arguments); |
6413
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
89 append(new AMD64BreakpointOp(parameters)); |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
90 } |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
91 |
258d3e0b5a65
added support for placing breakpoints in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
92 @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
|
93 public void visitExceptionObject(ExceptionObjectNode x) { |
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
|
94 HotSpotVMConfig config = ((HotSpotRuntime) runtime).config; |
6364
07da50ea3275
thread register is now retrieved from HotSpotVMConfig instead of being hard coded
Doug Simon <doug.simon@oracle.com>
parents:
6338
diff
changeset
|
95 RegisterValue thread = config.threadRegister.asValue(); |
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
|
96 Address exceptionAddress = new Address(Kind.Object, thread, config.threadExceptionOopOffset); |
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
|
97 Address pcAddress = new Address(Kind.Long, thread, config.threadExceptionPcOffset); |
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
|
98 Value exception = emitLoad(exceptionAddress, false); |
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
|
99 emitStore(exceptionAddress, Constant.NULL_OBJECT, false); |
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
|
100 emitStore(pcAddress, Constant.LONG_0, false); |
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
|
101 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
|
102 } |
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
|
103 |
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
|
104 @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
|
105 protected void emitPrologue() { |
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
|
106 super.emitPrologue(); |
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 MethodEntryCounters.emitCounter(this, method); |
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 } |
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
|
109 |
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 @Override |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
111 protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) { |
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
112 append(new AMD64DirectCallOp(callTarget.target(), result, parameters, temps, callState, ((HotSpotDirectCallTargetNode) callTarget).invokeKind(), lir)); |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6364
diff
changeset
|
113 } |
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
|
114 |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6364
diff
changeset
|
115 @Override |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
116 protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) { |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6364
diff
changeset
|
117 Value methodOop = AMD64.rbx.asValue(); |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6364
diff
changeset
|
118 emitMove(operand(((HotSpotIndirectCallTargetNode) callTarget).methodOop()), methodOop); |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6364
diff
changeset
|
119 Value targetAddress = AMD64.rax.asValue(); |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6364
diff
changeset
|
120 emitMove(operand(callTarget.computedAddress()), targetAddress); |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
121 append(new AMD64IndirectCallOp(callTarget.target(), result, parameters, temps, methodOop, 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
|
122 } |
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
|
123 } |
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
|
124 |
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
|
125 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
|
126 |
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
|
127 @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
|
128 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
|
129 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
|
130 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
|
131 |
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
|
132 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
|
133 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
|
134 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
|
135 asm.movq(rbp, rsp); |
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
|
136 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
|
137 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
|
138 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
|
139 for (int i = 0; i < frameSize / intSize; ++i) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
140 asm.movl(new Address(Kind.Int, rsp.asValue(), 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
|
141 } |
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
|
142 } |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 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
|
147 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
|
148 } |
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
|
149 } |
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
|
150 |
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
|
151 @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
|
152 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
|
153 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
|
154 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
|
155 CalleeSaveLayout csl = tasm.frameMap.registerConfig.getCalleeSaveLayout(); |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
156 RegisterConfig regConfig = tasm.frameMap.registerConfig; |
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 |
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
|
158 if (csl != null && csl.size != 0) { |
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
|
159 tasm.targetMethod.setRegisterRestoreEpilogueOffset(asm.codeBuffer.position()); |
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
|
160 // 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
|
161 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
|
162 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
|
163 } |
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
|
164 |
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
|
165 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
|
166 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
|
167 |
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 if (GraalOptions.GenSafepoints) { |
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
|
169 HotSpotVMConfig config = ((HotSpotRuntime) runtime).config; |
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
|
170 |
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
|
171 // If at the return point, then the frame has already been popped |
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
|
172 // so deoptimization cannot be performed here. The HotSpot runtime |
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
|
173 // detects this case - see the definition of frame::should_be_deoptimized() |
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
|
174 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
175 Register scratch = regConfig.getScratchRegister(); |
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
|
176 if (config.isPollingPageFar) { |
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
|
177 asm.movq(scratch, config.safepointPollingAddress); |
6462 | 178 tasm.recordMark(Marks.MARK_POLL_RETURN_FAR); |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
179 asm.movq(scratch, new Address(tasm.target.wordKind, scratch.asValue())); |
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
|
180 } else { |
6462 | 181 tasm.recordMark(Marks.MARK_POLL_RETURN_NEAR); |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
182 asm.movq(scratch, new Address(tasm.target.wordKind, rip.asValue())); |
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
|
183 } |
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
|
184 } |
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
|
185 } |
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
|
186 } |
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 @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
|
189 public TargetMethodAssembler newAssembler(FrameMap frameMap, LIR lir) { |
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
|
190 // Omit the frame if the method: |
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
|
191 // - has no spill slots or other slots allocated during register allocation |
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
|
192 // - has no callee-saved registers |
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
|
193 // - has no incoming arguments passed on the stack |
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
|
194 // - has no instructions with debug info |
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
|
195 boolean canOmitFrame = |
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
|
196 frameMap.frameSize() == frameMap.initialFrameSize && |
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
|
197 frameMap.registerConfig.getCalleeSaveLayout().registers.length == 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
|
198 !lir.hasArgInCallerFrame() && |
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
|
199 !lir.hasDebugInfo(); |
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
|
200 |
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
|
201 AbstractAssembler masm = new AMD64MacroAssembler(target, frameMap.registerConfig); |
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
|
202 HotSpotFrameContext frameContext = canOmitFrame ? null : new HotSpotFrameContext(); |
5273
7689999f0ea6
improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
203 TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime, frameMap, masm, frameContext, lir.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
|
204 tasm.setFrameSize(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
|
205 tasm.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea()); |
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 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
|
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 |
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
|
209 @Override |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
210 public void emitCode(TargetMethodAssembler tasm, ResolvedJavaMethod method, LIR 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
|
211 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
|
212 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
|
213 RegisterConfig regConfig = frameMap.registerConfig; |
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
|
214 HotSpotVMConfig config = ((HotSpotRuntime) runtime).config; |
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
|
215 Label unverifiedStub = new Label(); |
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
|
216 |
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
|
217 // Emit the prefix |
6462 | 218 tasm.recordMark(Marks.MARK_OSR_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
|
219 |
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
|
220 boolean isStatic = Modifier.isStatic(method.accessFlags()); |
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
|
221 if (!isStatic) { |
6462 | 222 tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY); |
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
|
223 CallingConvention cc = regConfig.getCallingConvention(JavaCallee, Kind.Void, new Kind[] {Kind.Object}, target, false); |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
224 Register inlineCacheKlass = rax; // see definition of IC_Klass in 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
|
225 Register receiver = asRegister(cc.getArgument(0)); |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
226 Address src = new Address(target.wordKind, receiver.asValue(), 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
|
227 |
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
|
228 asm.cmpq(inlineCacheKlass, src); |
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
|
229 asm.jcc(ConditionFlag.notEqual, unverifiedStub); |
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
|
230 } |
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
|
231 |
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 asm.align(config.codeEntryAlignment); |
6462 | 233 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
|
234 |
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 // Emit code for the 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
|
236 lir.emitCode(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
|
237 |
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 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
|
239 if (!frameOmitted) { |
6462 | 240 tasm.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY); |
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
|
241 AMD64Call.directCall(tasm, asm, config.handleExceptionStub, 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
|
242 AMD64Call.shouldNotReachHere(tasm, asm); |
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
|
243 |
6462 | 244 tasm.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY); |
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
|
245 AMD64Call.directCall(tasm, asm, config.handleDeoptStub, 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
|
246 AMD64Call.shouldNotReachHere(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
|
247 } 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
|
248 // 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
|
249 // it has no calls that can cause such "return" entries |
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 assert !frameMap.accessesCallerFrame(); |
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 } |
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
|
252 |
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
|
253 if (!isStatic) { |
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 asm.bind(unverifiedStub); |
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 AMD64Call.directJmp(tasm, asm, config.inlineCacheMissStub); |
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 |
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 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
|
259 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
|
260 } |
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
|
261 } |
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 } |