From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2103) id 633983849AD9; Fri, 19 Apr 2024 15:51:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 633983849AD9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713541889; bh=3cRcwId6u2bCT61xk05R8hsdRIiyjls9+RfCaR5RgW0=; h=From:To:Subject:Date:From; b=XUiyd9GER7/5tfpbhQOEPMjHj0k2WFf8fF5W/F4llUAYIiIWypb6jfZdiZ2xHr9/s XKQyIQm0O1vNoWlOSH38etmBWgT1Pst0RkScLMYGCeL93UHQXJgZwd0qYALxliEKQO /rSndrgPNw3T45ACIodZ8Poibr3dfB180ychneuI= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Alcock To: binutils-cvs@sourceware.org Subject: [binutils-gdb] libctf: delete LCTF_DIRTY X-Act-Checkin: binutils-gdb X-Git-Author: Nick Alcock X-Git-Refname: refs/heads/master X-Git-Oldrev: b4b77b26e220c065123c455c8ed81086c8481c10 X-Git-Newrev: 4fa4e3d92ac3940305b4521aef3e58555a4aa4b5 Message-Id: <20240419155129.633983849AD9@sourceware.org> Date: Fri, 19 Apr 2024 15:51:29 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4fa4e3d92ac3= 940305b4521aef3e58555a4aa4b5 commit 4fa4e3d92ac3940305b4521aef3e58555a4aa4b5 Author: Nick Alcock Date: Fri Jan 5 11:09:01 2024 +0000 libctf: delete LCTF_DIRTY =20 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. =20 libctf/ =20 * 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. Diff: --- libctf/ctf-create.c | 15 --------------- libctf/ctf-impl.h | 3 +-- libctf/ctf-link.c | 2 -- libctf/ctf-serialize.c | 5 ----- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index 7aa244e5ec7..23bbf92ff1a 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -148,7 +148,6 @@ ctf_create (int *errp) fp->ctf_names =3D names; fp->ctf_dtoldid =3D 0; fp->ctf_snapshot_lu =3D 0; - fp->ctf_flags |=3D LCTF_DIRTY; =20 /* Make sure the ptrtab starts out at a reasonable size. */ =20 @@ -347,10 +346,6 @@ ctf_discard (ctf_dict_t *fp) { fp->ctf_dtoldid, fp->ctf_snapshot_lu + 1 }; =20 - /* Update required? */ - if (!(fp->ctf_flags & LCTF_DIRTY)) - return 0; - return (ctf_rollback (fp, last_update)); } =20 @@ -415,9 +410,6 @@ ctf_rollback (ctf_dict_t *fp, ctf_snapshot_id_t id) fp->ctf_typemax =3D id.dtd_id; fp->ctf_snapshots =3D id.snapshot_id; =20 - if (fp->ctf_snapshots =3D=3D fp->ctf_snapshot_lu) - fp->ctf_flags &=3D ~LCTF_DIRTY; - return 0; } =20 @@ -482,8 +474,6 @@ ctf_add_generic (ctf_dict_t *fp, uint32_t flag, const c= har *name, int kind, if (ctf_dtd_insert (fp, dtd, flag, kind) < 0) goto err; /* errno is set for us. */ =20 - fp->ctf_flags |=3D LCTF_DIRTY; - *rp =3D dtd; return type; =20 @@ -729,7 +719,6 @@ ctf_set_array (ctf_dict_t *fp, ctf_id_t type, const ctf= _arinfo_t *arp) return (ctf_set_errno (ofp, ECTF_BADID)); =20 vlen =3D (ctf_array_t *) dtd->dtd_vlen; - fp->ctf_flags |=3D LCTF_DIRTY; vlen->cta_contents =3D (uint32_t) arp->ctr_contents; vlen->cta_index =3D (uint32_t) arp->ctr_index; vlen->cta_nelems =3D arp->ctr_nelems; @@ -1113,8 +1102,6 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, co= nst char *name, =20 dtd->dtd_data.ctt_info =3D CTF_TYPE_INFO (kind, root, vlen + 1); =20 - fp->ctf_flags |=3D LCTF_DIRTY; - return 0; } =20 @@ -1296,7 +1283,6 @@ ctf_add_member_offset (ctf_dict_t *fp, ctf_id_t souid= , const char *name, dtd->dtd_data.ctt_lsizelo =3D CTF_SIZE_TO_LSIZE_LO (ssize); dtd->dtd_data.ctt_info =3D CTF_TYPE_INFO (kind, root, vlen + 1); =20 - fp->ctf_flags |=3D LCTF_DIRTY; return 0; } =20 @@ -1365,7 +1351,6 @@ ctf_add_variable_forced (ctf_dict_t *fp, const char *= name, ctf_id_t ref) return -1; /* errno is set for us. */ } =20 - fp->ctf_flags |=3D LCTF_DIRTY; return 0; } =20 diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index f4fa3234681..dc57d6f64c7 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -589,8 +589,7 @@ struct ctf_next ((fp)->ctf_dictops->ctfo_get_vbytes(fp, kind, size, vlen)) =20 #define LCTF_CHILD 0x0001 /* CTF dict is a child. */ -#define LCTF_DIRTY 0x0002 /* CTF dict has been modified. */ -#define LCTF_LINKING 0x0004 /* CTF link is underway: respect ctf_link_fla= gs. */ +#define LCTF_LINKING 0x0002 /* CTF link is underway: respect ctf_link_fla= gs. */ =20 extern ctf_dynhash_t *ctf_name_table (ctf_dict_t *, int); extern const ctf_type_t *ctf_lookup_by_id (ctf_dict_t **, ctf_id_t); diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 9d2d29416d3..44d4e496f6a 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -1568,7 +1568,6 @@ ctf_link_intern_extern_string (void *key _libctf_unus= ed_, void *value, ctf_dict_t *fp =3D (ctf_dict_t *) value; ctf_link_out_string_cb_arg_t *arg =3D (ctf_link_out_string_cb_arg_t *) a= rg_; =20 - fp->ctf_flags |=3D LCTF_DIRTY; if (!ctf_str_add_external (fp, arg->str, arg->offset)) arg->err =3D ENOMEM; } @@ -1596,7 +1595,6 @@ ctf_link_add_strtab (ctf_dict_t *fp, ctf_link_strtab_= string_f *add_string, { ctf_link_out_string_cb_arg_t iter_arg =3D { str, offset, 0 }; =20 - fp->ctf_flags |=3D LCTF_DIRTY; if (!ctf_str_add_external (fp, str, offset)) err =3D ENOMEM; =20 diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c index 7092264f446..9dd7fbda285 100644 --- a/libctf/ctf-serialize.c +++ b/libctf/ctf-serialize.c @@ -980,10 +980,6 @@ ctf_serialize (ctf_dict_t *fp) if (fp->ctf_stypes > 0) return (ctf_set_errno (fp, ECTF_RDONLY)); =20 - /* 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, af= ter strtab finalization is complete. Only this function, and functions it @@ -1156,7 +1152,6 @@ ctf_serialize (ctf_dict_t *fp) nfp->ctf_parent =3D fp->ctf_parent; nfp->ctf_parent_unreffed =3D fp->ctf_parent_unreffed; nfp->ctf_refcnt =3D fp->ctf_refcnt; - nfp->ctf_flags |=3D fp->ctf_flags & ~LCTF_DIRTY; if (nfp->ctf_dynbase =3D=3D NULL) nfp->ctf_dynbase =3D buf; /* Make sure buf is freed on close. */ nfp->ctf_dthash =3D fp->ctf_dthash;