annotate graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java @ 19530:863c42893cc4

[SPARC] Fix SPARCHotSpotJumpToExceptionHandlerInCallerOp and SPARCAllocatorTest
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Sat, 21 Feb 2015 22:26:55 +0100
parents 8fc336a04d77
children 96ab2078eeaf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
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: 18705
diff changeset
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
4 *
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
8 *
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
13 * accompanied this code).
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
14 *
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
18 *
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
21 * questions.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
22 */
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
23 package com.oracle.graal.hotspot.sparc;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
24
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
25 import static com.oracle.graal.api.code.ValueUtil.*;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
26 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
27 import static com.oracle.graal.sparc.SPARC.*;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
28
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
29 import com.oracle.graal.api.code.*;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
30 import com.oracle.graal.api.meta.*;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
31 import com.oracle.graal.asm.sparc.*;
18705
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
32 import com.oracle.graal.asm.sparc.SPARCAssembler.CC;
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
33 import com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag;
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
34 import com.oracle.graal.asm.sparc.SPARCAssembler.Jmpl;
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
35 import com.oracle.graal.asm.sparc.SPARCAssembler.Lduw;
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
36 import com.oracle.graal.asm.sparc.SPARCAssembler.Movcc;
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
37 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Cmp;
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
38 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Nop;
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
39 import com.oracle.graal.lir.*;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
40 import com.oracle.graal.lir.asm.*;
18705
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
41 import com.oracle.graal.sparc.*;
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
42
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
43 /**
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
44 * Sets up the arguments for an exception handler in the callers frame, removes the current frame
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
45 * and jumps to the handler.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
46 */
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
47 @Opcode("JUMP_TO_EXCEPTION_HANDLER_IN_CALLER")
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
48 final class SPARCHotSpotJumpToExceptionHandlerInCallerOp extends SPARCHotSpotEpilogueOp {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
49
19530
863c42893cc4 [SPARC] Fix SPARCHotSpotJumpToExceptionHandlerInCallerOp and SPARCAllocatorTest
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19526
diff changeset
50 public static final LIRInstructionClass<SPARCHotSpotJumpToExceptionHandlerInCallerOp> TYPE = LIRInstructionClass.create(SPARCHotSpotJumpToExceptionHandlerInCallerOp.class);
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18705
diff changeset
51
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
52 @Use(REG) AllocatableValue handlerInCallerPc;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
53 @Use(REG) AllocatableValue exception;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
54 @Use(REG) AllocatableValue exceptionPc;
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
55 private final Register thread;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
56 private final int isMethodHandleReturnOffset;
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
57
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
58 SPARCHotSpotJumpToExceptionHandlerInCallerOp(AllocatableValue handlerInCallerPc, AllocatableValue exception, AllocatableValue exceptionPc, int isMethodHandleReturnOffset, Register thread) {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18705
diff changeset
59 super(TYPE);
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
60 this.handlerInCallerPc = handlerInCallerPc;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
61 this.exception = exception;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
62 this.exceptionPc = exceptionPc;
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
63 this.isMethodHandleReturnOffset = isMethodHandleReturnOffset;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
64 this.thread = thread;
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
65 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
66
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
67 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
68 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
16310
2fc9d69be77e Fixing stub call to unwindExceptionToCaller and jumpToExceptionHandler
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 13227
diff changeset
69 // Move the values up one level to be the input for the next call.
2fc9d69be77e Fixing stub call to unwindExceptionToCaller and jumpToExceptionHandler
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 13227
diff changeset
70 new SPARCMacroAssembler.Mov(asRegister(handlerInCallerPc), i2).emit(masm);
2fc9d69be77e Fixing stub call to unwindExceptionToCaller and jumpToExceptionHandler
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 13227
diff changeset
71 new SPARCMacroAssembler.Mov(asRegister(exception), i0).emit(masm);
2fc9d69be77e Fixing stub call to unwindExceptionToCaller and jumpToExceptionHandler
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 13227
diff changeset
72 new SPARCMacroAssembler.Mov(asRegister(exceptionPc), i1).emit(masm);
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
73 leaveFrame(crb);
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
74
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
75 // Restore SP from L7 if the exception PC is a method handle call site.
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
76 SPARCAddress dst = new SPARCAddress(thread, isMethodHandleReturnOffset);
18705
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
77 try (SPARCScratchRegister scratch = SPARCScratchRegister.get()) {
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
78 Register scratchReg = scratch.getRegister();
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
79 new Lduw(dst, scratchReg).emit(masm);
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
80 new Cmp(scratchReg, scratchReg).emit(masm);
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
81 new Movcc(ConditionFlag.NotZero, CC.Icc, l7, sp).emit(masm);
5dcb9fdea75a [SPARC] use now a dedicated scratch register for isMethodHandleReturnOffset value, as o7 may contain valuable information
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18667
diff changeset
82 }
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
83
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
84 new Jmpl(asRegister(handlerInCallerPc), 0, g0).emit(masm);
16930
62ae5c2c241d [SPARC] add missing delay slot wen jumping to exception handler.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16310
diff changeset
85 new Nop().emit(masm);
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
86 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents:
diff changeset
87 }