comparison graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveUnpackFramesStackFrameOp.java @ 15345:109d6c7c40b5

implement SPARC uncommon trap stub
author twisti
date Wed, 23 Apr 2014 15:12:41 -1000
parents
children 42eaa579e134
comparison
equal deleted inserted replaced
15344:8065d79ccd49 15345:109d6c7c40b5
1 /*
2 * Copyright (c) 2014, 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.sparc;
24
25 import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*;
26 import static com.oracle.graal.sparc.SPARC.*;
27
28 import com.oracle.graal.api.code.*;
29 import com.oracle.graal.asm.sparc.*;
30 import com.oracle.graal.hotspot.stubs.*;
31 import com.oracle.graal.lir.*;
32 import com.oracle.graal.lir.sparc.*;
33 import com.oracle.graal.lir.asm.*;
34
35 /**
36 * Emits code that leaves a stack frame which is tailored to call the C++ method
37 * {@link DeoptimizationStub#UNPACK_FRAMES Deoptimization::unpack_frames}.
38 */
39 @Opcode("LEAVE_UNPACK_FRAMES_STACK_FRAME")
40 final class SPARCHotSpotLeaveUnpackFramesStackFrameOp extends SPARCLIRInstruction {
41
42 private final Register thread;
43 private final int threadLastJavaSpOffset;
44 private final int threadLastJavaPcOffset;
45 private final int threadJavaFrameAnchorFlagsOffset;
46
47 SPARCHotSpotLeaveUnpackFramesStackFrameOp(Register thread, int threadLastJavaSpOffset, int threadLastJavaPcOffset, int threadJavaFrameAnchorFlagsOffset) {
48 this.thread = thread;
49 this.threadLastJavaSpOffset = threadLastJavaSpOffset;
50 this.threadLastJavaPcOffset = threadLastJavaPcOffset;
51 this.threadJavaFrameAnchorFlagsOffset = threadJavaFrameAnchorFlagsOffset;
52 }
53
54 @Override
55 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
56 /*
57 * Safe thread register manually since we are not using LEAF_SP for {@link
58 * DeoptimizationStub#UNPACK_FRAMES}.
59 */
60 new Mov(l7, thread).emit(masm);
61
62 // Clear last Java frame values.
63 new Stx(g0, new SPARCAddress(thread, threadLastJavaSpOffset)).emit(masm);
64 new Stx(g0, new SPARCAddress(thread, threadLastJavaPcOffset)).emit(masm);
65 new Stw(g0, new SPARCAddress(thread, threadJavaFrameAnchorFlagsOffset)).emit(masm);
66 }
67 }