Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPushInterpreterFrameOp.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 | be44c1ca8f00 |
children | 1da7aef31a08 |
rev | line source |
---|---|
15104 | 1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.graal.hotspot.amd64; | |
24 | |
25 import static com.oracle.graal.amd64.AMD64.*; | |
26 import static com.oracle.graal.api.code.ValueUtil.*; | |
27 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; | |
28 | |
29 import com.oracle.graal.api.code.*; | |
30 import com.oracle.graal.api.meta.*; | |
31 import com.oracle.graal.asm.amd64.*; | |
32 import com.oracle.graal.hotspot.*; | |
33 import com.oracle.graal.lir.*; | |
34 import com.oracle.graal.lir.amd64.*; | |
35 import com.oracle.graal.lir.asm.*; | |
36 | |
37 /** | |
38 * Pushes an interpreter frame to the stack. | |
39 */ | |
40 @Opcode("PUSH_INTERPRETER_FRAME") | |
41 final class AMD64HotSpotPushInterpreterFrameOp extends AMD64LIRInstruction { | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18526
diff
changeset
|
42 public static final LIRInstructionClass<AMD64HotSpotPushInterpreterFrameOp> TYPE = LIRInstructionClass.create(AMD64HotSpotPushInterpreterFrameOp.class); |
15104 | 43 |
44 @Alive(REG) AllocatableValue frameSize; | |
45 @Alive(REG) AllocatableValue framePc; | |
46 @Alive(REG) AllocatableValue senderSp; | |
47 @Alive(REG) AllocatableValue initialInfo; | |
18526
be44c1ca8f00
removed static access to HotSpotGraalRuntime from some AMD64 HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents:
15104
diff
changeset
|
48 private final HotSpotVMConfig config; |
15104 | 49 |
18526
be44c1ca8f00
removed static access to HotSpotGraalRuntime from some AMD64 HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents:
15104
diff
changeset
|
50 AMD64HotSpotPushInterpreterFrameOp(AllocatableValue frameSize, AllocatableValue framePc, AllocatableValue senderSp, AllocatableValue initialInfo, HotSpotVMConfig config) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18526
diff
changeset
|
51 super(TYPE); |
15104 | 52 this.frameSize = frameSize; |
53 this.framePc = framePc; | |
54 this.senderSp = senderSp; | |
55 this.initialInfo = initialInfo; | |
18526
be44c1ca8f00
removed static access to HotSpotGraalRuntime from some AMD64 HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents:
15104
diff
changeset
|
56 this.config = config; |
15104 | 57 } |
58 | |
59 @Override | |
60 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | |
61 final Register frameSizeRegister = asRegister(frameSize); | |
62 final Register framePcRegister = asRegister(framePc); | |
63 final Register senderSpRegister = asRegister(senderSp); | |
64 final Register initialInfoRegister = asRegister(initialInfo); | |
18526
be44c1ca8f00
removed static access to HotSpotGraalRuntime from some AMD64 HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents:
15104
diff
changeset
|
65 final int wordSize = 8; |
15104 | 66 |
67 // We'll push PC and BP by hand. | |
68 masm.subq(frameSizeRegister, 2 * wordSize); | |
69 | |
70 // Push return address. | |
71 masm.push(framePcRegister); | |
72 | |
73 // Prolog | |
74 masm.push(initialInfoRegister); | |
75 masm.movq(initialInfoRegister, rsp); | |
76 masm.subq(rsp, frameSizeRegister); | |
77 | |
78 // This value is corrected by layout_activation_impl. | |
79 masm.movptr(new AMD64Address(initialInfoRegister, config.frameInterpreterFrameLastSpOffset * wordSize), 0); | |
80 | |
81 // Make the frame walkable. | |
82 masm.movq(new AMD64Address(initialInfoRegister, config.frameInterpreterFrameSenderSpOffset * wordSize), senderSpRegister); | |
83 } | |
84 } |