packages feed

arbb-vm 0.1.1.17 → 0.1.1.18

raw patch · 3 files changed

+26/−10 lines, 3 files

Files

Intel/ArbbVM.chs view
@@ -139,7 +139,6 @@ -- ---------------------------------------------------------------------- -- Helpers -- ------------------------------------------------------------------------- Todo: This is code duplication, clean up peekErrorDet  ptr = do { res <- peek ptr; return $ ErrorDetails res} peekType  ptr = do { res <- peek ptr; return $ Type res}     peekFunction  ptr = do { res <- peek ptr; return $ Function res}    @@ -159,7 +158,12 @@ withNullPtr :: (Ptr b -> IO a) -> IO a  withNullPtr f = f nullPtr +alloc3 = allocaArray 3 +peek3 d =+  do+    l <- peekArray 3 d :: IO [CULong]+    return (map fromIntegral l) -- ---------------------------------------------------------------------- -- Exception -- ----------------------------------------------------------------------@@ -172,6 +176,15 @@  -- Debug + Error handling is changing.. see ArbbVM/Debug +throwIfErrorIO2 :: (Error,a,b,ErrorDetails) -> IO (a,b) +throwIfErrorIO2 (error_code,a,b,error_det) = +   if fromEnum error_code > 0 +    then do +      str <- getErrorMessage error_det+      freeErrorDetails error_det+      throwIO (ArbbVMException error_code str)+    else return (a,b)+ throwIfErrorIO1 :: (Error,a,ErrorDetails) -> IO a  throwIfErrorIO1 (error_code,a,error_det) =     if fromEnum error_code > 0 @@ -808,19 +821,22 @@ -- ---------------------------------------------------------------------- -- Alternative means of data movement  -mapToHost ctx var pitch mode = -   mapToHost' ctx var pitch mode >>= +--mapToHost ctx var pitch mode = +--   mapToHost' ctx var pitch mode >>= ++mapToHost ctx var mode = +   mapToHost' ctx var mode >>=  --  dbg "map_to_host" [("ctx",show $ fromContext ctx), --                                ("variable" ,show (fromVariable var)), --                                ("pitch", show pitch)] --                               (-- something about the result -- ) >>=      -    throwIfErrorIO1+    throwIfErrorIO2  {# fun unsafe arbb_map_to_host as mapToHost'    { fromContext  `Context'     ,      fromVariable `Variable'    ,       alloca- `Ptr ()' peek*     , -     withIntArray* `[Word64]'    ,+     alloc3- `[Word64]' peek3*    ,      cFromEnum `RangeAccessMode' ,      alloca- `ErrorDetails' peekErrorDet*  } -> `Error' cToEnum #}  
Intel/ArbbVM/Convenience.hs view
@@ -136,10 +136,10 @@  ------------------------------------------------------------------------------ -- Map an ArBB array into host addrspace-mapToHost_ :: Variable -> [Word64] -> RangeAccessMode -> EmitArbb (Ptr ())-mapToHost_ var pitch mode = do +mapToHost_ :: Variable -> RangeAccessMode -> EmitArbb (Ptr (),[Word64])+mapToHost_ var mode = do     ctx <- getCtx-   L mapToHost ctx var pitch mode +   L mapToHost ctx var mode  -------------------------------------------------------------------------------- -- Convenience functions for common patterns: @@ -219,7 +219,7 @@  type FunBody = [Variable] -> [Variable] -> EmitArbb () -debug_fundef = False+debug_fundef = True --False  {-    BJS:  This funDef_ situation might need some improvement. 
arbb-vm.cabal view
@@ -1,5 +1,5 @@ Name:           arbb-vm-Version:        0.1.1.17+Version:        0.1.1.18  License:                BSD3 License-file:           LICENSE