private BasicBlock[] makeBlocks(HashMap markTable) {
            Mark[] marks = (Mark[])markTable.values()
                                            .toArray(new Mark[markTable.size()]);
            java.util.Arrays.sort(marks);
            ArrayList blocks = new ArrayList();
            int i = 0;
            BasicBlock prev;
            if (marks.length > 0 && marks[0].position == 0 && marks[0].block != null)
                prev = getBBlock(marks[i++]);
            else
                prev = makeBlock(0);

            blocks.add(prev);
            while (i < marks.length) {
                Mark m = marks[i++];
                BasicBlock bb = getBBlock(m);
                if (bb == null) {
                    // the mark indicates a branch instruction
                    if (prev.length > 0) {
                        // the previous mark already has exits.
                        prev = makeBlock(prev.position + prev.length);
                        blocks.add(prev);
                    }

                    prev.length = m.position + m.size - prev.position;
                    prev.exit = m.jump;
                    prev.stop = m.alwaysJmp;
                }
                else {
                    // the mark indicates a branch target
                    if (prev.length == 0) {
                        prev.length = m.position - prev.position;
                        bb.incoming++;
                        prev.exit = makeArray(bb);
                    }
                    else {
                        // the previous mark already has exits.
                        int prevPos = prev.position;
                        if (prevPos + prev.length < m.position) {
                            prev = makeBlock(prevPos + prev.length);
                            prev.length = m.position - prevPos;
                            // the incoming flow from dead code is not counted
                            // bb.incoming++;
                            prev.exit = makeArray(bb);
                        }
                    }

                    blocks.add(bb);
                    prev = bb;
                }
            }

            return (BasicBlock[])blocks.toArray(makeArray(blocks.size()));
        }