diff options
author | Sverker Eriksson <[email protected]> | 2016-05-08 15:54:33 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-10-10 11:31:54 +0200 |
commit | 65737b70b9b71d53147e4155f8974b0fad01e1f6 (patch) | |
tree | 0782710274d1d11d81cc5350ffdd78763eb6538c | |
parent | 9cb85a8cd1e02263f34c57aac68d16a2f1c03180 (diff) | |
download | otp-65737b70b9b71d53147e4155f8974b0fad01e1f6.tar.gz otp-65737b70b9b71d53147e4155f8974b0fad01e1f6.tar.bz2 otp-65737b70b9b71d53147e4155f8974b0fad01e1f6.zip |
erts: Refactor module_start_staging
with a copy_module() function.
-rw-r--r-- | erts/emulator/beam/module.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/erts/emulator/beam/module.c b/erts/emulator/beam/module.c index 4f36377450..d4f6e17c56 100644 --- a/erts/emulator/beam/module.c +++ b/erts/emulator/beam/module.c @@ -181,6 +181,13 @@ static ErtsCodeIndex dbg_load_code_ix = 0; static int entries_at_start_staging = 0; +static ERTS_INLINE void copy_module(Module* dst_mod, Module* src_mod) +{ + dst_mod->curr = src_mod->curr; + dst_mod->old = src_mod->old; + dst_mod->on_load = src_mod->on_load; +} + void module_start_staging(void) { IndexTable* src = &module_tables[erts_active_code_ix()]; @@ -199,10 +206,7 @@ void module_start_staging(void) src_mod = (Module*) erts_index_lookup(src, i); dst_mod = (Module*) erts_index_lookup(dst, i); ASSERT(src_mod->module == dst_mod->module); - - dst_mod->curr = src_mod->curr; - dst_mod->old = src_mod->old; - dst_mod->on_load = src_mod->on_load; + copy_module(dst_mod, src_mod); } /* @@ -213,10 +217,7 @@ void module_start_staging(void) src_mod = (Module*) erts_index_lookup(src, i); dst_mod = (Module*) index_put_entry(dst, src_mod); ASSERT(dst_mod != src_mod); - - dst_mod->curr = src_mod->curr; - dst_mod->old = src_mod->old; - dst_mod->on_load = src_mod->on_load; + copy_module(dst_mod, src_mod); } newsz = index_table_sz(dst); erts_smp_atomic_add_nob(&tot_module_bytes, (newsz - oldsz)); |