projects
/
mate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
instanceOf: class hierarchy are considered properly now
[mate.git]
/
Mate
/
X86CodeGen.hs
diff --git
a/Mate/X86CodeGen.hs
b/Mate/X86CodeGen.hs
index fe1fe5d0c76fed2ad38e22b09c673b7d81f316fe..c42ccadaf2c185e6457d5d97326aaa4aa7aa9844 100644
(file)
--- a/
Mate/X86CodeGen.hs
+++ b/
Mate/X86CodeGen.hs
@@
-199,26
+199,18
@@
emitFromBB cls method = do
emit' (INSTANCEOF cpidx) = do
pop eax
emit' (INSTANCEOF cpidx) = do
pop eax
- mov eax (Disp 0, eax) -- mtable of objectref
trapaddr <- getCurrentOffset
-- place something like `mov edx $mtable_of_objref' instead
trapaddr <- getCurrentOffset
-- place something like `mov edx $mtable_of_objref' instead
- emit32 (0x9090ffff :: Word32)
; nop
+ emit32 (0x9090ffff :: Word32)
push (0 :: Word32)
let patcher reax reip = do
push (0 :: Word32)
let patcher reax reip = do
- -- mtable <- liftIO $ getMethodTable (buildClassID cls cpidx)
- -- mov edx mtable
- emit32 (0x9090ffff :: Word32); nop
+ emit32 (0x9090ffff :: Word32)
let classname = buildClassID cls cpidx
check <- liftIO $ isInstanceOf (fromIntegral reax) classname
if check
then push (1 :: Word32)
else push (0 :: Word32)
let classname = buildClassID cls cpidx
check <- liftIO $ isInstanceOf (fromIntegral reax) classname
if check
then push (1 :: Word32)
else push (0 :: Word32)
- return (reip + 5)
- -- cmp eax edx
- -- sete al
- -- movzxb eax al
- -- push eax
- -- forceRegDump
+ return (reip + 4)
return $ Just (trapaddr, InstanceOf patcher)
emit' (NEW objidx) = do
let objname = buildClassID cls objidx
return $ Just (trapaddr, InstanceOf patcher)
emit' (NEW objidx) = do
let objname = buildClassID cls objidx