X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mate.git;a=blobdiff_plain;f=Mate%2FBasicBlocks.hs;fp=Mate%2FBasicBlocks.hs;h=2f96a40fe66ee6ce5b86b644141b3e3cf269b964;hp=af0074980304d46240f287156071856805b21b32;hb=c541c18161f42753454ab94bbc5e1a43ef89ae40;hpb=de9b805eb93b4a39c03e9f7e1cda62c674c87fe3 diff --git a/Mate/BasicBlocks.hs b/Mate/BasicBlocks.hs index af00749..2f96a40 100644 --- 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 - 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) @@ -139,12 +143,12 @@ testCFG c = buildCFG (codeInstructions c) (codeExceptions c) 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 - (_, _, insonly) = unzip3 is + (offsets, _, insonly) = unzip3 is (lastoff, Just endblock, lastins) = fromJust lastblock -- also take last (non-matched) element and return it