projects
/
mate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: style, fun, hlint, ...
[mate.git]
/
Mate
/
BasicBlocks.hs
diff --git
a/Mate/BasicBlocks.hs
b/Mate/BasicBlocks.hs
index 8cd919a1e4f770152d971295ca4e7e2712477f07..fbb61f7a06ecf6a471d5b33385953f58228ee19b 100644
(file)
--- a/
Mate/BasicBlocks.hs
+++ b/
Mate/BasicBlocks.hs
@@
-41,7
+41,7
@@
printMapBB :: Maybe MapBB -> IO ()
printMapBB Nothing = putStrLn "No BasicBlock"
printMapBB (Just hmap) = do
putStr "BlockIDs: "
printMapBB Nothing = putStrLn "No BasicBlock"
printMapBB (Just hmap) = do
putStr "BlockIDs: "
- let keys =
fst $ unzip $ M.toList
hmap
+ let keys =
M.keys
hmap
mapM_ (putStr . (flip (++)) ", " . show) keys
putStrLn "\n\nBasicBlocks:"
printMapBB' keys hmap
mapM_ (putStr . (flip (++)) ", " . show) keys
putStrLn "\n\nBasicBlocks:"
printMapBB' keys hmap
@@
-106,10
+106,10
@@
parseMethod cls method sig = do
testCFG :: Maybe (Method Direct) -> Maybe MapBB
testCFG :: Maybe (Method Direct) -> Maybe MapBB
-testCFG
(Just m) = case attrByName m "Code" of
- Nothing -> Nothing
- Just bytecode -> Just $ buildCFG $ codeInstructions $ decodeMethod bytecode
-testCFG _ = Nothing
+testCFG
m = do
+ m' <- m
+ bytecode <- attrByName m' "Code"
+ return $ buildCFG $ codeInstructions $ decodeMethod bytecode
buildCFG :: [Instruction] -> MapBB
buildCFG :: [Instruction] -> MapBB
@@
-195,6
+195,8
@@
calculateInstructionOffset = cio' (0, Nothing)
IF _ w16 -> twotargets w16
IF_ICMP _ w16 -> twotargets w16
IF_ACMP _ w16 -> twotargets w16
IF _ w16 -> twotargets w16
IF_ICMP _ w16 -> twotargets w16
IF_ACMP _ w16 -> twotargets w16
+ IFNONNULL w16 -> twotargets w16
+ IFNULL w16 -> twotargets w16
GOTO w16 -> onetarget w16
IRETURN -> notarget
ARETURN -> notarget
GOTO w16 -> onetarget w16
IRETURN -> notarget
ARETURN -> notarget