X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mate.git;a=blobdiff_plain;f=Mate%2FX86CodeGen.hs;fp=Mate%2FX86CodeGen.hs;h=7d17a9d7314d0f18929f124fdca250909381f9c7;hp=23cf7a32a348c4ba726e2093fdc734507ba026c3;hb=34939ca19d5f608efb04dcb2cdd97dd3f922d4a6;hpb=60297de17a166656519429b9652c0cf059e900f1 diff --git a/Mate/X86CodeGen.hs b/Mate/X86CodeGen.hs index 23cf7a3..7d17a9d 100644 --- a/Mate/X86CodeGen.hs +++ b/Mate/X86CodeGen.hs @@ -224,6 +224,13 @@ emitFromBB cls method = do return reip return $ Just (trapaddr, NewObject patcher) + emit' ATHROW = do + trapaddr <- emitSigIllTrap 2 + let patcher resp reip = do + emitSigIllTrap 2 + return reip + return $ Just (trapaddr, ThrowException patcher) + emit' insn = emit insn >> return Nothing emit :: J.Instruction -> CodeGen e s () @@ -279,8 +286,6 @@ emitFromBB cls method = do push eax -- push ref again emit (CHECKCAST _) = nop -- TODO(bernhard): ... - emit ATHROW = -- TODO(bernhard): ... - emit32 (0xffffffff :: Word32) emit I2C = do pop eax and eax (0x000000ff :: Word32) @@ -367,6 +372,7 @@ emitFromBB cls method = do emitSigIllTrap :: Int -> CodeGen e s NativeWord emitSigIllTrap traplen = do + when (traplen < 2) (error "emitSigIllTrap: trap len too short") trapaddr <- getCurrentOffset -- 0xffff causes SIGILL emit8 (0xff :: Word8); emit8 (0xff :: Word8)