diff options
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r-- | erts/emulator/beam/beam_load.c | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index e966f423ec..7ac2b9f77e 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -5940,122 +5940,3 @@ static int safe_mul(UWord a, UWord b, UWord* resp) } } - -/*SVERK Do these deserve a file of their own maybe? */ - -static erts_smp_atomic32_t the_active_code_index; -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]; - -#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) -#endif - -void erts_code_ix_init(void) -{ - int i; - - erts_smp_atomic32_init_nob(&the_active_code_index, 0); - erts_smp_atomic32_init_nob(&the_loader_code_index, 0); - erts_smp_mtx_init_x(&sverk_code_ix_lock, "sverk_code_ix_lock", NIL); /*SVERK FIXME */ - for (i=0; i<ERTS_NUM_CODE_IX; i++) { - erts_smp_rwmtx_init_x(&the_old_code_rwlocks[i], "old_code", make_small(i)); - } - CIX_TRACE("init"); -} -ErtsCodeIndex erts_active_code_ix(void) -{ - return erts_smp_atomic32_read_nob(&the_active_code_index); -} -ErtsCodeIndex erts_staging_code_ix(void) -{ - return erts_smp_atomic32_read_nob(&the_loader_code_index); -} - -/* Lock code_ix (enqueue and suspend until we get it) -*/ -void erts_lock_code_ix(void) -{ - erts_smp_mtx_lock(&sverk_code_ix_lock); /*SVERK FIXME */ -} - -/* Unlock code_ix (resume first waiter) -*/ -void erts_unlock_code_ix(void) -{ - erts_smp_mtx_unlock(&sverk_code_ix_lock); /*SVERK FIXME */ -} - -#ifdef ERTS_ENABLE_LOCK_CHECK -int erts_is_code_ix_locked(void) -{ - return erts_smp_lc_mtx_is_locked(&sverk_code_ix_lock); -} -#endif - -void erts_start_staging_code_ix(void) -{ - beam_catches_start_staging(); - export_start_staging(); - module_start_staging(); - erts_start_staging_ranges(); - CIX_TRACE("start"); -} - - -void erts_commit_staging_code_ix(void) -{ - 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_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); - export_write_unlock(); - } - CIX_TRACE("commit"); -} - -void erts_abort_staging_code_ix(void) -{ - beam_catches_end_staging(0); - export_end_staging(0); - module_end_staging(0); - erts_end_staging_ranges(0); - CIX_TRACE("abort"); -} - -/*SVERK old_code lock should maybe be part of module.c */ -void erts_rwlock_old_code(ErtsCodeIndex code_ix) -{ - erts_smp_rwmtx_rwlock(&the_old_code_rwlocks[code_ix]); -} -void erts_rwunlock_old_code(ErtsCodeIndex code_ix) -{ - erts_smp_rwmtx_rwunlock(&the_old_code_rwlocks[code_ix]); -} -void erts_rlock_old_code(ErtsCodeIndex code_ix) -{ - erts_smp_rwmtx_rlock(&the_old_code_rwlocks[code_ix]); -} -void erts_runlock_old_code(ErtsCodeIndex code_ix) -{ - erts_smp_rwmtx_runlock(&the_old_code_rwlocks[code_ix]); -} - -#ifdef ERTS_ENABLE_LOCK_CHECK -int erts_is_old_code_rlocked(ErtsCodeIndex code_ix) -{ - return erts_smp_lc_rwmtx_is_rlocked(&the_old_code_rwlocks[code_ix]); -} -#endif - |