Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java @ 8974:63e970d77f51
Common base class for method call operations.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 09 Apr 2013 20:00:17 +0200 |
parents | 0799a7efbe7b |
children | e92fdf3e1558 |
rev | line source |
---|---|
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
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:
6493
diff
changeset
|
23 package com.oracle.graal.hotspot.amd64; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.api.code.ValueUtil.*; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
6580
d56d600819fe
moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6531
diff
changeset
|
28 import com.oracle.graal.amd64.*; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.api.code.*; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 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
|
31 import com.oracle.graal.asm.amd64.*; |
6462 | 32 import com.oracle.graal.hotspot.bridge.*; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.lir.*; |
5848
aba97dd72b70
moved HotSpotXirGenerator to com.oracle.graal.hotspot.target.amd64
Doug Simon <doug.simon@oracle.com>
parents:
5844
diff
changeset
|
34 import com.oracle.graal.lir.LIRInstruction.Opcode; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.lir.amd64.*; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 import com.oracle.graal.lir.amd64.AMD64Call.IndirectCallOp; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 import com.oracle.graal.lir.asm.*; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
40 * A register indirect call that complies with the extra conventions for such calls in HotSpot. In |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
41 * particular, the metaspace Method of the callee must be in RBX for the case where a vtable entry's |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
42 * _from_compiled_entry is the address of an C2I adapter. Such adapters expect the target method to |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
43 * be in RBX. |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 */ |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 @Opcode("CALL_INDIRECT") |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 final class AMD64IndirectCallOp extends IndirectCallOp { |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 /** |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
49 * Vtable stubs expect the metaspace Method in RBX. |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 */ |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
51 public static final Register METHOD = AMD64.rbx; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
53 @Use({REG}) protected Value metaspaceMethod; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 |
8974
63e970d77f51
Common base class for method call operations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7935
diff
changeset
|
55 AMD64IndirectCallOp(ResolvedJavaMethod targetMethod, Value result, Value[] parameters, Value[] temps, Value metaspaceMethod, Value targetAddress, LIRFrameState state) { |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6476
diff
changeset
|
56 super(targetMethod, result, parameters, temps, targetAddress, state); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
57 this.metaspaceMethod = metaspaceMethod; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 } |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 @Override |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { |
7935
0799a7efbe7b
Clean up of usage of marks and code installation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7814
diff
changeset
|
62 tasm.recordMark(Marks.MARK_INLINE_INVOKE); |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 Register callReg = asRegister(targetAddress); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
64 assert callReg != METHOD; |
7143
445193cc2a7d
added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents:
6950
diff
changeset
|
65 AMD64Call.indirectCall(tasm, masm, callReg, callTarget, state); |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 } |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 @Override |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 protected void verify() { |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 super.verify(); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
71 assert asRegister(metaspaceMethod) == METHOD; |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 } |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 } |