[DTrace-devel] [PATCH 2/3] Change lltostr() to take advantage of tstring1 helper
eugene.loh at oracle.com
eugene.loh at oracle.com
Thu Mar 17 20:37:50 UTC 2022
From: Eugene Loh <eugene.loh at oracle.com>
Switch the order of arguments in bpf/lltostr.S to accommodate
this change.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
bpf/lltostr.S | 6 +++---
libdtrace/dt_cg.c | 31 +------------------------------
2 files changed, 4 insertions(+), 33 deletions(-)
diff --git a/bpf/lltostr.S b/bpf/lltostr.S
index 606b277a..7484407b 100644
--- a/bpf/lltostr.S
+++ b/bpf/lltostr.S
@@ -8,7 +8,7 @@
.text
/*
- * int dt_lltostr(char *STR, uint64_t VAL)
+ * int dt_lltostr(uint64_t VAL, char *STR)
* {
* // start writing at the end (IDX==1 is the last char)
* IDX = 1
@@ -74,8 +74,8 @@ dt_lltostr:
#define IDX %r8
#define SGN %r9
- mov STR, %r1
- mov VAL, %r2
+ mov VAL, %r1
+ mov STR, %r2
mov IDX, 1 /* IDX = 1 */
diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index b78c6e02..02d9089c 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -3463,36 +3463,7 @@ dt_cg_subr_index(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
static void
dt_cg_subr_lltostr(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
{
- dt_ident_t *idp = dt_dlib_get_func(yypcb->pcb_hdl, "dt_lltostr");
- dt_node_t *val = dnp->dn_args;
-
- assert(idp != NULL);
-
- TRACE_REGSET(" subr-lltostr:Begin");
- dt_cg_node(val, dlp, drp);
-
- if (dt_regset_xalloc_args(drp) == -1)
- longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
-
- dnp->dn_reg = dt_regset_alloc(drp);
- if (dnp->dn_reg == -1)
- longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
- dt_cg_tstring_alloc(yypcb, dnp);
-
- emit(dlp, BPF_LOAD(BPF_DW, dnp->dn_reg, BPF_REG_FP, DT_STK_DCTX));
- emit(dlp, BPF_LOAD(BPF_DW, dnp->dn_reg, dnp->dn_reg, DCTX_MEM));
- emit(dlp, BPF_ALU64_IMM(BPF_ADD, dnp->dn_reg, dnp->dn_tstring->dn_value));
- emit(dlp, BPF_MOV_REG(BPF_REG_1, dnp->dn_reg));
-
- emit(dlp, BPF_MOV_REG(BPF_REG_2, val->dn_reg));
- dt_regset_free(drp, val->dn_reg);
-
- dt_regset_xalloc(drp, BPF_REG_0);
- emite(dlp, BPF_CALL_FUNC(idp->di_id), idp);
- dt_regset_free_args(drp);
- dt_regset_free(drp, BPF_REG_0);
-
- TRACE_REGSET(" subr-lltostr:End ");
+ dt_cg_subr_tstring1_helper(dnp, dlp, drp, "dt_lltostr", 0);
}
static void
--
2.18.4
More information about the DTrace-devel
mailing list