Lock around kind of symbol lookup

Also cleans up symboltable size code. We already track the size anyway
so all places needing the size should just used that.