diff options
author | Sverker Eriksson <[email protected]> | 2012-03-09 12:06:34 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-03-09 15:04:37 +0100 |
commit | 4513946835523d099a28f933d40a6275a46097aa (patch) | |
tree | edde847f79a7b9509525878d0271b970d9cc0bf9 /erts/emulator/beam/export.h | |
parent | 61ebe50adc2bee5667bc9eef6e560cdb72114509 (diff) | |
parent | 16c60b70936070b0a568473c1d99466479446af2 (diff) | |
download | otp-4513946835523d099a28f933d40a6275a46097aa.tar.gz otp-4513946835523d099a28f933d40a6275a46097aa.tar.bz2 otp-4513946835523d099a28f933d40a6275a46097aa.zip |
Merge branch 'sverk/threadsafe-code-loading'
* sverk/threadsafe-code-loading: (59 commits)
erts: Fix assert failure when code_server exits "during" commit
erts: Fix memory leak in code loading
erts: Adapt gdb etp-command for new beam_ranges
erts: Set correct default tracing when loading code
erts: Fix faulty assert in non-smp debug vm
erts: Use correct macro for "yield-return"
erts: Refactor code loading with renaming
erts: Seize code_ix lock when updating trace settings
erts: Switch order between code_ix lock and thread blocking
erts: Fix race bug in finish_after_on_load
erts: Refactor export staging lock
erts: Activate staged code in a thread safe way
erts: Suspend processes waiting for code_ix lock
erts: Fix compiler warning in inet_drv
erts: Fix single threaded fallback in new BIF finish_loading_1
erts: Fix type bug
Break apart erlang:load_module/2 into two separate BIFs
Use magic binaries in erts_prepare_loading() and erts_finish_loading()
erts: Cleanup non-blocking load
erts: Fix memory query for non-blocking module table
...
OTP-9974
Diffstat (limited to 'erts/emulator/beam/export.h')
-rw-r--r-- | erts/emulator/beam/export.h | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index c604fdf7c3..ec9fcb26f2 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -28,13 +28,15 @@ #include "index.h" #endif +#include "code_ix.h" + /* ** Export entry */ + typedef struct export { - IndexSlot slot; /* MUST BE LOCATED AT TOP OF STRUCT!!! */ - void* address; /* Pointer to code for function. */ + void* addressv[ERTS_NUM_CODE_IX]; /* Pointer to code for function. */ struct binary* match_prog_set; /* Match program for tracing. */ BeamInstr fake_op_func_info_for_hipe[2]; /* MUST be just before code[] */ @@ -59,21 +61,38 @@ typedef struct export void init_export_table(void); void export_info(int, void *); -Export* erts_find_export_entry(Eterm m, Eterm f, unsigned int a); +ERTS_GLB_INLINE Export* erts_active_export_entry(Eterm m, Eterm f, unsigned a); Export* erts_export_put(Eterm mod, Eterm func, unsigned int arity); - Export* erts_export_get_or_make_stub(Eterm, Eterm, unsigned); -void erts_export_consolidate(void); -Export *export_list(int); -int export_list_size(void); +Export *export_list(int,ErtsCodeIndex); +int export_list_size(ErtsCodeIndex); int export_table_sz(void); +int export_entries_sz(void); Export *export_get(Export*); +void export_start_staging(void); +void export_end_staging(int commit); + +extern erts_smp_mtx_t export_staging_lock; +#define export_staging_lock() erts_smp_mtx_lock(&export_staging_lock) +#define export_staging_unlock() erts_smp_mtx_unlock(&export_staging_lock) #include "beam_load.h" /* For em_* extern declarations */ #define ExportIsBuiltIn(EntryPtr) \ -(((EntryPtr)->address == (EntryPtr)->code + 3) && \ +(((EntryPtr)->addressv[erts_active_code_ix()] == (EntryPtr)->code + 3) && \ ((EntryPtr)->code[3] == (BeamInstr) em_apply_bif)) -#endif +#if ERTS_GLB_INLINE_INCL_FUNC_DEF + +ERTS_GLB_INLINE Export* +erts_active_export_entry(Eterm m, Eterm f, unsigned int a) +{ + extern Export* erts_find_export_entry(Eterm m, Eterm f, unsigned a, ErtsCodeIndex); + return erts_find_export_entry(m, f, a, erts_active_code_ix()); +} + +#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ + +#endif /* __EXPORT_H__ */ + |