Misc changes for REPL.jl

These changes are necessary to make completion work in https://github.com/loladiro/REPL.jl. Since it adds some stuff in module.c, I figured I'd put it up here for review first. If there are no objections, I'll merge tomorrow, so I can push the REPL stuff to METADATA.

/cc @JeffBezanson