[DTrace-devel] [PATCH 20/61] Have dt_cg_typecast() copy results from src to dst in default case

Kris Van Hees kris.van.hees at oracle.com
Tue Aug 2 03:04:16 UTC 2022


Let's integrate this into the subsequent dt_cg_typecast() patch rather than
having it stand on its own.

On Fri, Jul 08, 2022 at 10:45:04AM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> The dt_cg_typecast() function is written as if results are being
> transfered from src to dst.  However, if src and dst types are
> compatible and no bit-filling is needed, no such src-to-dst transfer
> is performed.  In practice, this is not a problem since callers tend
> to set src and dst registers equal to one another, meaning the typecast
> operation is done in-place.
> 
> Either:
> 
> *)  add an explicit src-to-dst transfer for the "default case" (when
> src and dst types are compatible and need no bit filling), or
> 
> *)  rewrite dt_cg_typecast() to be in-register (typically eliminating
> one instruction)
> 
> Here, the first solution is used.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
>  libdtrace/dt_cg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index 633e4613..f1893198 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -2576,7 +2576,8 @@ dt_cg_typecast(const dt_node_t *src, const dt_node_t *dst,
>  		emit(dlp,  BPF_LOAD(BPF_DW, dst->dn_reg, mst, DMST_SCALARIZER));
>  
>  		dt_regset_free(drp, mst);
> -	}
> +	} else
> +		emit(dlp, BPF_MOV_REG(dst->dn_reg, src->dn_reg));
>  }
>  
>  /*
> -- 
> 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