From 88c771c1d69c98169ef9bc10c27ed4378854d368 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 24 Jan 2012 17:08:40 +0100 Subject: erts: Cleanup code loading --- erts/emulator/beam/beam_catches.h | 2 +- erts/emulator/beam/beam_load.c | 4 ++-- erts/emulator/beam/erl_init.c | 2 +- erts/emulator/beam/export.c | 9 ++++----- erts/emulator/hipe/hipe_bif0.c | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) (limited to 'erts/emulator') diff --git a/erts/emulator/beam/beam_catches.h b/erts/emulator/beam/beam_catches.h index 309b5cc857..4a0e070c69 100644 --- a/erts/emulator/beam/beam_catches.h +++ b/erts/emulator/beam/beam_catches.h @@ -20,7 +20,7 @@ #ifndef __BEAM_CATCHES_H #define __BEAM_CATCHES_H -#include "global.h" /*SVERK the code_ix stuff */ +#include "code_ix.h" #define BEAM_CATCHES_NIL (-1) diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index d393ff6a34..4ac426fc9e 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -1240,7 +1240,7 @@ load_import_table(LoaderState* stp) * If the export entry refers to a BIF, get the pointer to * the BIF function. */ - if ((e = erts_active_export_entry(mod, func, arity)) != NULL) { /*SVERK does it matter which one we use? */ + if ((e = erts_active_export_entry(mod, func, arity)) != NULL) { if (e->code[3] == (BeamInstr) em_apply_bif) { stp->import[i].bf = (BifFunction) e->code[4]; if (func == am_load_nif && mod == am_erlang && arity == 2) { @@ -5952,7 +5952,7 @@ static erts_smp_atomic32_t the_loader_code_index; 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 +#if 0 # 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) diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c index 1184cb28fa..2d192b3fc4 100644 --- a/erts/emulator/beam/erl_init.c +++ b/erts/emulator/beam/erl_init.c @@ -236,7 +236,7 @@ void erl_error(char *fmt, va_list args) static int early_init(int *argc, char **argv); void -erts_short_init_SVERK_SAYS_NOT_USED(void) +erts_short_init(void) { int ncpu = early_init(NULL, NULL); erl_init(ncpu); diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c index b9dcb1fb47..4a2a77a527 100644 --- a/erts/emulator/beam/export.c +++ b/erts/emulator/beam/export.c @@ -274,9 +274,8 @@ erts_find_function(Eterm m, Eterm f, unsigned int a, ErtsCodeIndex code_ix) * Returns a pointer to an existing export entry for a MFA, * or creates a new one and returns the pointer. * - * This function provides unlocked write access to the main export - * table. It should only be used during start up or when - * all other threads are blocked. + * This function acts on the staging export table. It should only be used + * to load new code. */ Export* @@ -318,11 +317,11 @@ erts_export_get_or_make_stub(Eterm mod, Eterm func, unsigned int arity) ep = erts_find_export_entry(mod, func, arity, code_ix); if (ep == 0) { /* - * The code is not loaded (yet). Put the export in the loader + * The code is not loaded (yet). Put the export in the staging * export table, to avoid having to lock the active export table. */ export_write_lock(); - if (erts_active_code_ix() == code_ix) { /*SVERK barrier? */ + if (erts_active_code_ix() == code_ix) { struct export_templ templ; struct export_entry* entry; diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c index e13d8fc182..ad1552e7eb 100644 --- a/erts/emulator/hipe/hipe_bif0.c +++ b/erts/emulator/hipe/hipe_bif0.c @@ -609,7 +609,7 @@ static Uint *hipe_find_emu_address(Eterm mod, Eterm name, unsigned int arity) Uint *code_base; int i, n; - modp = erts_get_module(mod, erts_active_code_ix()); /*SVERK ?? */ + modp = erts_get_module(mod, erts_active_code_ix()); if (modp == NULL || (code_base = modp->curr.code) == NULL) return NULL; n = code_base[MI_NUM_FUNCTIONS]; @@ -1591,7 +1591,7 @@ BIF_RETTYPE hipe_nonclosure_address(BIF_ALIST_2) f = tp[2]; if (is_not_atom(m) || is_not_atom(f)) goto badfun; - if (!erts_active_export_entry(m, f, BIF_ARG_2)) /*SVERK active? */ + if (!erts_active_export_entry(m, f, BIF_ARG_2)) goto badfun; } else goto badfun; -- cgit v1.2.3