Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64IndirectCallOp.java @ 6462:b3f5dc099f9d
removed XIR
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sun, 30 Sep 2012 13:21:20 +0200 |
parents | aba97dd72b70 |
children | 64d6e2343a68 |
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 */ |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.target.amd64; |
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 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 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
|
29 import com.oracle.graal.api.meta.*; |
6462 | 30 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 import com.oracle.max.asm.target.amd64.*; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 |
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 * A register indirect call that complies with the extra conventions for such calls in HotSpot. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 * In particular, the methodOop of the callee must be in RBX for the case where a vtable entry's |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 * _from_compiled_entry is the address of an C2I adapter. Such adapters expect the target |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 * method to be in RBX. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 */ |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 @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
|
45 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
|
46 |
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 * Vtable stubs expect the methodOop in RBX. |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 */ |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 public static final Register METHOD_OOP = AMD64.rbx; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 @Use({REG}) protected Value methodOop; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 AMD64IndirectCallOp(Object targetMethod, Value result, Value[] parameters, Value methodOop, Value targetAddress, LIRFrameState state) { |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 super(targetMethod, result, parameters, targetAddress, state, null); |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 this.methodOop = methodOop; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 } |
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 @Override |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { |
6462 | 61 tasm.recordMark(Marks.MARK_INLINE_INVOKEVIRTUAL); |
5844
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 Register callReg = asRegister(targetAddress); |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 assert callReg != METHOD_OOP; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 AMD64Call.indirectCall(tasm, masm, callReg, targetMethod, state); |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 } |
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 @Override |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 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
|
69 super.verify(); |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 assert asRegister(methodOop) == METHOD_OOP; |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 } |
a432e6d43aa1
fixed bugs related to -G:+InlineVTableStubs and re-enabled it by default
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 } |