projects
/
mate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
athrow: add trapskeleton for it
[mate.git]
/
Mate
/
X86CodeGen.hs
diff --git
a/Mate/X86CodeGen.hs
b/Mate/X86CodeGen.hs
index 23cf7a32a348c4ba726e2093fdc734507ba026c3..7d17a9d7314d0f18929f124fdca250909381f9c7 100644
(file)
--- a/
Mate/X86CodeGen.hs
+++ b/
Mate/X86CodeGen.hs
@@
-224,6
+224,13
@@
emitFromBB cls method = do
return reip
return $ Just (trapaddr, NewObject patcher)
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 ()
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): ...
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)
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
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)
trapaddr <- getCurrentOffset
-- 0xffff causes SIGILL
emit8 (0xff :: Word8); emit8 (0xff :: Word8)