Search in sources :

Example 6 with TrapCodeOperand

use of org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand in project JikesRVM by JikesRVM.

the class BURS_Helpers method TRAP.

// Take the generic LIR trap and coerce into the limited vocabulary
// understand by C trap handler on PPC.  See TrapConstants.java.
protected final void TRAP(Instruction s) {
    RegisterOperand gRes = Trap.getClearGuardResult(s);
    TrapCodeOperand tc = Trap.getClearTCode(s);
    switch(tc.getTrapCode()) {
        case RuntimeEntrypoints.TRAP_NULL_POINTER:
            {
                RVMMethod target = Entrypoints.raiseNullPointerException;
                mutateTrapToCall(s, target);
            }
            break;
        case RuntimeEntrypoints.TRAP_ARRAY_BOUNDS:
            {
                RVMMethod target = Entrypoints.raiseArrayBoundsException;
                mutateTrapToCall(s, target);
            }
            break;
        case RuntimeEntrypoints.TRAP_DIVIDE_BY_ZERO:
            {
                RVMMethod target = Entrypoints.raiseArithmeticException;
                mutateTrapToCall(s, target);
            }
            break;
        case RuntimeEntrypoints.TRAP_CHECKCAST:
            {
                EMIT(MIR_Trap.mutate(s, PPC_TWI, gRes, PowerPCTrapOperand.ALWAYS(), I(12), IC(CHECKCAST_TRAP & 0xffff), tc));
            }
            break;
        case RuntimeEntrypoints.TRAP_MUST_IMPLEMENT:
            {
                EMIT(MIR_Trap.mutate(s, PPC_TWI, gRes, PowerPCTrapOperand.ALWAYS(), I(12), IC(MUST_IMPLEMENT_TRAP & 0xffff), tc));
            }
            break;
        case RuntimeEntrypoints.TRAP_STORE_CHECK:
            {
                EMIT(MIR_Trap.mutate(s, PPC_TWI, gRes, PowerPCTrapOperand.ALWAYS(), I(12), IC(STORE_CHECK_TRAP & 0xffff), tc));
            }
            break;
        default:
            throw new OptimizingCompilerException("Unexpected case of trap_if" + s);
    }
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) OptimizingCompilerException(org.jikesrvm.compilers.opt.OptimizingCompilerException)

Aggregations

TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)6 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)5 OptimizingCompilerException (org.jikesrvm.compilers.opt.OptimizingCompilerException)3 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)3 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)3 ConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)2 LongConstantOperand (org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand)2 IA32ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ia32.IA32ConditionOperand)2 PowerPCConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ppc.PowerPCConditionOperand)2 PowerPCTrapOperand (org.jikesrvm.compilers.opt.ir.operand.ppc.PowerPCTrapOperand)2 Enumeration (java.util.Enumeration)1 RVMMethod (org.jikesrvm.classloader.RVMMethod)1 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)1 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)1 PhysicalRegisterSet (org.jikesrvm.compilers.opt.ir.ia32.PhysicalRegisterSet)1 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)1 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)1 DoubleConstantOperand (org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand)1 FloatConstantOperand (org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand)1 LocationOperand (org.jikesrvm.compilers.opt.ir.operand.LocationOperand)1