[DTrace-devel] [PATCH 7/7 v2 REVIEWED] Remove obsolete (dead) code
Kris Van Hees
kris.van.hees at oracle.com
Sat May 28 05:37:15 UTC 2022
- Remove old (obsolete) implementation of dt_cg_ldsize()
- Remove old (obsolete) implementation of dtrace_work()
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
---
libdtrace/dt_cg.c | 48 ++-------------------------------
libdtrace/dt_work.c | 66 +--------------------------------------------
2 files changed, 3 insertions(+), 111 deletions(-)
diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index b4c68713..d31325a2 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -2076,9 +2076,8 @@ dt_cg_setx(dt_irlist_t *dlp, int reg, uint64_t x)
uint_t
dt_cg_ldsize(dt_node_t *dnp, ctf_file_t *ctfp, ctf_id_t type, ssize_t *ret_size)
{
-#if 1
- ctf_encoding_t e;
- ssize_t size;
+ ctf_encoding_t e;
+ ssize_t size;
/*
* If we're loading a bit-field, the size of our load is found by
@@ -2100,49 +2099,6 @@ dt_cg_ldsize(dt_node_t *dnp, ctf_file_t *ctfp, ctf_id_t type, ssize_t *ret_size)
*ret_size = size;
return ldstw[size];
-#else
- static const uint_t ops[] = {
- DIF_OP_LDUB, DIF_OP_LDUH, 0, DIF_OP_LDUW,
- 0, 0, 0, DIF_OP_LDX,
- DIF_OP_LDSB, DIF_OP_LDSH, 0, DIF_OP_LDSW,
- 0, 0, 0, DIF_OP_LDX,
- DIF_OP_ULDUB, DIF_OP_ULDUH, 0, DIF_OP_ULDUW,
- 0, 0, 0, DIF_OP_ULDX,
- DIF_OP_ULDSB, DIF_OP_ULDSH, 0, DIF_OP_ULDSW,
- 0, 0, 0, DIF_OP_ULDX,
- };
-
- ctf_encoding_t e;
- ssize_t size;
-
- /*
- * If we're loading a bit-field, the size of our load is found by
- * rounding cte_bits up to a byte boundary and then finding the
- * nearest power of two to this value (see clp2(), above).
- */
- if ((dnp->dn_flags & DT_NF_BITFIELD) &&
- ctf_type_encoding(ctfp, type, &e) != CTF_ERR)
- size = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY);
- else
- size = ctf_type_size(ctfp, type);
-
- if (size < 1 || size > 8 || (size & (size - 1)) != 0) {
- xyerror(D_UNKNOWN, "internal error -- cg cannot load "
- "size %ld when passed by value\n", (long)size);
- }
-
- size--; /* convert size to 3-bit index */
-
- if (dnp->dn_flags & DT_NF_SIGNED)
- size |= 0x08;
- if (dnp->dn_flags & DT_NF_USERLAND)
- size |= 0x10;
-
- if (ret_size)
- *ret_size = size;
-
- return ops[size];
-#endif
}
static void
diff --git a/libdtrace/dt_work.c b/libdtrace/dt_work.c
index ff2a2458..8936b52f 100644
--- a/libdtrace/dt_work.c
+++ b/libdtrace/dt_work.c
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -153,14 +153,6 @@ dtrace_stop(dtrace_hdl_t *dtp)
dtp->dt_stopped = 1;
dtp->dt_endedon = dt_state_get_endedon(dtp);
-#if 0
- /*
- * Now that we're stopped, we're going to get status one final time.
- */
- if (dt_ioctl(dtp, DTRACEIOC_STATUS, &dtp->dt_status[gen]) == -1)
- return dt_set_errno(dtp, errno);
-#endif
-
if (dt_handle_status(dtp, &dtp->dt_status[gen ^ 1],
&dtp->dt_status[gen]) == -1)
return -1;
@@ -168,61 +160,6 @@ dtrace_stop(dtrace_hdl_t *dtp)
return 0;
}
-#if 0
-dtrace_workstatus_t
-dtrace_work(dtrace_hdl_t *dtp, FILE *fp,
- dtrace_consume_probe_f *pfunc, dtrace_consume_rec_f *rfunc, void *arg)
-{
- int status = dtrace_status(dtp);
- dtrace_optval_t policy = dtp->dt_options[DTRACEOPT_BUFPOLICY];
- dtrace_workstatus_t rval;
-
- switch (status) {
- case DTRACE_STATUS_EXITED:
- case DTRACE_STATUS_FILLED:
- case DTRACE_STATUS_STOPPED:
- /*
- * Tracing is stopped. We now want to force dtrace_consume()
- * and dtrace_aggregate_snap() to proceed, regardless of
- * switchrate and aggrate. We do this by clearing the times.
- */
- dtp->dt_lastswitch = 0;
- dtp->dt_lastagg = 0;
- rval = DTRACE_WORKSTATUS_DONE;
- break;
-
- case DTRACE_STATUS_NONE:
- case DTRACE_STATUS_OKAY:
- rval = DTRACE_WORKSTATUS_OKAY;
- break;
-
- default:
- return DTRACE_WORKSTATUS_ERROR;
- }
-
- if ((status == DTRACE_STATUS_NONE || status == DTRACE_STATUS_OKAY) &&
- policy != DTRACEOPT_BUFPOLICY_SWITCH) {
- /*
- * There either isn't any status or things are fine -- and
- * this is a "ring" or "fill" buffer. We don't want to consume
- * any of the trace data or snapshot the aggregations; we just
- * return.
- */
- assert(rval == DTRACE_WORKSTATUS_OKAY);
- return rval;
- }
-
-#if 0
- if (dtrace_aggregate_snap(dtp) == -1)
- return DTRACE_WORKSTATUS_ERROR;
-#endif
-
- if (dtrace_consume(dtp, fp, pfunc, rfunc, arg) == -1)
- return DTRACE_WORKSTATUS_ERROR;
-
- return rval;
-}
-#else
dtrace_workstatus_t
dtrace_work(dtrace_hdl_t *dtp, FILE *fp, dtrace_consume_probe_f *pfunc,
dtrace_consume_rec_f *rfunc, void *arg)
@@ -248,4 +185,3 @@ dtrace_work(dtrace_hdl_t *dtp, FILE *fp, dtrace_consume_probe_f *pfunc,
return rval;
}
-#endif
--
2.34.1
More information about the DTrace-devel
mailing list