The internals of the deduplicator want to know if something is a type
that can have a forward to it fairly often, often enough that inlining
it brings a noticeable performance gain. Convert the one place in
libctf that can already benefit, even though it doesn't bring any sort
of performance gain there.
libctf/
* ctf-inlines.h (ctf_forwardable_kind): New.
* ctf-create.c (ctf_add_forward): Use it.
+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-inlines.h (ctf_forwardable_kind): New.
+ * ctf-create.c (ctf_add_forward): Use it.
+
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
* ctf-impl.h (ctf_get_ctt_size): Move definition from here...
ctf_dtdef_t *dtd;
ctf_id_t type = 0;
- if (kind != CTF_K_STRUCT && kind != CTF_K_UNION && kind != CTF_K_ENUM)
+ if (!ctf_forwardable_kind (kind))
return (ctf_set_errno (fp, ECTF_NOTSUE));
/* If the type is already defined or exists as a forward tag, just
return (fp->ctf_fileops->ctfo_get_ctt_size (fp, tp, sizep, incrementp));
}
+static inline int
+ctf_forwardable_kind (int kind)
+{
+ return (kind == CTF_K_STRUCT || kind == CTF_K_UNION || kind == CTF_K_ENUM);
+}
+
static inline int
ctf_dynhash_cinsert (ctf_dynhash_t *h, const void *k, const void *v)