Module CASS.WorkerFunctions

Operations to implement the client workers. In particular, it contains some simple fixpoint computations.

Author: Heiko Hoffmann, Michael Hanus

Version: January 2019

Summary of exported operations:

newProgInfoStoreRef :: IO (IORef [(String,ProgInfo a)])   
analysisClient :: Eq a => Analysis a -> [String] -> IO ()   
Analyze a list of modules (in the given order) with a given analysis.
analysisClientWithStore :: Eq a => IORef [(String,ProgInfo a)] -> Analysis a -> String -> String -> IO ()   
getInterfaceInfosWS :: IORef [(String,ProgInfo a)] -> String -> [String] -> IO (ProgInfo a)   
getStartValues :: Analysis a -> Prog -> IO [((String,String),a)]   
Compute the start (bottom) values for a dependency analysis.
funcInfos2ProgInfo :: Prog -> [((String,String),a)] -> ProgInfo a   
Compute a ProgInfo from a given list of infos for each function name w.r.t.
typeInfos2ProgInfo :: Prog -> [((String,String),a)] -> ProgInfo a   
Compute a ProgInfo from a given list of infos for each type name w.r.t.
map2 :: (a -> b) -> ([a],[a]) -> ([b],[b])   
updateList :: Eq a => [(a,b)] -> [(a,b)] -> [(a,b)]   
Update a given value list (second argument) w.r.t.
updateValue :: Eq a => (a,b) -> [(a,b)] -> [(a,b)]   
execCombinedAnalysis :: Eq a => Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> String -> IO (ProgInfo a)   
runAnalysis :: Eq a => Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> IO (ProgInfo a)   
Run an analysis but load default values (e.g., for external operations) before and do not analyse the operations or types for these defaults.
executeAnalysis :: Eq a => Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> ProgInfo a   
Executes an anlysis on a given program w.r.t.
unknownFixpointMessage :: String   
addCalledFunctions :: FuncDecl -> (FuncDecl,[(String,String)])   
Add the directly called functions to each function declaration.
addUsedTypes :: TypeDecl -> (TypeDecl,[(String,String)])   
Add the directly used type constructors to each type declaration.
consDeclsOfType :: TypeDecl -> [ConsDecl]   
Gets all constructors of datatype declaration.
simpleIteration :: Eq a => (b -> [((String,String),a)] -> a) -> (b -> (String,String)) -> ([(b,[(String,String)])],[(b,[(String,String)])]) -> ProgInfo a -> ProgInfo a -> ProgInfo a   
Fixpoint iteration to compute analysis information.
wlIteration :: Eq a => (b -> [((String,String),a)] -> a) -> (b -> (String,String)) -> [(b,[(String,String)])] -> [(b,[(String,String)])] -> RedBlackTree (String,String) -> ProgInfo a -> FM (String,String) a -> FM (String,String) a   
isVisibleFunc :: FuncDecl -> Bool   
isVisibleType :: TypeDecl -> Bool   

Exported datatypes:


ProgInfoStore

Type synonym: ProgInfoStore a = [(String,ProgInfo a)]


Exported operations:

newProgInfoStoreRef :: IO (IORef [(String,ProgInfo a)])   

analysisClient :: Eq a => Analysis a -> [String] -> IO ()   

Analyze a list of modules (in the given order) with a given analysis. The analysis results are stored in the corresponding analysis result files.

analysisClientWithStore :: Eq a => IORef [(String,ProgInfo a)] -> Analysis a -> String -> String -> IO ()   

getInterfaceInfosWS :: IORef [(String,ProgInfo a)] -> String -> [String] -> IO (ProgInfo a)   

getStartValues :: Analysis a -> Prog -> IO [((String,String),a)]   

Compute the start (bottom) values for a dependency analysis.

funcInfos2ProgInfo :: Prog -> [((String,String),a)] -> ProgInfo a   

Compute a ProgInfo from a given list of infos for each function name w.r.t. a given program.

typeInfos2ProgInfo :: Prog -> [((String,String),a)] -> ProgInfo a   

Compute a ProgInfo from a given list of infos for each type name w.r.t. a given program.

map2 :: (a -> b) -> ([a],[a]) -> ([b],[b])   

updateList :: Eq a => [(a,b)] -> [(a,b)] -> [(a,b)]   

Update a given value list (second argument) w.r.t. new values given in the first argument list.

updateValue :: Eq a => (a,b) -> [(a,b)] -> [(a,b)]   

execCombinedAnalysis :: Eq a => Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> String -> IO (ProgInfo a)   

runAnalysis :: Eq a => Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> IO (ProgInfo a)   

Run an analysis but load default values (e.g., for external operations) before and do not analyse the operations or types for these defaults.

executeAnalysis :: Eq a => Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> ProgInfo a   

Executes an anlysis on a given program w.r.t. an imported ProgInfo and some start values (for dependency analysis). The fixpoint iteration method to be applied is passed as the last argument.

unknownFixpointMessage :: String   

Further infos:
  • solution complete, i.e., able to compute all solutions

addCalledFunctions :: FuncDecl -> (FuncDecl,[(String,String)])   

Add the directly called functions to each function declaration.

addUsedTypes :: TypeDecl -> (TypeDecl,[(String,String)])   

Add the directly used type constructors to each type declaration.

consDeclsOfType :: TypeDecl -> [ConsDecl]   

Gets all constructors of datatype declaration.

Further infos:
  • solution complete, i.e., able to compute all solutions

simpleIteration :: Eq a => (b -> [((String,String),a)] -> a) -> (b -> (String,String)) -> ([(b,[(String,String)])],[(b,[(String,String)])]) -> ProgInfo a -> ProgInfo a -> ProgInfo a   

Fixpoint iteration to compute analysis information. The arguments are:

  • analysis operation
  • operation to get name of a declaration
  • list of public and private declarations together with their direct deps
  • ProgInfo for imported entities
  • current ProgInfo

Result: fixpoint ProgInfo

wlIteration :: Eq a => (b -> [((String,String),a)] -> a) -> (b -> (String,String)) -> [(b,[(String,String)])] -> [(b,[(String,String)])] -> RedBlackTree (String,String) -> ProgInfo a -> FM (String,String) a -> FM (String,String) a   

isVisibleFunc :: FuncDecl -> Bool   

isVisibleType :: TypeDecl -> Bool