annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java @ 14991:64dcb92ee75a

Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 06 Apr 2014 17:46:24 +0200
parents 6bab029d6e3a
children 5c71dcf0915d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.amd64;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import com.oracle.graal.amd64.*;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import com.oracle.graal.api.meta.*;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import com.oracle.graal.asm.amd64.*;
10771
ec8ee1c2ad7a Move non_oop_bits value up to Graal.
twisti
parents: 9856
diff changeset
28 import com.oracle.graal.hotspot.*;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 13520
diff changeset
29 import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId;
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30 import com.oracle.graal.lir.*;
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14574
diff changeset
31 import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp;
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 import com.oracle.graal.lir.amd64.*;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 import com.oracle.graal.lir.asm.*;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 /**
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 * A direct call that complies with the conventions for such calls in HotSpot. In particular, for
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 * calls using an inline cache, a MOVE instruction is emitted just prior to the aligned direct call.
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 */
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 @Opcode("CALL_DIRECT")
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 final class AMD64HotspotDirectStaticCallOp extends DirectCallOp {
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 private final Constant metaspaceMethod;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 private final InvokeKind invokeKind;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45
8333
e9c6fc513719 Remove last usages of scratch register. Separate runtime calls from normal method calls in LIR.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8136
diff changeset
46 AMD64HotspotDirectStaticCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind, Constant metaspaceMethod) {
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 super(target, result, parameters, temps, state);
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 assert invokeKind == InvokeKind.Static || invokeKind == InvokeKind.Special;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 this.metaspaceMethod = metaspaceMethod;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 this.invokeKind = invokeKind;
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 }
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
54 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 // The mark for an invocation that uses an inline cache must be placed at the
10771
ec8ee1c2ad7a Move non_oop_bits value up to Graal.
twisti
parents: 9856
diff changeset
56 // instruction that loads the Klass from the inline cache.
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
57 AMD64Move.move(crb, masm, AMD64.rbx.asValue(Kind.Long), metaspaceMethod);
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 13520
diff changeset
58 MarkId.recordMark(crb, invokeKind == InvokeKind.Static ? MarkId.INVOKESTATIC : MarkId.INVOKESPECIAL);
13520
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13227
diff changeset
59 // This must be emitted exactly like this to ensure it's patchable
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13227
diff changeset
60 masm.movq(AMD64.rax, HotSpotGraalRuntime.runtime().getConfig().nonOopBits);
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
61 super.emitCode(crb, masm);
8136
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 }
c66aa27ef4da Reenable patching of optimized and static calls but without out-of-line stubs.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 }