diff options
author | Sverker Eriksson <[email protected]> | 2012-01-31 14:24:40 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-02-21 12:23:05 +0100 |
commit | 7cb4725bcf18f3158e60750ea658e51ab4586e31 (patch) | |
tree | cf54f04beb607f84ce5353d48ac9000d337e6820 /erts/emulator/beam/module.h | |
parent | 6b97a90f2314b66f4f41b14a986a9c1f1ebebf13 (diff) | |
download | otp-7cb4725bcf18f3158e60750ea658e51ab4586e31.tar.gz otp-7cb4725bcf18f3158e60750ea658e51ab4586e31.tar.bz2 otp-7cb4725bcf18f3158e60750ea658e51ab4586e31.zip |
erts: Refactor code_ix
Move implementation from beam_load into new file code_ix.c and module.c
and make some function inline.
Diffstat (limited to 'erts/emulator/beam/module.h')
-rw-r--r-- | erts/emulator/beam/module.h | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/erts/emulator/beam/module.h b/erts/emulator/beam/module.h index d63cf56778..6e123a0ffe 100644 --- a/erts/emulator/beam/module.h +++ b/erts/emulator/beam/module.h @@ -38,7 +38,7 @@ typedef struct erl_module { int module; /* Atom index for module (not tagged). */ struct erl_module_instance curr; - struct erl_module_instance old; + struct erl_module_instance old; /* protected by "old_code" rwlock */ } Module; Module* erts_get_module(Eterm mod, ErtsCodeIndex code_ix); @@ -53,4 +53,43 @@ Module *module_code(int, ErtsCodeIndex); int module_code_size(ErtsCodeIndex); int module_table_sz(void); +ERTS_GLB_INLINE void erts_rwlock_old_code(ErtsCodeIndex); +ERTS_GLB_INLINE void erts_rwunlock_old_code(ErtsCodeIndex); +ERTS_GLB_INLINE void erts_rlock_old_code(ErtsCodeIndex); +ERTS_GLB_INLINE void erts_runlock_old_code(ErtsCodeIndex); +#ifdef ERTS_ENABLE_LOCK_CHECK +int erts_is_old_code_rlocked(ErtsCodeIndex); #endif + +#if ERTS_GLB_INLINE_INCL_FUNC_DEF + +extern erts_smp_rwmtx_t the_old_code_rwlocks[ERTS_NUM_CODE_IX]; + +ERTS_GLB_INLINE void erts_rwlock_old_code(ErtsCodeIndex code_ix) +{ + erts_smp_rwmtx_rwlock(&the_old_code_rwlocks[code_ix]); +} +ERTS_GLB_INLINE void erts_rwunlock_old_code(ErtsCodeIndex code_ix) +{ + erts_smp_rwmtx_rwunlock(&the_old_code_rwlocks[code_ix]); +} +ERTS_GLB_INLINE void erts_rlock_old_code(ErtsCodeIndex code_ix) +{ + erts_smp_rwmtx_rlock(&the_old_code_rwlocks[code_ix]); +} +ERTS_GLB_INLINE void erts_runlock_old_code(ErtsCodeIndex code_ix) +{ + erts_smp_rwmtx_runlock(&the_old_code_rwlocks[code_ix]); +} + +#ifdef ERTS_ENABLE_LOCK_CHECK +ERTS_GLB_INLINE int erts_is_old_code_rlocked(ErtsCodeIndex code_ix) +{ + return erts_smp_lc_rwmtx_is_rlocked(&the_old_code_rwlocks[code_ix]); +} +#endif + +#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ + + +#endif /* !__MODULE_H__ */ |