annotate graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotEnterUnpackFramesStackFrameOp.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 2d401b9ca70d
children 96ab2078eeaf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
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: 17206
diff changeset
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
4 *
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
8 *
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
13 * accompanied this code).
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
14 *
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
18 *
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
21 * questions.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
22 */
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
23 package com.oracle.graal.hotspot.sparc;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
24
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
25 import static com.oracle.graal.sparc.SPARC.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
26 import static com.oracle.graal.api.code.ValueUtil.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
27 import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
28 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
29
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
30 import com.oracle.graal.api.code.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
31 import com.oracle.graal.api.meta.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
32 import com.oracle.graal.asm.sparc.*;
15968
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15345
diff changeset
33 import com.oracle.graal.hotspot.*;
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
34 import com.oracle.graal.lir.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
35 import com.oracle.graal.lir.sparc.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
36 import com.oracle.graal.lir.asm.*;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
37
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
38 /**
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
39 * Emits code that enters a stack frame which is tailored to call the C++ method
15968
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15345
diff changeset
40 * {@link HotSpotBackend#UNPACK_FRAMES Deoptimization::unpack_frames}.
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
41 */
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
42 @Opcode("ENTER_UNPACK_FRAMES_STACK_FRAME")
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
43 final class SPARCHotSpotEnterUnpackFramesStackFrameOp extends SPARCLIRInstruction {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17206
diff changeset
44 public static final LIRInstructionClass<SPARCHotSpotEnterUnpackFramesStackFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotEnterUnpackFramesStackFrameOp.class);
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
45
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
46 private final Register thread;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
47 private final int threadLastJavaSpOffset;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
48 private final int threadLastJavaPcOffset;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
49 @Alive(REG) AllocatableValue framePc;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
50 @Alive(REG) AllocatableValue senderSp;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
51 @Temp(REG) AllocatableValue scratch;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
52
16943
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
53 SPARCHotSpotEnterUnpackFramesStackFrameOp(Register thread, int threadLastJavaSpOffset, int threadLastJavaPcOffset, AllocatableValue framePc, AllocatableValue senderSp, AllocatableValue scratch) {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17206
diff changeset
54 super(TYPE);
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
55 this.thread = thread;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
56 this.threadLastJavaSpOffset = threadLastJavaSpOffset;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
57 this.threadLastJavaPcOffset = threadLastJavaPcOffset;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
58 this.framePc = framePc;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
59 this.senderSp = senderSp;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
60 this.scratch = scratch;
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
61 }
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
62
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
63 @Override
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
64 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
65 final int totalFrameSize = crb.frameMap.totalFrameSize();
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
66 Register framePcRegister = asRegister(framePc);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
67 Register senderSpRegister = asRegister(senderSp);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
68 Register scratchRegister = asRegister(scratch);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
69
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
70 // Save final sender SP to O5_savedSP.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
71 new Mov(senderSpRegister, o5).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
72
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
73 // Load final frame PC.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
74 new Mov(framePcRegister, o7).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
75
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
76 // Allocate a full sized frame.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
77 new Save(sp, -totalFrameSize, sp).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
78
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
79 new Mov(i0, o0).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
80 new Mov(i1, o1).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
81 new Mov(i2, o2).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
82 new Mov(i3, o3).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
83 new Mov(i4, o4).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
84
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
85 // Set up last Java values.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
86 new Add(sp, STACK_BIAS, scratchRegister).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
87 new Stx(scratchRegister, new SPARCAddress(thread, threadLastJavaSpOffset)).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
88
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
89 // Clear last Java PC.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
90 new Stx(g0, new SPARCAddress(thread, threadLastJavaPcOffset)).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
91
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
92 /*
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
93 * Safe thread register manually since we are not using LEAF_SP for {@link
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
94 * DeoptimizationStub#UNPACK_FRAMES}.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
95 */
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
96 new Mov(thread, l7).emit(masm);
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
97 }
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
98
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
99 @Override
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
100 public boolean leavesRegisterWindow() {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
101 return true;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
102 }
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents:
diff changeset
103 }