libctf: delete LCTF_DIRTY

This flag was meant as an optimization to avoid reserializing dicts
unnecessarily.  It was critically necessary back when serialization was
done by ctf_update() and you had to call that every time you wanted any
new modifications to the type table to be usable by other types, but
that has been unnecessary for years now, and serialization is only done
once when writing out, which one would naturally assume would always
serialize the dict.  Worse, it never really worked: it only tracked
newly-added types, not things like added symbols which might equally
well require reserialization, and it gets in the way of an upcoming
change.  Delete entirely.

libctf/

	* ctf-create.c (ctf_create): Drop LCTF_DIRTY.
	(ctf_discard): Likewise.
	(ctf_rollback): Likewise.
	(ctf_add_generic): Likewise.
	(ctf_set_array): Likewise.
	(ctf_add_enumerator): Likewise.
	(ctf_add_member_offset): Likewise.
	(ctf_add_variable_forced): Likewise.
	* ctf-link.c (ctf_link_intern_extern_string): Likewise.
	(ctf_link_add_strtab): Likewise.
	* ctf-serialize.c (ctf_serialize): Likewise.
	* ctf-impl.h (LCTF_DIRTY): Likewise.
	(LCTF_LINKING): Renumber.
This commit is contained in:
Nick Alcock
2024-01-05 11:09:01 +00:00
parent b4b77b26e2
commit 4fa4e3d92a
4 changed files with 1 additions and 24 deletions

View File

@@ -980,10 +980,6 @@ ctf_serialize (ctf_dict_t *fp)
if (fp->ctf_stypes > 0)
return (ctf_set_errno (fp, ECTF_RDONLY));
/* Update required? */
if (!(fp->ctf_flags & LCTF_DIRTY))
return 0;
/* The strtab refs table must be empty at this stage. Any refs already added
will be corrupted by any modifications, including reserialization, after
strtab finalization is complete. Only this function, and functions it
@@ -1156,7 +1152,6 @@ ctf_serialize (ctf_dict_t *fp)
nfp->ctf_parent = fp->ctf_parent;
nfp->ctf_parent_unreffed = fp->ctf_parent_unreffed;
nfp->ctf_refcnt = fp->ctf_refcnt;
nfp->ctf_flags |= fp->ctf_flags & ~LCTF_DIRTY;
if (nfp->ctf_dynbase == NULL)
nfp->ctf_dynbase = buf; /* Make sure buf is freed on close. */
nfp->ctf_dthash = fp->ctf_dthash;