From e77e74e6bbc04c523f1468d21b14167b7eb910f7 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Tue, 31 Jul 2012 22:22:28 +0200 Subject: [PATCH] nativeMaschine: add module for binding target machine TODO: use wordSize where appropriate --- Mate.hs | 2 +- Mate/MethodPool.hs | 2 +- Mate/MethodPool.hs-boot | 2 ++ Mate/NativeMaschine.hs | 18 ++++++++++++++++++ Mate/X86TrapHandling.hs | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 Mate/NativeMaschine.hs diff --git a/Mate.hs b/Mate.hs index 4664ff1..ee03d8d 100644 --- a/Mate.hs +++ b/Mate.hs @@ -20,7 +20,7 @@ import Mate.BasicBlocks import Mate.MethodPool import Mate.Types import Mate.ClassPool -import Mate.X86TrapHandling +import Mate.NativeMaschine main :: IO () main = do diff --git a/Mate/MethodPool.hs b/Mate/MethodPool.hs index 5f787a2..134428a 100644 --- a/Mate/MethodPool.hs +++ b/Mate/MethodPool.hs @@ -26,7 +26,7 @@ import Text.Printf import Mate.BasicBlocks import Mate.Types -import Mate.X86CodeGen +import Mate.NativeMaschine import Mate.ClassPool import Mate.Debug import Mate.Utilities diff --git a/Mate/MethodPool.hs-boot b/Mate/MethodPool.hs-boot index 9392619..477e6cc 100644 --- a/Mate/MethodPool.hs-boot +++ b/Mate/MethodPool.hs-boot @@ -6,8 +6,10 @@ import Data.Binary import qualified Data.ByteString.Lazy as B import Mate.Types +import Foreign.C.Types addMethodRef :: Word32 -> MethodInfo -> [B.ByteString] -> IO () compileBB :: RawMethod -> MethodInfo -> IO Word32 executeFuncPtr :: Word32 -> IO () +getMethodEntry :: CUInt -> CUInt -> IO CUInt diff --git a/Mate/NativeMaschine.hs b/Mate/NativeMaschine.hs new file mode 100644 index 0000000..e32cecc --- /dev/null +++ b/Mate/NativeMaschine.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE CPP #-} +module Mate.NativeMaschine( + emitFromBB, + mateHandler, + register_signal, + wordSize + )where + +#ifdef i386_HOST_ARCH +import Mate.X86CodeGen +import Mate.X86TrapHandling + +wordSize :: Int +wordSize = 4 + +#else +#error "no other arch supported yet :/" +#endif diff --git a/Mate/X86TrapHandling.hs b/Mate/X86TrapHandling.hs index 1761d6b..0e07cd5 100644 --- a/Mate/X86TrapHandling.hs +++ b/Mate/X86TrapHandling.hs @@ -13,7 +13,7 @@ import Foreign import Foreign.C.Types import Mate.Types -import Mate.MethodPool +import {-# SOURCE #-} Mate.MethodPool import Mate.ClassPool foreign import ccall "register_signal" -- 2.25.1