make Dict rehash more robust. fixes #3181

the strategy is to leave the Dict alone and rehash into fresh arrays,
then mutate the Dict atomically at the end.
Merge branch 'master' of github.com:JuliaLang/julia