diff options
author | Sverker Eriksson <[email protected]> | 2012-01-19 14:53:26 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-02-21 12:22:59 +0100 |
commit | b45686b4bc9b8bf07190d6b13b2e9a8167c61184 (patch) | |
tree | f617946998fc6cfaeed412392b87db26e9a2b5b9 /erts/emulator/beam/export.c | |
parent | c9d4422cb4f54363096d4efb6d667071450fa50b (diff) | |
download | otp-b45686b4bc9b8bf07190d6b13b2e9a8167c61184.tar.gz otp-b45686b4bc9b8bf07190d6b13b2e9a8167c61184.tar.bz2 otp-b45686b4bc9b8bf07190d6b13b2e9a8167c61184.zip |
erts: Add abort logic to export tables
Diffstat (limited to 'erts/emulator/beam/export.c')
-rw-r--r-- | erts/emulator/beam/export.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c index e5d9da187a..c74a40b0db 100644 --- a/erts/emulator/beam/export.c +++ b/erts/emulator/beam/export.c @@ -141,13 +141,11 @@ export_alloc(struct export_entry* tmpl_e) return &blob->entryv[blob->top_ix]; } -/*SVERK static void export_free(struct export_entry* obj) { erts_free(ERTS_ALC_T_EXPORT, (void*) obj); } -*/ void init_export_table(void) @@ -163,7 +161,7 @@ init_export_table(void) f.hash = (H_FUN) export_hash; f.cmp = (HCMP_FUN) export_cmp; f.alloc = (HALLOC_FUN) export_alloc; - f.free = (HFREE_FUN) NULL; /*SVERK export_free;*/ + f.free = (HFREE_FUN) export_free; for (i=0; i<ERTS_NUM_CODE_IX; i++) { erts_index_init(ERTS_ALC_T_EXPORT_TABLE, &export_tables[i], "export_list", @@ -396,6 +394,8 @@ static struct export_blob* entry_to_blob(struct export_entry* ee) IF_DEBUG(static ErtsCodeIndex debug_start_load_ix = 0;) +static int entries_at_start_load = 0; + void export_start_load(void) { ErtsCodeIndex dst_ix = erts_loader_code_ix(); @@ -440,7 +440,7 @@ void export_start_load(void) dst->htable.fun.alloc = (HALLOC_FUN) &export_alloc; /* restore */ - /*SVERK Remember dst->entries in order to purge on abort */ + entries_at_start_load = dst->entries; IF_DEBUG(debug_start_load_ix = dst_ix); } @@ -449,7 +449,12 @@ void export_end_load(int commit) { ASSERT(debug_start_load_ix == erts_loader_code_ix()); - /*SVERK Purge if abort */ + if (!commit) { /* abort */ + IndexTable* tab = &export_tables[erts_loader_code_ix()]; + + ASSERT(entries_at_start_load <= tab->entries); + index_erase_latest_from(tab, entries_at_start_load); + } IF_DEBUG(debug_start_load_ix = -1); } |