staticcall trap: use different magic sequence
[mate.git] / Mate / MethodPool.hs
index 1eccbd2c8ec85bd63ce7cfaad0e6d1ae8ab90726..f0465d6e7e584e0682f738ceeb9790e801f59bb3 100644 (file)
@@ -26,7 +26,7 @@ import Text.Printf
 
 import Mate.BasicBlocks
 import Mate.Types
-import Mate.X86CodeGen
+import Mate.NativeMachine
 import Mate.ClassPool
 import Mate.Debug
 import Mate.Utilities
@@ -35,7 +35,7 @@ foreign import ccall "dynamic"
    code_void :: FunPtr (IO ()) -> IO ()
 
 
-getMethodEntry :: CUInt -> CUInt -> IO CUInt
+getMethodEntry :: CPtrdiff -> CPtrdiff -> IO CPtrdiff
 getMethodEntry signal_from methodtable = do
   mmap <- getMethodMap
   tmap <- getTrapMap
@@ -74,13 +74,10 @@ getMethodEntry signal_from methodtable = do
                 setMethodMap $ M.insert mi' nf mmap
                 return nf
               else do
-                hmap <- parseMethod cls' method sig
-                case hmap of
-                  Just hmap' -> do
-                    entry <- compileBB hmap' (MethodInfo method (thisClass cls') sig)
-                    addMethodRef entry mi' clsnames
-                    return $ fromIntegral entry
-                  Nothing -> error $ show method ++ " not found. abort"
+                rawmethod <- parseMethod cls' method sig
+                entry <- compileBB rawmethod (MethodInfo method (thisClass cls') sig)
+                addMethodRef entry mi' clsnames
+                return $ fromIntegral entry
         Nothing -> error $ show method ++ " not found. abort"
     Just w32 -> return w32
   return $ fromIntegral entryaddr
@@ -136,7 +133,7 @@ compileBB rawmethod methodinfo = do
   tmap <- getTrapMap
 
   cls <- getClassFile (methClassName methodinfo)
-  let ebb = emitFromBB (methName methodinfo) (methSignature methodinfo) cls rawmethod
+  let ebb = emitFromBB cls rawmethod
   (_, Right right) <- runCodeGen ebb () ()
 
   let ((entry, _, _, new_tmap), _) = right