Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/tools/ctf/cvt XXX: A crude hack to ...



details:   https://anonhg.NetBSD.org/src/rev/68e52daff473
branches:  trunk
changeset: 457736:68e52daff473
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Jul 16 07:27:35 2019 +0000

description:
XXX: A crude hack to bring down the number of types for a
GENRIC kernel below 2**15-1 (from ~34000 to ~29800).

Remove the type attributes "volatile", "const" and "restrict",
for DTRACE these attributes are of little value.

diffstat:

 external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c |  51 +++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diffs (74 lines):

diff -r 8828ae61781d -r 68e52daff473 external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c
--- a/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c     Tue Jul 16 07:26:41 2019 +0000
+++ b/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c     Tue Jul 16 07:27:35 2019 +0000
@@ -41,6 +41,7 @@
 #include "ctftools.h"
 #include "hash.h"
 #include "memory.h"
+#include "traverse.h"
 
 /*
  * Due to 4432619, the 6.1 compiler will sometimes incorrectly generate pointer
@@ -320,6 +321,55 @@
        }
 }
 
+/*
+ * XXX: A crude hack to bring down the number of types for a
+ * GENRIC kernel below 2**15-1 (from ~34000 to ~29800).
+ *
+ * Remove the type attributes "volatile", "const" and "restrict",
+ * for DTRACE these attributes are of little value.
+ */
+
+static int
+fix_kill_attr_cb(tdesc_t *tdp, tdesc_t **tdpp, void *private __unused)
+{
+
+       while (tdp->t_type == VOLATILE ||
+           tdp->t_type == RESTRICT ||
+           tdp->t_type == CONST)
+               tdp = tdp->t_tdesc;
+
+       *tdpp = tdp;
+
+       return 1;
+}
+
+static tdtrav_cb_f fix_kill_attr_tab[] = {
+       NULL,
+       NULL,                   /* intrinsic */
+       NULL,                   /* pointer */
+       NULL,                   /* reference */
+       NULL,                   /* array */
+       NULL,                   /* function */
+       NULL,                   /* struct */
+       NULL,                   /* union */
+       NULL,                   /* class */
+       NULL,                   /* enum */
+       NULL            ,       /* forward */
+       NULL,                   /* typedef */
+       NULL,                   /* typedef unres */
+       fix_kill_attr_cb,       /* volatile */
+       fix_kill_attr_cb,       /* const */
+       fix_kill_attr_cb,       /* restrict */
+};
+
+static void
+fix_kill_attr(tdata_t *td, size_t ptrsize)
+{
+
+       (void) iitraverse_hash(td->td_iihash, &td->td_curvgen,
+           fix_kill_attr_tab, NULL, NULL, NULL);
+}
+
 #endif /* __NetBSD__ */
 
 void
@@ -328,5 +378,6 @@
        fix_small_cpu_struct(td, ptrsize);
 #ifdef __NetBSD__
        fix_kmutex_private(td, ptrsize);
+       fix_kill_attr(td, ptrsize);
 #endif
 }



Home | Main Index | Thread Index | Old Index