[DTrace-devel] [PATCH] Split out dt_cg* function prototypes into a dt_cg.h file

Eugene Loh eugene.loh at oracle.com
Tue Sep 8 08:58:51 PDT 2020


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

On 09/02/2020 01:56 PM, Kris Van Hees wrote:
> The prototypes for various code generator functions (dt_cg*()) were
> found in dt_impl.h even though only a small part of the libdtrace code
> actually needs them.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   libdtrace/dt_as.h           |  1 +
>   libdtrace/dt_cc.c           |  1 +
>   libdtrace/dt_cg.c           |  1 +
>   libdtrace/dt_cg.h           | 32 ++++++++++++++++++++++++++++++++
>   libdtrace/dt_impl.h         |  8 --------
>   libdtrace/dt_prov_dtrace.c  |  1 +
>   libdtrace/dt_prov_fbt.c     |  2 +-
>   libdtrace/dt_prov_profile.c |  1 +
>   libdtrace/dt_prov_sdt.c     |  2 +-
>   libdtrace/dt_prov_syscall.c |  2 +-
>   10 files changed, 40 insertions(+), 11 deletions(-)
>   create mode 100644 libdtrace/dt_cg.h
>
> diff --git a/libdtrace/dt_as.h b/libdtrace/dt_as.h
> index bfbcdaec..59e65c4c 100644
> --- a/libdtrace/dt_as.h
> +++ b/libdtrace/dt_as.h
> @@ -9,6 +9,7 @@
>   #define	_DT_AS_H
>   
>   #include <sys/types.h>
> +#include <sys/dtrace_types.h>
>   #include <linux/bpf.h>
>   
>   #ifdef	__cplusplus
> diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
> index f1ac0776..d0c47bc0 100644
> --- a/libdtrace/dt_cc.c
> +++ b/libdtrace/dt_cc.c
> @@ -88,6 +88,7 @@
>   #include <dt_ident.h>
>   #include <dt_string.h>
>   #include <dt_impl.h>
> +#include <dt_cg.h>
>   #include <dt_bpf.h>
>   #include <bpf_asm.h>
>   
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index 46da8f33..e888eae5 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -13,6 +13,7 @@
>   #include <errno.h>
>   
>   #include <dt_impl.h>
> +#include <dt_cg.h>
>   #include <dt_grammar.h>
>   #include <dt_parser.h>
>   #include <dt_printf.h>
> diff --git a/libdtrace/dt_cg.h b/libdtrace/dt_cg.h
> new file mode 100644
> index 00000000..a4c6fb28
> --- /dev/null
> +++ b/libdtrace/dt_cg.h
> @@ -0,0 +1,32 @@
> +/*
> + * Oracle Linux DTrace.
> + * Copyright (c) 2020, 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.
> + */
> +
> +#ifndef	_DT_CG_H
> +#define	_DT_CG_H
> +
> +#include <dt_as.h>
> +#include <dt_pcb.h>
> +#include <dt_state.h>
> +
> +#ifdef	__cplusplus
> +extern "C" {
> +#endif
> +
> +extern void dt_cg(dt_pcb_t *, dt_node_t *);
> +extern void dt_cg_xsetx(dt_irlist_t *, dt_ident_t *, uint_t, int, uint64_t);
> +extern dt_irnode_t *dt_cg_node_alloc(uint_t, struct bpf_insn);
> +extern void dt_cg_tramp_prologue_act(dt_pcb_t *pcb, uint_t lbl_exit,
> +				     dt_activity_t act);
> +extern void dt_cg_tramp_prologue(dt_pcb_t *pcb, uint_t lbl_exit);
> +extern void dt_cg_tramp_epilogue(dt_pcb_t *pcb, uint_t lbl_exit);
> +extern void dt_cg_tramp_epilogue_advance(dt_pcb_t *pcb, uint_t lbl_exit);
> +
> +#ifdef	__cplusplus
> +}
> +#endif
> +
> +#endif	/* _DT_CG_H */
> diff --git a/libdtrace/dt_impl.h b/libdtrace/dt_impl.h
> index b7d53dd9..510517ce 100644
> --- a/libdtrace/dt_impl.h
> +++ b/libdtrace/dt_impl.h
> @@ -775,14 +775,6 @@ extern dtrace_difo_t *dt_program_construct(dtrace_hdl_t *dtp,
>   
>   extern void dt_pragma(dt_node_t *);
>   extern int dt_reduce(dtrace_hdl_t *, dt_version_t);
> -extern void dt_cg(dt_pcb_t *, dt_node_t *);
> -extern void dt_cg_xsetx(dt_irlist_t *, dt_ident_t *, uint_t, int, uint64_t);
> -extern dt_irnode_t *dt_cg_node_alloc(uint_t, struct bpf_insn);
> -extern void dt_cg_tramp_prologue_act(dt_pcb_t *pcb, uint_t lbl_exit,
> -				     dt_activity_t act);
> -extern void dt_cg_tramp_prologue(dt_pcb_t *pcb, uint_t lbl_exit);
> -extern void dt_cg_tramp_epilogue(dt_pcb_t *pcb, uint_t lbl_exit);
> -extern void dt_cg_tramp_epilogue_advance(dt_pcb_t *pcb, uint_t lbl_exit);
>   extern dtrace_difo_t *dt_as(dt_pcb_t *);
>   extern void dt_dis_program(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, FILE *fp);
>   extern void dt_dis_difo(const dtrace_difo_t *dp, FILE *fp);
> diff --git a/libdtrace/dt_prov_dtrace.c b/libdtrace/dt_prov_dtrace.c
> index af3c4242..388d0386 100644
> --- a/libdtrace/dt_prov_dtrace.c
> +++ b/libdtrace/dt_prov_dtrace.c
> @@ -12,6 +12,7 @@
>   
>   #include <bpf_asm.h>
>   
> +#include "dt_cg.h"
>   #include "dt_provider.h"
>   #include "dt_probe.h"
>   
> diff --git a/libdtrace/dt_prov_fbt.c b/libdtrace/dt_prov_fbt.c
> index c9845fe6..7511dbd2 100644
> --- a/libdtrace/dt_prov_fbt.c
> +++ b/libdtrace/dt_prov_fbt.c
> @@ -31,7 +31,7 @@
>   
>   #include <bpf_asm.h>
>   
> -#include "dt_impl.h"
> +#include "dt_cg.h"
>   #include "dt_bpf_builtins.h"
>   #include "dt_provider.h"
>   #include "dt_probe.h"
> diff --git a/libdtrace/dt_prov_profile.c b/libdtrace/dt_prov_profile.c
> index 6e066694..5496ffe1 100644
> --- a/libdtrace/dt_prov_profile.c
> +++ b/libdtrace/dt_prov_profile.c
> @@ -11,6 +11,7 @@
>   
>   #include <bpf_asm.h>
>   
> +#include "dt_cg.h"
>   #include "dt_bpf.h"
>   #include "dt_probe.h"
>   
> diff --git a/libdtrace/dt_prov_sdt.c b/libdtrace/dt_prov_sdt.c
> index 3c2edcc1..85587c8a 100644
> --- a/libdtrace/dt_prov_sdt.c
> +++ b/libdtrace/dt_prov_sdt.c
> @@ -27,7 +27,7 @@
>   
>   #include <bpf_asm.h>
>   
> -#include "dt_impl.h"
> +#include "dt_cg.h"
>   #include "dt_bpf.h"
>   #include "dt_bpf_builtins.h"
>   #include "dt_provider.h"
> diff --git a/libdtrace/dt_prov_syscall.c b/libdtrace/dt_prov_syscall.c
> index 754422f0..5d3ab75d 100644
> --- a/libdtrace/dt_prov_syscall.c
> +++ b/libdtrace/dt_prov_syscall.c
> @@ -29,7 +29,7 @@
>   
>   #include <bpf_asm.h>
>   
> -#include "dt_impl.h"
> +#include "dt_cg.h"
>   #include "dt_bpf_builtins.h"
>   #include "dt_provider.h"
>   #include "dt_probe.h"




More information about the DTrace-devel mailing list