[DTrace-devel] [PATCH v2 2/3] Change lltostr() to take advantage of tstring1 helper

Kris Van Hees kris.van.hees at oracle.com
Wed Apr 20 03:34:26 UTC 2022


Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

... assuming the name changed indicated below is carried out in the
first patch of the patch series.

Fri, Mar 18, 2022 at 03:36:43PM -0400, eugene.loh--- via DTrace-devel wrote:
> 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..b21001ab 100644
> --- a/bpf/lltostr.S
> +++ b/bpf/lltostr.S
> @@ -8,7 +8,7 @@
>  
>  	.text
>  /*
> - * int dt_lltostr(char *STR, uint64_t VAL)
> + * void 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 b8325e44..9bda35f3 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -3465,36 +3465,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");

s/dt_cg_subr_tstring1_helper/dt_cg_subr_arg_to_tstring/

>  }
>  
>  static void
> -- 
> 2.18.4
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list