From 6badfc94793e998d30ba1dff64a0ed9017dca130 Mon Sep 17 00:00:00 2001 From: ketmar Date: Fri, 13 Nov 2020 03:09:53 +0000 Subject: [PATCH] asmx86: clear only dirty buckets FossilOrigin-Name: 4d814a615ea1545308af5f5b13a126f00948d5e65f742943798f5ecb2f506465 --- libs/asmx86/user-labelman.f | 46 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/libs/asmx86/user-labelman.f b/libs/asmx86/user-labelman.f index 4f2b933..a791bf2 100644 --- a/libs/asmx86/user-labelman.f +++ b/libs/asmx86/user-labelman.f @@ -82,8 +82,10 @@ true value do-fix-label-name? ;; use 256 buckets, because it is the easiest way lman-use-hash-table [IF] - 256 cells brk-buffer: info-hash-buckets - info-hash-buckets 256 cells erase + 0 value info-hash-buckets + 0 value info-hash-buckets-dirty + \ 256 cells brk-buffer: info-hash-buckets + \ info-hash-buckets 256 cells erase [ELSE] 0 var info-list-head [ENDIF] @@ -91,7 +93,10 @@ lman-use-hash-table [IF] : Reinit ( -- ) lman-use-hash-table [IF] + info-hash-buckets ifnot 256 cells brk-alloc to info-hash-buckets endif + info-hash-buckets-dirty ifnot 256 cells brk-alloc to info-hash-buckets-dirty endif info-hash-buckets 256 cells erase + info-hash-buckets-dirty 256 cells erase [ELSE] info-list-head 0! [ENDIF] @@ -295,7 +300,7 @@ lman-debug lman-fixup-debug or lman-debug-forth or [IF] >r ;; link it lman-use-hash-table [IF] - 2dup lman-name-hash-folded info-hash-buckets cells^ + 2dup lman-name-hash-folded info-hash-buckets cells^ dup @ r@ rot ! r@ ! [ELSE] @@ -317,7 +322,12 @@ lman-debug lman-fixup-debug or lman-debug-forth or [IF] : hide-label ( nfo -- ) ;; simply set name length to zero - nfo->nfa 0! + nfo->nfa + lman-use-hash-table [IF] + ;; mark bucket dirty + dup @ if dup count lman-name-hash-folded info-hash-buckets-dirty cells^ 1! endif + [ENDIF] + 0! ; @@ -350,6 +360,21 @@ lman-debug lman-fixup-debug or lman-debug-forth or [IF] nip endif repeat drop + [ELSE] + 256 for ;; for each bucket + info-hash-buckets-dirty i +cells @ if ;; dirty bucket + \ endcr ." *** bucket " i . ." is dirty!\n" + 0 info-hash-buckets-dirty i +cells ! + 0 info-hash-buckets i +cells + begin @ dup while ( prev curr ) + dup nfo-is-hidden? if + \ endcr ." dropped label in bucket " i . cr + over if 2dup @ swap ! + else dup @ i info-hash-buckets cells^ ! endif + else nip dup endif + repeat 2drop + endif + endfor [ENDIF] ; @@ -361,28 +386,27 @@ lman-debug lman-fixup-debug or lman-debug-forth or [IF] ;; cfa can push any number of data before stopflag if stopflag is non-zero : foreach-label ( cfa -- ... flag ) lman-use-hash-table [IF] - ;; for each bucket - 256 0 do + 256 for ;; for each bucket info-hash-buckets i +cells swap >r ;; move cfa to rstack - begin @ ?dup while + begin @ dup while ;; skip hidden labels dup nfo-is-hidden? ifnot ;; ( nfo | cfa ) r@ over >r execute ?dup if 2rdrop unloop exit endif r> endif - repeat r> - loop drop + repeat drop r> + endfor drop [ELSE] - >r info-list-head begin @ ?dup while + >r info-list-head begin @ dup while ;; skip hidden labels dup nfo-is-hidden? ifnot ;; ( nfo | cfa ) r@ over >r execute ?dup if 2rdrop exit endif r> endif - repeat rdrop + repeat drop rdrop [ENDIF] 0 ; -- 2.11.4.GIT