in-directory: keep subdirectory content in order

The content produced by `directory-list` was reversed by an
accumulator loop.
minor allocation speedup for immutable hash tables
dump-memory-stats: add mode to return a tag count
fix incorrect sharing of submodule-declaration tables

Cuts the peak memory use of

 racket -c -l match

from 1.2 GB to 400 MB on a 64-bit machine.