types: remove dirty Ord instance of MethodSignature
[mate.git] / Mate / Types.hs
index 0f8b4a9b922fa7cf9a312da88f57ee07139e91c6..5405a43a4f708df4a3be729fbf12983768c29711 100644 (file)
@@ -1,5 +1,4 @@
 {-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
 module Mate.Types where
 
 import Data.Word
@@ -29,13 +28,13 @@ type MapBB = M.Map BlockID BasicBlock
 
 -- Word32 = point of method call in generated code
 -- MethodInfo = relevant information about callee
-type TrapMap = M.Map Word32 TrapInfo
+type TrapMap = M.Map Word32 TrapCause
 
-data TrapInfo =
-  MI MethodInfo | -- for static calls
-  VI MethodInfo | -- for virtual calls
-  II MethodInfo | -- for interface calls
-  SFI StaticFieldInfo deriving Show
+data TrapCause =
+  StaticMethod MethodInfo | -- for static calls
+  VirtualMethod Bool MethodInfo | -- for virtual calls
+  InterfaceMethod Bool MethodInfo | -- for interface calls
+  StaticField StaticFieldInfo deriving Show
 
 data StaticFieldInfo = StaticFieldInfo {
   sfiClassName :: B.ByteString,
@@ -53,14 +52,6 @@ data MethodInfo = MethodInfo {
   methSignature :: MethodSignature
   } deriving (Eq, Ord)
 
--- TODO(bernhard): not really efficient. also, outsource that to hs-java
---                 deriving should be enough?
-instance Ord MethodSignature where
-  compare (MethodSignature args_a ret_a) (MethodSignature args_b ret_b)
-    | cmp_args /= EQ = cmp_args
-    | otherwise = show ret_a `compare` show ret_b
-    where cmp_args = show args_a `compare` show args_b
-
 instance Show MethodInfo where
   show (MethodInfo method c sig) =
     toString c ++ "." ++ toString method ++ "." ++ show sig