projects
/
mate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
codegen: handle exceptions of a method
[mate.git]
/
Mate
/
BasicBlocks.hs
diff --git
a/Mate/BasicBlocks.hs
b/Mate/BasicBlocks.hs
index af0074980304d46240f287156071856805b21b32..2f96a40fe66ee6ce5b86b644141b3e3cf269b964 100644
(file)
--- a/
Mate/BasicBlocks.hs
+++ b/
Mate/BasicBlocks.hs
@@
-113,7
+113,11
@@
parseMethod cls methodname sig = do
else M.insert key [value] emap
where
key = (&&&) eStartPC eEndPC ce
else M.insert key [value] emap
where
key = (&&&) eStartPC eEndPC ce
- value = (&&&) (buildClassID cls . eCatchType) eHandlerPC ce
+ value = (&&&) g eHandlerPC ce
+ where
+ g ce' = case eCatchType ce' of
+ 0 -> B.empty
+ x -> buildClassID cls x
let msig = methodSignature method
printfBb $ printf "BB: analysing \"%s\"\n" $ toString (methodname `B.append` ": " `B.append` encode msig)
let msig = methodSignature method
printfBb $ printf "BB: analysing \"%s\"\n" $ toString (methodname `B.append` ": " `B.append` encode msig)
@@
-139,12
+143,12
@@
testCFG c = buildCFG (codeInstructions c) (codeExceptions c)
parseBasicBlock :: Int -> [OffIns] -> BasicBlock
parseBasicBlock i insns = emptyBasicBlock
parseBasicBlock :: Int -> [OffIns] -> BasicBlock
parseBasicBlock i insns = emptyBasicBlock
- { code = insonly
+ { code =
zip offsets
insonly
, bblength = lastoff - i + (insnLength lastins)
, successor = endblock }
where
(lastblock, is) = takeWhilePlusOne validins omitins insns
, bblength = lastoff - i + (insnLength lastins)
, successor = endblock }
where
(lastblock, is) = takeWhilePlusOne validins omitins insns
- (
_
, _, insonly) = unzip3 is
+ (
offsets
, _, insonly) = unzip3 is
(lastoff, Just endblock, lastins) = fromJust lastblock
-- also take last (non-matched) element and return it
(lastoff, Just endblock, lastins) = fromJust lastblock
-- also take last (non-matched) element and return it