aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-01-24 15:42:02 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:23:04 +0100
commita23f25a3014dbad01d2016dc4e6d6df9d59ba64c (patch)
tree52c142a4d78eddcde0fdb526d531239e0638f6f3 /erts/emulator
parent72cab3a723925d0e369466d7de7567d8482b1318 (diff)
downloadotp-a23f25a3014dbad01d2016dc4e6d6df9d59ba64c.tar.gz
otp-a23f25a3014dbad01d2016dc4e6d6df9d59ba64c.tar.bz2
otp-a23f25a3014dbad01d2016dc4e6d6df9d59ba64c.zip
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).
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/beam_bif_load.c26
-rw-r--r--erts/emulator/beam/beam_catches.c14
-rw-r--r--erts/emulator/beam/beam_catches.h4
-rw-r--r--erts/emulator/beam/beam_load.c42
-rw-r--r--erts/emulator/beam/beam_ranges.c10
-rw-r--r--erts/emulator/beam/code_ix.h8
-rw-r--r--erts/emulator/beam/erl_init.c2
-rw-r--r--erts/emulator/beam/export.c14
-rw-r--r--erts/emulator/beam/export.h4
-rw-r--r--erts/emulator/beam/global.h4
-rw-r--r--erts/emulator/beam/module.c14
-rw-r--r--erts/emulator/beam/module.h4
-rw-r--r--erts/emulator/hipe/hipe_bif0.c2
13 files changed, 74 insertions, 74 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 4a01e62dc8..c14b86f811 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -89,20 +89,20 @@ load_module_2(BIF_ALIST_2)
ensure_no_breakpoints(BIF_P, 0, BIF_ARG_1);
erts_lock_code_ix();
- erts_start_loader_code_ix();
+ erts_start_staging_code_ix();
reason = erts_finish_loading(stp, BIF_P, 0, &BIF_ARG_1);
if (reason != NIL) {
if (reason == am_on_load) {
- erts_commit_loader_code_ix();
+ erts_commit_staging_code_ix();
}
else {
- erts_abort_loader_code_ix();
+ erts_abort_staging_code_ix();
}
res = TUPLE2(hp, am_error, reason);
} else {
- set_default_trace_pattern(BIF_ARG_1, erts_loader_code_ix());
- erts_commit_loader_code_ix();
+ set_default_trace_pattern(BIF_ARG_1, erts_staging_code_ix());
+ erts_commit_staging_code_ix();
res = TUPLE2(hp, am_module, BIF_ARG_1);
}
@@ -174,15 +174,15 @@ BIF_RETTYPE code_make_stub_module_3(BIF_ALIST_3)
ensure_no_breakpoints(BIF_P, 0, BIF_ARG_1);
erts_lock_code_ix();
- erts_start_loader_code_ix();
+ erts_start_staging_code_ix();
res = erts_make_stub_module(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3);
if (res == BIF_ARG_1) {
- erts_commit_loader_code_ix();
+ erts_commit_staging_code_ix();
}
else {
- erts_abort_loader_code_ix();
+ erts_abort_staging_code_ix();
}
erts_unlock_code_ix();
@@ -294,8 +294,8 @@ BIF_RETTYPE delete_module_1(BIF_ALIST_1)
ensure_no_breakpoints(BIF_P, 0, BIF_ARG_1);
erts_lock_code_ix();
- erts_start_loader_code_ix();
- code_ix = erts_loader_code_ix();
+ erts_start_staging_code_ix();
+ code_ix = erts_staging_code_ix();
{
Module *modp = erts_get_module(BIF_ARG_1, code_ix);
if (!modp) {
@@ -316,10 +316,10 @@ BIF_RETTYPE delete_module_1(BIF_ALIST_1)
}
if (res == am_true) {
- erts_commit_loader_code_ix();
+ erts_commit_staging_code_ix();
}
else {
- erts_abort_loader_code_ix();
+ erts_abort_staging_code_ix();
}
erts_unlock_code_ix();
@@ -869,7 +869,7 @@ delete_code(Process *c_p, ErtsProcLocks c_p_locks, Module* modp)
static void
delete_export_references(Eterm module)
{
- ErtsCodeIndex code_ix = erts_loader_code_ix();
+ ErtsCodeIndex code_ix = erts_staging_code_ix();
int i;
ASSERT(is_atom(module));
diff --git a/erts/emulator/beam/beam_catches.c b/erts/emulator/beam/beam_catches.c
index 72bd3583e1..548c10fa94 100644
--- a/erts/emulator/beam/beam_catches.c
+++ b/erts/emulator/beam/beam_catches.c
@@ -62,7 +62,7 @@ void beam_catches_init(void)
bccix[i] = bccix[i-1];
}
/* For initial load: */
- IF_DEBUG(bccix[erts_loader_code_ix()].is_prepared = 1);
+ IF_DEBUG(bccix[erts_staging_code_ix()].is_prepared = 1);
}
@@ -78,9 +78,9 @@ static void gc_old_vec(beam_catch_t* vec)
}
-void beam_catches_start_load(void)
+void beam_catches_start_staging(void)
{
- ErtsCodeIndex dst = erts_loader_code_ix();
+ ErtsCodeIndex dst = erts_staging_code_ix();
ErtsCodeIndex src = erts_active_code_ix();
beam_catch_t* prev_vec = bccix[dst].beam_catches;
@@ -91,15 +91,15 @@ void beam_catches_start_load(void)
IF_DEBUG(bccix[dst].is_prepared = 1);
}
-void beam_catches_end_load(int commit)
+void beam_catches_end_staging(int commit)
{
- IF_DEBUG(bccix[erts_loader_code_ix()].is_prepared = 0);
+ IF_DEBUG(bccix[erts_staging_code_ix()].is_prepared = 0);
}
unsigned beam_catches_cons(BeamInstr *cp, unsigned cdr)
{
int i;
- struct bc_code_ix* p = &bccix[erts_loader_code_ix()];
+ struct bc_code_ix* p = &bccix[erts_staging_code_ix()];
ASSERT(p->is_prepared);
/*
@@ -151,7 +151,7 @@ void beam_catches_delmod(unsigned head, BeamInstr *code, unsigned code_bytes,
struct bc_code_ix* p = &bccix[code_ix];
unsigned i, cdr;
- ASSERT((code_ix == erts_active_code_ix()) != bccix[erts_loader_code_ix()].is_prepared);
+ ASSERT((code_ix == erts_active_code_ix()) != bccix[erts_staging_code_ix()].is_prepared);
for(i = head; i != (unsigned)-1;) {
if (i >= p->tabsize) {
erl_exit(1, "beam_catches_delmod: index %#x is out of range\r\n", i);
diff --git a/erts/emulator/beam/beam_catches.h b/erts/emulator/beam/beam_catches.h
index 970772806b..309b5cc857 100644
--- a/erts/emulator/beam/beam_catches.h
+++ b/erts/emulator/beam/beam_catches.h
@@ -25,8 +25,8 @@
#define BEAM_CATCHES_NIL (-1)
void beam_catches_init(void);
-void beam_catches_start_load(void);
-void beam_catches_end_load(int commit);
+void beam_catches_start_staging(void);
+void beam_catches_end_staging(int commit);
unsigned beam_catches_cons(BeamInstr* cp, unsigned cdr);
BeamInstr *beam_catches_car(unsigned i);
void beam_catches_delmod(unsigned head, BeamInstr* code, unsigned code_bytes,
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index cc4bdea20e..d393ff6a34 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -4249,13 +4249,13 @@ final_touch(LoaderState* stp)
ep = erts_export_put(stp->module, stp->export[i].function,
stp->export[i].arity);
if (!on_load) {
- ep->addressv[erts_loader_code_ix()] = address;
+ ep->addressv[erts_staging_code_ix()] = address;
} else {
/*
* Don't make any of the exported functions
* callable yet.
*/
- ep->addressv[erts_loader_code_ix()] = ep->code+3;
+ ep->addressv[erts_staging_code_ix()] = ep->code+3;
ep->code[4] = (BeamInstr) address;
}
}
@@ -5531,7 +5531,7 @@ stub_final_touch(LoaderState* stp, BeamInstr* fp)
for (i = 0; i < n; i++) {
if (stp->export[i].function == function && stp->export[i].arity == arity) {
Export* ep = erts_export_put(mod, function, arity);
- ep->addressv[erts_loader_code_ix()] = fp+5;
+ ep->addressv[erts_staging_code_ix()] = fp+5;
return;
}
}
@@ -5953,7 +5953,7 @@ static erts_smp_mtx_t sverk_code_ix_lock; /*SVERK FIXME */
static erts_smp_rwmtx_t the_old_code_rwlocks[ERTS_NUM_CODE_IX];
#ifdef DEBUG
-# define CIX_TRACE(text) erts_fprintf(stderr, "CIX_TRACE: " text " act=%u load=%u\r\n", erts_active_code_ix(), erts_loader_code_ix())
+# define CIX_TRACE(text) erts_fprintf(stderr, "CIX_TRACE: " text " act=%u load=%u\r\n", erts_active_code_ix(), erts_staging_code_ix())
#else
# define CIX_TRACE(text)
#endif
@@ -5974,7 +5974,7 @@ ErtsCodeIndex erts_active_code_ix(void)
{
return erts_smp_atomic32_read_nob(&the_active_code_index);
}
-ErtsCodeIndex erts_loader_code_ix(void)
+ErtsCodeIndex erts_staging_code_ix(void)
{
return erts_smp_atomic32_read_nob(&the_loader_code_index);
}
@@ -6000,26 +6000,26 @@ int erts_is_code_ix_locked(void)
}
#endif
-void erts_start_loader_code_ix(void)
+void erts_start_staging_code_ix(void)
{
- beam_catches_start_load();
- export_start_load();
- module_start_load();
- erts_start_load_ranges();
+ beam_catches_start_staging();
+ export_start_staging();
+ module_start_staging();
+ erts_start_staging_ranges();
CIX_TRACE("start");
}
-void erts_commit_loader_code_ix(void)
+void erts_commit_staging_code_ix(void)
{
- beam_catches_end_load(1);
- export_end_load(1);
- module_end_load(1);
- erts_end_load_ranges(1);
+ beam_catches_end_staging(1);
+ export_end_staging(1);
+ module_end_staging(1);
+ erts_end_staging_ranges(1);
{
ErtsCodeIndex ix;
export_write_lock();
- ix = erts_loader_code_ix();
+ ix = erts_staging_code_ix();
erts_smp_atomic32_set_nob(&the_active_code_index, ix);
ix = (ix + 1) % ERTS_NUM_CODE_IX;
erts_smp_atomic32_set_nob(&the_loader_code_index, ix);
@@ -6028,12 +6028,12 @@ void erts_commit_loader_code_ix(void)
CIX_TRACE("commit");
}
-void erts_abort_loader_code_ix(void)
+void erts_abort_staging_code_ix(void)
{
- beam_catches_end_load(0);
- export_end_load(0);
- module_end_load(0);
- erts_end_load_ranges(0);
+ beam_catches_end_staging(0);
+ export_end_staging(0);
+ module_end_staging(0);
+ erts_end_staging_ranges(0);
CIX_TRACE("abort");
}
diff --git a/erts/emulator/beam/beam_ranges.c b/erts/emulator/beam/beam_ranges.c
index ae701ea0c9..0fc8d9dbfd 100644
--- a/erts/emulator/beam/beam_ranges.c
+++ b/erts/emulator/beam/beam_ranges.c
@@ -78,9 +78,9 @@ erts_init_ranges(void)
}
void
-erts_start_load_ranges(void)
+erts_start_staging_ranges(void)
{
- ErtsCodeIndex dst = erts_loader_code_ix();
+ ErtsCodeIndex dst = erts_staging_code_ix();
if (r[dst].modules) {
erts_smp_atomic_add_nob(&mem_used, -r[dst].allocated);
@@ -90,9 +90,9 @@ erts_start_load_ranges(void)
}
void
-erts_end_load_ranges(int commit)
+erts_end_staging_ranges(int commit)
{
- ErtsCodeIndex dst = erts_loader_code_ix();
+ ErtsCodeIndex dst = erts_staging_code_ix();
if (commit && r[dst].modules == NULL) {
Sint i;
@@ -123,7 +123,7 @@ erts_end_load_ranges(int commit)
void
erts_update_ranges(BeamInstr* code, Uint size)
{
- ErtsCodeIndex dst = erts_loader_code_ix();
+ ErtsCodeIndex dst = erts_staging_code_ix();
ErtsCodeIndex src = erts_active_code_ix();
Sint i;
Sint n;
diff --git a/erts/emulator/beam/code_ix.h b/erts/emulator/beam/code_ix.h
index 43acd08ebf..1f9c47f33c 100644
--- a/erts/emulator/beam/code_ix.h
+++ b/erts/emulator/beam/code_ix.h
@@ -25,7 +25,7 @@ typedef unsigned ErtsCodeIndex;
void erts_code_ix_init(void);
ErtsCodeIndex erts_active_code_ix(void);
-ErtsCodeIndex erts_loader_code_ix(void);
+ErtsCodeIndex erts_staging_code_ix(void);
/* Lock code_ix (enqueue and suspend until we get it)
*/
@@ -49,9 +49,9 @@ void erts_lock_code_ix(void);
*/
void erts_unlock_code_ix(void);
-void erts_start_loader_code_ix(void);
-void erts_commit_loader_code_ix(void);
-void erts_abort_loader_code_ix(void);
+void erts_start_staging_code_ix(void);
+void erts_commit_staging_code_ix(void);
+void erts_abort_staging_code_ix(void);
void erts_rwlock_old_code(ErtsCodeIndex);
void erts_rwunlock_old_code(ErtsCodeIndex);
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index 487c444df4..1184cb28fa 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -1473,7 +1473,7 @@ erl_start(int argc, char **argv)
init_shared_memory(boot_argc, boot_argv);
load_preloaded();
- erts_commit_loader_code_ix();
+ erts_commit_staging_code_ix();
erts_initialized = 1;
diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c
index 487d6ee963..b9dcb1fb47 100644
--- a/erts/emulator/beam/export.c
+++ b/erts/emulator/beam/export.c
@@ -89,7 +89,7 @@ export_info(int to, void *to_arg)
export_read_lock();
#endif
index_info(to, to_arg, &export_tables[erts_active_code_ix()]);
- hash_info(to, to_arg, &export_tables[erts_loader_code_ix()].htable);
+ hash_info(to, to_arg, &export_tables[erts_staging_code_ix()].htable);
#ifdef ERTS_SMP
if (lock)
export_read_unlock();
@@ -282,7 +282,7 @@ erts_find_function(Eterm m, Eterm f, unsigned int a, ErtsCodeIndex code_ix)
Export*
erts_export_put(Eterm mod, Eterm func, unsigned int arity)
{
- ErtsCodeIndex code_ix = erts_loader_code_ix();
+ ErtsCodeIndex code_ix = erts_staging_code_ix();
struct export_templ templ;
struct export_entry* ee;
@@ -326,7 +326,7 @@ erts_export_get_or_make_stub(Eterm mod, Eterm func, unsigned int arity)
struct export_templ templ;
struct export_entry* entry;
- IndexTable* tab = &export_tables[erts_loader_code_ix()];
+ IndexTable* tab = &export_tables[erts_staging_code_ix()];
init_template(&templ, mod, func, arity);
entry = (struct export_entry *) index_put_entry(tab, &templ.entry);
ep = entry->ep;
@@ -370,9 +370,9 @@ Export *export_get(Export *e)
IF_DEBUG(static ErtsCodeIndex debug_start_load_ix = 0;)
-void export_start_load(void)
+void export_start_staging(void)
{
- ErtsCodeIndex dst_ix = erts_loader_code_ix();
+ ErtsCodeIndex dst_ix = erts_staging_code_ix();
ErtsCodeIndex src_ix = erts_active_code_ix();
IndexTable* dst = &export_tables[dst_ix];
IndexTable* src = &export_tables[src_ix];
@@ -399,9 +399,9 @@ void export_start_load(void)
IF_DEBUG(debug_start_load_ix = dst_ix);
}
-void export_end_load(int commit)
+void export_end_staging(int commit)
{
- ASSERT(debug_start_load_ix == erts_loader_code_ix());
+ ASSERT(debug_start_load_ix == erts_staging_code_ix());
IF_DEBUG(debug_start_load_ix = -1);
}
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)
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index 6a3c36824b..b98f810455 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -891,8 +891,8 @@ Eterm erts_make_stub_module(Process* p, Eterm Mod, Eterm Beam, Eterm Info);
/* beam_ranges.c */
void erts_init_ranges(void);
-void erts_start_load_ranges(void);
-void erts_end_load_ranges(int commit);
+void erts_start_staging_ranges(void);
+void erts_end_staging_ranges(int commit);
void erts_update_ranges(BeamInstr* code, Uint size);
void erts_remove_from_ranges(BeamInstr* code);
UWord erts_ranges_sz(void);
diff --git a/erts/emulator/beam/module.c b/erts/emulator/beam/module.c
index f326aecebf..b0a3bd1fab 100644
--- a/erts/emulator/beam/module.c
+++ b/erts/emulator/beam/module.c
@@ -129,7 +129,7 @@ erts_put_module(Eterm mod)
|| erts_is_code_ix_locked()
|| erts_smp_thr_progress_is_blocking());
- mod_tab = &module_tables[erts_loader_code_ix()];
+ mod_tab = &module_tables[erts_staging_code_ix()];
e.module = atom_val(mod);
return (Module*) index_put_entry(mod_tab, (void*) &e);
}
@@ -155,10 +155,10 @@ static ErtsCodeIndex dbg_load_code_ix = 0;
static int entries_at_start_load = 0;
-void module_start_load(void)
+void module_start_staging(void)
{
IndexTable* src = &module_tables[erts_active_code_ix()];
- IndexTable* dst = &module_tables[erts_loader_code_ix()];
+ IndexTable* dst = &module_tables[erts_staging_code_ix()];
Module* src_mod;
Module* dst_mod;
int i;
@@ -191,15 +191,15 @@ void module_start_load(void)
}
entries_at_start_load = dst->entries;
- IF_DEBUG(dbg_load_code_ix = erts_loader_code_ix());
+ IF_DEBUG(dbg_load_code_ix = erts_staging_code_ix());
}
-void module_end_load(int commit)
+void module_end_staging(int commit)
{
- ASSERT(dbg_load_code_ix == erts_loader_code_ix());
+ ASSERT(dbg_load_code_ix == erts_staging_code_ix());
if (!commit) { /* abort */
- IndexTable* tab = &module_tables[erts_loader_code_ix()];
+ IndexTable* tab = &module_tables[erts_staging_code_ix()];
ASSERT(entries_at_start_load <= tab->entries);
index_erase_latest_from(tab, entries_at_start_load);
diff --git a/erts/emulator/beam/module.h b/erts/emulator/beam/module.h
index 8a87ae4952..209aa3b98a 100644
--- a/erts/emulator/beam/module.h
+++ b/erts/emulator/beam/module.h
@@ -43,8 +43,8 @@ Module* erts_get_module(Eterm mod, ErtsCodeIndex code_ix);
Module* erts_put_module(Eterm mod);
void init_module_table(void);
-void module_start_load(void);
-void module_end_load(int commit);
+void module_start_staging(void);
+void module_end_staging(int commit);
void module_info(int, void *);
Module *module_code(int, ErtsCodeIndex);
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index cb599bd682..e13d8fc182 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -648,7 +648,7 @@ static void *hipe_get_emu_address(Eterm m, Eterm f, unsigned int arity, int is_r
/* if not found, stub it via the export entry */
/* no lock needed around erts_export_get_or_make_stub() */
Export *export_entry = erts_export_get_or_make_stub(m, f, arity);
- address = export_entry->addressv[erts_loader_code_ix()];
+ address = export_entry->addressv[erts_staging_code_ix()];
}
return address;
}