types: remove dirty Ord instance of MethodSignature
[mate.git] / Mate / X86TrapHandling.hs
index ef753141ccf1d4475926b7520fde9597beaf94ea..882a541f1eefb7b5fe89eed22285d7a2d4cf524e 100644 (file)
@@ -21,15 +21,15 @@ getTrapType :: CUInt -> CUInt -> IO CUInt
 getTrapType signal_from from2 = do
   tmap <- getTrapMap
   case M.lookup (fromIntegral signal_from) tmap of
-    (Just (MI _)) -> return 0
-    (Just (SFI _)) -> return 2
+    (Just (StaticMethod _)) -> return 0
+    (Just (StaticField _)) -> return 2
     (Just _) -> error "getTrapMap: doesn't happen"
     -- maybe we've a hit on the second `from' value
     Nothing -> case M.lookup (fromIntegral from2) tmap of
-      (Just (VI True _)) -> return 1
-      (Just (VI False _)) -> return 5
-      (Just (II True _)) -> return 4
-      (Just (II False _)) -> return 8
+      (Just (VirtualMethod True _)) -> return 1
+      (Just (VirtualMethod False _)) -> return 5
+      (Just (InterfaceMethod True _)) -> return 4
+      (Just (InterfaceMethod False _)) -> return 8
       (Just _) -> error "getTrapType: abort #1 :-("
       Nothing -> error $ "getTrapType: abort #2 :-(" ++ show signal_from ++ ", " ++ show from2 ++ ", " ++ show tmap
 
@@ -45,7 +45,7 @@ mateHandler eip eax ebx esp = do
     4 -> invokeHandler eax ebx esp True
     8 -> invokeHandler eax ebx esp False
     2 -> staticFieldHandler eip
-    x -> error $ "wtf: " ++ (show x)
+    x -> error $ "wtf: " ++ show x
 
 staticCallHandler :: CUInt -> IO CUInt
 staticCallHandler eip = do
@@ -86,7 +86,7 @@ invokeHandler method_table table2patch esp imm8 = do
   callerAddr <- callerAddrFromStack esp
   offset <- if imm8 then offsetOfCallInsn8 esp else offsetOfCallInsn32 esp
   entryAddr <- getMethodEntry callerAddr method_table
-  let call_insn = intPtrToPtr (fromIntegral $ table2patch + (fromIntegral offset))
+  let call_insn = intPtrToPtr (fromIntegral $ table2patch + fromIntegral offset)
   poke call_insn entryAddr
   return entryAddr
 
@@ -105,5 +105,4 @@ offsetOfCallInsn32 :: CUInt -> IO CUInt
 offsetOfCallInsn32 esp = do
   let ret_ptr = intPtrToPtr (fromIntegral esp) :: Ptr CUInt
   ret <- peek ret_ptr
-  retval <- peek (intPtrToPtr $ fromIntegral (ret - 4))
-  return retval
+  peek (intPtrToPtr $ fromIntegral (ret - 4))