Mercurial > hg > truffle
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 |
rev | line source |
---|---|
15345 | 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 | 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.sparc; | |
24 | |
25 import static com.oracle.graal.sparc.SPARC.*; | |
26 import static com.oracle.graal.api.code.ValueUtil.*; | |
27 import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; | |
28 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; | |
29 | |
30 import com.oracle.graal.api.code.*; | |
31 import com.oracle.graal.api.meta.*; | |
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 | 34 import com.oracle.graal.lir.*; |
35 import com.oracle.graal.lir.sparc.*; | |
36 import com.oracle.graal.lir.asm.*; | |
37 | |
38 /** | |
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 | 41 */ |
42 @Opcode("ENTER_UNPACK_FRAMES_STACK_FRAME") | |
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 | 45 |
46 private final Register thread; | |
47 private final int threadLastJavaSpOffset; | |
48 private final int threadLastJavaPcOffset; | |
49 @Alive(REG) AllocatableValue framePc; | |
50 @Alive(REG) AllocatableValue senderSp; | |
51 @Temp(REG) AllocatableValue scratch; | |
52 | |
16943 | 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 | 55 this.thread = thread; |
56 this.threadLastJavaSpOffset = threadLastJavaSpOffset; | |
57 this.threadLastJavaPcOffset = threadLastJavaPcOffset; | |
58 this.framePc = framePc; | |
59 this.senderSp = senderSp; | |
60 this.scratch = scratch; | |
61 } | |
62 | |
63 @Override | |
64 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { | |
65 final int totalFrameSize = crb.frameMap.totalFrameSize(); | |
66 Register framePcRegister = asRegister(framePc); | |
67 Register senderSpRegister = asRegister(senderSp); | |
68 Register scratchRegister = asRegister(scratch); | |
69 | |
70 // Save final sender SP to O5_savedSP. | |
71 new Mov(senderSpRegister, o5).emit(masm); | |
72 | |
73 // Load final frame PC. | |
74 new Mov(framePcRegister, o7).emit(masm); | |
75 | |
76 // Allocate a full sized frame. | |
77 new Save(sp, -totalFrameSize, sp).emit(masm); | |
78 | |
79 new Mov(i0, o0).emit(masm); | |
80 new Mov(i1, o1).emit(masm); | |
81 new Mov(i2, o2).emit(masm); | |
82 new Mov(i3, o3).emit(masm); | |
83 new Mov(i4, o4).emit(masm); | |
84 | |
85 // Set up last Java values. | |
86 new Add(sp, STACK_BIAS, scratchRegister).emit(masm); | |
87 new Stx(scratchRegister, new SPARCAddress(thread, threadLastJavaSpOffset)).emit(masm); | |
88 | |
89 // Clear last Java PC. | |
90 new Stx(g0, new SPARCAddress(thread, threadLastJavaPcOffset)).emit(masm); | |
91 | |
92 /* | |
93 * Safe thread register manually since we are not using LEAF_SP for {@link | |
94 * DeoptimizationStub#UNPACK_FRAMES}. | |
95 */ | |
96 new Mov(thread, l7).emit(masm); | |
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 | 103 } |