X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FByteCodeFFI.lhs;h=1589fe1bed01f11e64dcef3ee3df27397c0f5b07;hb=4f7d5513b25571f0eb091b8af04e2225f2802fed;hp=649efc06304643ef1aee025d6bbd02f5a8629e0b;hpb=c3062251034f54944061e816ed018b0b2db1b849;p=ghc-hetmet.git diff --git a/compiler/ghci/ByteCodeFFI.lhs b/compiler/ghci/ByteCodeFFI.lhs index 649efc0..1589fe1 100644 --- a/compiler/ghci/ByteCodeFFI.lhs +++ b/compiler/ghci/ByteCodeFFI.lhs @@ -5,12 +5,11 @@ ByteCodeGen: Generate machine-code sequences for foreign import \begin{code} -module ByteCodeFFI ( moan64, newExec ) where +module ByteCodeFFI ( moan64 ) where import Outputable import System.IO -import Foreign -import Foreign.C +import System.IO.Unsafe moan64 :: String -> SDoc -> a moan64 msg pp_rep @@ -25,19 +24,5 @@ moan64 msg pp_rep ) `seq` pprPanic msg pp_rep - -newExec :: Storable a => [a] -> IO (FunPtr ()) -newExec code - = alloca $ \pcode -> do - ptr <- _allocateExec (fromIntegral $ codeSize undefined code) pcode - pokeArray ptr code - code <- peek pcode - return (castPtrToFunPtr code) - where - codeSize :: Storable a => a -> [a] -> Int - codeSize dummy array = sizeOf(dummy) * length array - -foreign import ccall unsafe "allocateExec" - _allocateExec :: CUInt -> Ptr (Ptr a) -> IO (Ptr a) \end{code}