[Beignet] [PATCH] Modify the GenContext and GenEncoder's destructor to virtual

Zhigang Gong zhigang.gong at linux.intel.com
Fri May 16 05:02:33 PDT 2014


LGTM, pushed.

On Thu, May 15, 2014 at 05:38:53PM +0800, junyan.he at inbox.com wrote:
> From: Junyan He <junyan.he at linux.intel.com>
> 
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
>  backend/src/backend/gen75_context.hpp | 4 ++--
>  backend/src/backend/gen75_encoder.hpp | 4 +++-
>  backend/src/backend/gen_context.hpp   | 2 +-
>  backend/src/backend/gen_encoder.hpp   | 2 ++
>  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/backend/src/backend/gen75_context.hpp b/backend/src/backend/gen75_context.hpp
> index 2bb6e17..329b416 100644
> --- a/backend/src/backend/gen75_context.hpp
> +++ b/backend/src/backend/gen75_context.hpp
> @@ -32,9 +32,9 @@ namespace gbe
>    class Gen75Context : public GenContext
>    {
>    public:
> +    virtual ~Gen75Context(void) { }
>      Gen75Context(const ir::Unit &unit, const std::string &name, uint32_t deviceID, bool relaxMath = false)
> -            : GenContext(unit, name, deviceID, relaxMath) {
> -    };
> +            : GenContext(unit, name, deviceID, relaxMath) { }
>  
>    protected:
>      virtual GenEncoder* generateEncoder(void) {
> diff --git a/backend/src/backend/gen75_encoder.hpp b/backend/src/backend/gen75_encoder.hpp
> index dc2dc76..a9042b3 100644
> --- a/backend/src/backend/gen75_encoder.hpp
> +++ b/backend/src/backend/gen75_encoder.hpp
> @@ -31,8 +31,10 @@ namespace gbe
>    class Gen75Encoder : public GenEncoder
>    {
>    public:
> +    virtual ~Gen75Encoder(void) { }
> +
>      Gen75Encoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID)
> -         : GenEncoder(simdWidth, gen, deviceID, 8) { };
> +         : GenEncoder(simdWidth, gen, deviceID, 8) { }
>  
>      virtual void MOV_DF(GenRegister dest, GenRegister src0, GenRegister tmp = GenRegister::null());
>      virtual void LOAD_DF_IMM(GenRegister dest, GenRegister tmp, double value);
> diff --git a/backend/src/backend/gen_context.hpp b/backend/src/backend/gen_context.hpp
> index 21ee28d..750d72b 100644
> --- a/backend/src/backend/gen_context.hpp
> +++ b/backend/src/backend/gen_context.hpp
> @@ -63,7 +63,7 @@ namespace gbe
>      GenContext(const ir::Unit &unit, const std::string &name, uint32_t deviceID,
>                 bool relaxMath = false);
>      /*! Release everything needed */
> -    ~GenContext(void);
> +    virtual ~GenContext(void);
>      /*! Start new code generation with specific parameters */
>      void startNewCG(uint32_t simdWidth, uint32_t reservedSpillRegs, bool limitRegisterPressure);
>      /*! Target device ID*/
> diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp
> index 5129d99..9eaa1c2 100644
> --- a/backend/src/backend/gen_encoder.hpp
> +++ b/backend/src/backend/gen_encoder.hpp
> @@ -66,6 +66,8 @@ namespace gbe
>    public:
>      /*! simdWidth is the default width for the instructions */
>      GenEncoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID, int jump_width = 1);
> +
> +    virtual ~GenEncoder(void) { }
>      /*! Size of the stack (should be large enough) */
>      enum { MAX_STATE_NUM = 16 };
>      /*! Push the current instruction state */
> -- 
> 1.8.3.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list