From: Ivan Maidanski Date: Wed, 23 May 2018 08:43:04 +0000 (+0300) Subject: Fix cords for MANUAL_VDB X-Git-Tag: v8.0.0~169 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e12e820f357d1f58fbefb0e73ca559edfa251681;p=gc Fix cords for MANUAL_VDB * cord/cordbscs.c (CORD_cat_char_star, CORD CORD_cat, CORD_from_fn_inner, CORD_substr_closure): Call GC_end_stubborn_change. * cord/cordxtra.c (refill_cache): Likewise. * cord/tests/de.c (prune_map, add_map, add_hist, replace_line, generic_init): Likewise. --- diff --git a/cord/cordbscs.c b/cord/cordbscs.c index 9e6c8ab5..864eef91 100644 --- a/cord/cordbscs.c +++ b/cord/cordbscs.c @@ -232,6 +232,7 @@ CORD CORD_cat_char_star(CORD x, const char * y, size_t leny) result->len = (word)result_len; result->left = x; result->right = y; + GC_end_stubborn_change(result); if (depth >= MAX_DEPTH) { return(CORD_balance((CORD)result)); } else { @@ -273,6 +274,7 @@ CORD CORD_cat(CORD x, CORD y) result->len = (word)result_len; result->left = x; result->right = y; + GC_end_stubborn_change(result); if (depth >= MAX_DEPTH) { return(CORD_balance((CORD)result)); } else { @@ -313,6 +315,7 @@ static CordRep *CORD_from_fn_inner(CORD_fn fn, void * client_data, size_t len) result->len = (word)len; result->fn = fn; result->client_data = client_data; + GC_end_stubborn_change(result); return (CordRep *)result; } } @@ -363,6 +366,7 @@ CORD CORD_substr_closure(CORD x, size_t i, size_t n, CORD_fn f) if (sa == 0) OUT_OF_MEMORY; sa->sa_cord = (CordRep *)x; sa->sa_index = i; + GC_end_stubborn_change(sa); result = CORD_from_fn_inner(f, (void *)sa, n); if ((CORD)result != CORD_EMPTY && 0 == result -> function.null) result -> function.header = SUBSTR_HDR; diff --git a/cord/cordxtra.c b/cord/cordxtra.c index 5ee4df73..d29f3444 100644 --- a/cord/cordxtra.c +++ b/cord/cordxtra.c @@ -547,6 +547,8 @@ static char refill_cache(refill_data * client_data) new_cache -> tag = DIV_LINE_SZ(file_pos); /* Store barrier goes here. */ ATOMIC_WRITE(state -> lf_cache[line_no], new_cache); + GC_end_stubborn_change((/* no volatile */ void *)(state -> lf_cache + + line_no)); state -> lf_current = line_start + LINE_SZ; return(new_cache->data[MOD_LINE_SZ(file_pos)]); } diff --git a/cord/tests/de.c b/cord/tests/de.c index 9d74ae64..cc22df39 100644 --- a/cord/tests/de.c +++ b/cord/tests/de.c @@ -134,6 +134,7 @@ void prune_map(void) current_map_size++; if (map -> line < start_line - LINES && map -> previous != 0) { map -> previous = map -> previous -> previous; + GC_end_stubborn_change(map); } map = map -> previous; } while (map != 0); @@ -149,6 +150,7 @@ void add_map(int line, size_t pos) new_map -> line = line; new_map -> pos = pos; new_map -> previous = current_map; + GC_end_stubborn_change(new_map); current_map = new_map; current_map_size++; } @@ -194,7 +196,11 @@ void add_hist(CORD s) new_file -> file_contents = current = s; current_len = CORD_len(s); new_file -> previous = now; - if (now != 0) now -> map = current_map; + GC_end_stubborn_change(new_file); + if (now != NULL) { + now -> map = current_map; + GC_end_stubborn_change(now); + } now = new_file; } @@ -245,6 +251,7 @@ void replace_line(int i, CORD s) } } screen[i] = s; + GC_end_stubborn_change(screen + i); } } #else @@ -566,6 +573,7 @@ void generic_init(void) add_hist(initial); now -> map = current_map; now -> previous = now; /* Can't back up further: beginning of the world */ + GC_end_stubborn_change(now); need_redisplay = ALL; fix_cursor(); }