Module CASS.WorkerFunctions

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

Author: Heiko Hoffmann, Michael Hanus

Version: January 2021

Summary of exported operations:

newProgInfoStoreRef :: IO (IORef [(String,ProgInfo a)])  Deterministic 
analysisClient :: (Eq a, Read a, Show a) => Analysis a -> CConfig -> [String] -> IO ()  Non-deterministic 
Analyze a list of modules (in the given order) with a given analysis.
analysisClientWithStore :: (Eq a, Read a, Show a) => CConfig -> IORef [(String,ProgInfo a)] -> Analysis a -> String -> String -> IO ()  Non-deterministic 
getInterfaceInfosWS :: Read a => CConfig -> IORef [(String,ProgInfo a)] -> String -> [String] -> IO (ProgInfo a)  Deterministic 
getStartValues :: Analysis a -> Prog -> IO [((String,String),a)]  Deterministic 
Compute the start (bottom) values for a dependency analysis.
funcInfos2ProgInfo :: Prog -> [((String,String),a)] -> ProgInfo a  Deterministic 
Compute a ProgInfo from a given list of infos for each function name w.r.t.
typeInfos2ProgInfo :: Prog -> [((String,String),a)] -> ProgInfo a  Deterministic 
Compute a ProgInfo from a given list of infos for each type name w.r.t.
map2 :: (a -> b) -> ([a],[a]) -> ([b],[b])  Deterministic 
updateList :: Eq a => [(a,b)] -> [(a,b)] -> [(a,b)]  Deterministic 
Update a given value list (second argument) w.r.t.
updateValue :: Eq a => (a,b) -> [(a,b)] -> [(a,b)]  Deterministic 
execCombinedAnalysis :: (Eq a, Read a) => CConfig -> Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> String -> IO (ProgInfo a)  Deterministic 
runAnalysis :: (Eq a, Read a) => CConfig -> Analysis a -> Prog -> ProgInfo a -> [((String,String),a)] -> String -> IO (ProgInfo a)  Deterministic 
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  Deterministic 
Executes an anlysis on a given program w.r.t.
unknownFixpointMessage :: String  Deterministic 
addCalledFunctions :: FuncDecl -> (FuncDecl,[(String,String)])  Deterministic 
Add the directly called functions to each function declaration.
addUsedTypes :: TypeDecl -> (TypeDecl,[(String,String)])  Deterministic 
Add the directly used type constructors to each type declaration.
consDeclsOfType :: TypeDecl -> [ConsDecl]  Deterministic 
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  Deterministic 
Fixpoint iteration to compute analysis information.
wlIteration :: (Eq a, Eq b) => (a -> [((String,String),b)] -> b) -> (a -> (String,String)) -> [(a,[(String,String)])] -> [(a,[(String,String)])] -> RedBlackTree (String,String) -> ProgInfo b -> Map (String,String) b -> Map (String,String) b  Deterministic 
lookupError :: String -> (String,String) -> a  Deterministic 
isVisibleFunc :: FuncDecl -> Bool  Deterministic 
isVisibleType :: TypeDecl -> Bool  Deterministic 

Exported datatypes:


ProgInfoStore

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


Exported operations:

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

analysisClient :: (Eq a, Read a, Show a) => Analysis a -> CConfig -> [String] -> IO ()  Non-deterministic 

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, Read a, Show a) => CConfig -> IORef [(String,ProgInfo a)] -> Analysis a -> String -> String -> IO ()  Non-deterministic 

getInterfaceInfosWS :: Read a => CConfig -> IORef [(String,ProgInfo a)] -> String -> [String] -> IO (ProgInfo a)  Deterministic 

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

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

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

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  Deterministic 

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])  Deterministic 

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

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)]  Deterministic 

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

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

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  Deterministic 

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  Deterministic 

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

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

Add the directly called functions to each function declaration.

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

Add the directly used type constructors to each type declaration.

consDeclsOfType :: TypeDecl -> [ConsDecl]  Deterministic 

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  Deterministic 

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, Eq b) => (a -> [((String,String),b)] -> b) -> (a -> (String,String)) -> [(a,[(String,String)])] -> [(a,[(String,String)])] -> RedBlackTree (String,String) -> ProgInfo b -> Map (String,String) b -> Map (String,String) b  Deterministic 

lookupError :: String -> (String,String) -> a  Deterministic 

isVisibleFunc :: FuncDecl -> Bool  Deterministic 

isVisibleType :: TypeDecl -> Bool  Deterministic