@Override
    public void endElement(String uri,
            String localName,
            String qname) {
        if (qname.equals("parse")) {
            indent -= 2;
            scopes.pop();
        } else if (qname.equals("uncommon_trap")) {
            currentTrap = null;
        } else if (qname.equals("late_inline")) {
            // Populate late inlining info.

            // late_inline scopes are specified in reverse order:
            // compiled method should be on top of stack.
            CallSite caller = late_inline_scope.pop();
            Method m = compile.getMethod();
            if (m != caller.getMethod()) {
                System.out.println(m);
                System.out.println(caller.getMethod() + " bci: " + bci);
                throw new InternalError("call site and late_inline info don't match");
            }

            // late_inline contains caller+bci info, convert it
            // to bci+callee info used by LogCompilation.
            site = compile.getLateInlineCall();
            do {
                bci = caller.getBci();
                // Next inlined call.
                caller = late_inline_scope.pop();
                CallSite callee =  new CallSite(bci, caller.getMethod());
                site.add(callee);
                site = callee;
            } while (!late_inline_scope.empty());

            if (caller.getBci() != -999) {
                System.out.println(caller.getMethod());
                throw new InternalError("broken late_inline info");
            }
            if (site.getMethod() != caller.getMethod()) {
                System.out.println(site.getMethod());
                System.out.println(caller.getMethod());
                throw new InternalError("call site and late_inline info don't match");
            }
            // late_inline is followed by parse with scopes.size() == 0,
            // 'site' will be pushed to scopes.
            late_inline_scope = null;
        } else if (qname.equals("task")) {
            types.clear();
            methods.clear();
            site = null;
        }
    }