From 587e7c4a43e5650637390719dc9df2586368d60b Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 13 Jan 2012 21:29:49 +0100 Subject: erts: First refactor step of export table --- erts/emulator/beam/export.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index c604fdf7c3..47e5a2c1d1 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -31,9 +31,9 @@ /* ** Export entry */ + typedef struct export { - IndexSlot slot; /* MUST BE LOCATED AT TOP OF STRUCT!!! */ void* address; /* Pointer to code for function. */ struct binary* match_prog_set; /* Match program for tracing. */ -- cgit v1.2.3 From 90209e4d57dd9b5ff27729b582f02c3d9e383f72 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 17 Jan 2012 12:16:39 +0100 Subject: erts: Multiple export tab's using code_ix Still blocking code loading --- erts/emulator/beam/export.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 47e5a2c1d1..0aad921b2d 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -28,6 +28,8 @@ #include "index.h" #endif +#include "code_ix.h" + /* ** Export entry */ @@ -59,17 +61,20 @@ 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); +Export* erts_find_export_entry(Eterm m, Eterm f, unsigned int a, ErtsCodeIndex); +Export* erts_active_export_entry(Eterm m, Eterm f, unsigned int a); /*SVERK inline? */ 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); +void erts_export_consolidate(ErtsCodeIndex); -Export *export_list(int); -int export_list_size(void); +Export *export_list(int,ErtsCodeIndex); +int export_list_size(ErtsCodeIndex); int export_table_sz(void); Export *export_get(Export*); +void export_start_load(void); +void export_end_load(int commit); #include "beam_load.h" /* For em_* extern declarations */ #define ExportIsBuiltIn(EntryPtr) \ -- cgit v1.2.3 From 5ed73504d7409a449ec4e0c0de421a93c4570e3b Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 18 Jan 2012 17:23:52 +0100 Subject: erts: Use several addresses in each Export --- erts/emulator/beam/export.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 0aad921b2d..db27606c49 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -36,7 +36,7 @@ typedef struct export { - 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[] */ @@ -78,7 +78,7 @@ void export_end_load(int commit); #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 -- cgit v1.2.3 From 0ebc1871238508783733423825d22967f5096d19 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 20 Jan 2012 17:39:14 +0100 Subject: erts: Call erts_export_consolidate automatically Renamed merge_secondary_table and called by export_start_load --- erts/emulator/beam/export.h | 1 - 1 file changed, 1 deletion(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index db27606c49..85628aac0b 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -67,7 +67,6 @@ 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(ErtsCodeIndex); Export *export_list(int,ErtsCodeIndex); int export_list_size(ErtsCodeIndex); -- cgit v1.2.3 From a4cb5739b9f3dd88582fdea7a00cbba721fea35d Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 23 Jan 2012 16:48:28 +0100 Subject: erts: Remove secondary_export_table --- erts/emulator/beam/export.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 85628aac0b..577e24f266 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -75,6 +75,10 @@ Export *export_get(Export*); void export_start_load(void); void export_end_load(int commit); +extern erts_smp_rwmtx_t export_table_lock; +#define export_write_lock() erts_smp_rwmtx_rwlock(&export_table_lock) +#define export_write_unlock() erts_smp_rwmtx_rwunlock(&export_table_lock) + #include "beam_load.h" /* For em_* extern declarations */ #define ExportIsBuiltIn(EntryPtr) \ (((EntryPtr)->addressv[erts_active_code_ix()] == (EntryPtr)->code + 3) && \ -- cgit v1.2.3 From a23f25a3014dbad01d2016dc4e6d6df9d59ba64c Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 24 Jan 2012 15:42:02 +0100 Subject: erts: Rename "loader" code_ix as "staging" code_ix Staging is a better and more general name as does not necessary need to involve code loading (can be deletion, tracing, etc). --- erts/emulator/beam/export.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 577e24f266..21cfafc77d 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -72,8 +72,8 @@ Export *export_list(int,ErtsCodeIndex); int export_list_size(ErtsCodeIndex); int export_table_sz(void); Export *export_get(Export*); -void export_start_load(void); -void export_end_load(int commit); +void export_start_staging(void); +void export_end_staging(int commit); extern erts_smp_rwmtx_t export_table_lock; #define export_write_lock() erts_smp_rwmtx_rwlock(&export_table_lock) -- cgit v1.2.3 From 63265772e86ca2e0f14a236c8aa964697a7cda70 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 3 Feb 2012 18:12:17 +0100 Subject: erts: Fix memory reports from export table Report sum from all code index. --- erts/emulator/beam/export.h | 1 + 1 file changed, 1 insertion(+) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 21cfafc77d..f59c5e5c89 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -71,6 +71,7 @@ Export* erts_export_get_or_make_stub(Eterm, Eterm, unsigned); 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); -- cgit v1.2.3 From 5aed8caaaf6c6b17ca2b2bd920ba76b31d6f5675 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 3 Feb 2012 18:13:37 +0100 Subject: erts: Refactor more renaming as "staging" --- erts/emulator/beam/export.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index f59c5e5c89..ef9c1d2680 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -76,9 +76,9 @@ Export *export_get(Export*); void export_start_staging(void); void export_end_staging(int commit); -extern erts_smp_rwmtx_t export_table_lock; -#define export_write_lock() erts_smp_rwmtx_rwlock(&export_table_lock) -#define export_write_unlock() erts_smp_rwmtx_rwunlock(&export_table_lock) +extern erts_smp_rwmtx_t export_staging_lock; +#define export_write_lock() erts_smp_rwmtx_rwlock(&export_staging_lock) +#define export_write_unlock() erts_smp_rwmtx_rwunlock(&export_staging_lock) #include "beam_load.h" /* For em_* extern declarations */ #define ExportIsBuiltIn(EntryPtr) \ -- cgit v1.2.3 From fa5213fd7590c6a9ade13af1375c363b958927f1 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 7 Feb 2012 19:43:31 +0100 Subject: erts: Cleanup non-blocking load --- erts/emulator/beam/export.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index ef9c1d2680..45c98d6bbb 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -61,11 +61,9 @@ 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, ErtsCodeIndex); -Export* erts_active_export_entry(Eterm m, Eterm f, unsigned int a); /*SVERK inline? */ +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); Export *export_list(int,ErtsCodeIndex); @@ -85,4 +83,16 @@ extern erts_smp_rwmtx_t export_staging_lock; (((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__ */ + -- cgit v1.2.3 From cd63cd50bae6d98d6d56fa24674f14e7b9457a37 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 15 Feb 2012 17:08:47 +0100 Subject: erts: Refactor export staging lock Renamed it export_staging_lock and made change it to ordinary mutex. --- erts/emulator/beam/export.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'erts/emulator/beam/export.h') diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 45c98d6bbb..ec9fcb26f2 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -74,9 +74,9 @@ Export *export_get(Export*); void export_start_staging(void); void export_end_staging(int commit); -extern erts_smp_rwmtx_t export_staging_lock; -#define export_write_lock() erts_smp_rwmtx_rwlock(&export_staging_lock) -#define export_write_unlock() erts_smp_rwmtx_rwunlock(&export_staging_lock) +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) \ -- cgit v1.2.3