Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java @ 19526:8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 20 Feb 2015 22:22:55 +0100 |
parents | 1a66453f73db |
children | 48c1ebd24120 |
rev | line source |
---|---|
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
1 /* |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13227
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
4 * |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
8 * |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
14 * |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
18 * |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
21 * questions. |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
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:
6493
diff
changeset
|
23 package com.oracle.graal.hotspot.amd64; |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
24 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
25 import static com.oracle.graal.api.code.ValueUtil.*; |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
26 |
5855
0278da961319
moved InstalledCode from graal.api.meta to graal.api.code
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
27 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
|
28 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:
6495
diff
changeset
|
29 import com.oracle.graal.asm.amd64.*; |
9856
fbeda9df497d
implemented workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=409824
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
30 import com.oracle.graal.lir.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.lir.amd64.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.lir.asm.*; |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
33 |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
34 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6531
diff
changeset
|
35 * Performs a hard-coded tail call to the specified target, which normally should be an |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6531
diff
changeset
|
36 * {@link InstalledCode} instance. |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
37 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
38 @Opcode("TAILCALL") |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13227
diff
changeset
|
39 public final class AMD64TailcallOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13227
diff
changeset
|
40 public static final LIRInstructionClass<AMD64TailcallOp> TYPE = LIRInstructionClass.create(AMD64TailcallOp.class); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6531
diff
changeset
|
41 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
42 @Use protected Value target; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
43 @Alive protected Value[] parameters; |
4408
b197bbb58d2f
Fix and improve tail call.
Andreas Woess <andreas.woess@jku.at>
parents:
4323
diff
changeset
|
44 |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
5855
diff
changeset
|
45 public AMD64TailcallOp(Value[] parameters, Value target) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13227
diff
changeset
|
46 super(TYPE); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
47 this.target = target; |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
5855
diff
changeset
|
48 this.parameters = parameters; |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
49 } |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
50 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4319
diff
changeset
|
51 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
10445
diff
changeset
|
52 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4319
diff
changeset
|
53 // destroy the current frame (now the return address is the top of stack) |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4319
diff
changeset
|
54 masm.leave(); |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
55 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4319
diff
changeset
|
56 // jump to the target method |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
57 masm.jmp(asRegister(target)); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4319
diff
changeset
|
58 masm.ensureUniquePC(); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4319
diff
changeset
|
59 } |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
60 } |