diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-11-19 20:31:52 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2014-11-19 20:31:52 +0000 |
commit | b957b2e02582cc7ba739cd3886f38800542759bb (patch) | |
tree | dade283afe5efeb7c8a4488a4e81976abfce5de8 /gcc/jit/jit-playback.h | |
parent | 1f1e44ed24a448d366e7218044313a497a537fbe (diff) | |
download | gcc-b957b2e02582cc7ba739cd3886f38800542759bb.zip gcc-b957b2e02582cc7ba739cd3886f38800542759bb.tar.gz gcc-b957b2e02582cc7ba739cd3886f38800542759bb.tar.bz2 |
PR jit/63854: Fix leaking vec in jit
gcc/jit/ChangeLog:
PR jit/63854
* jit-playback.c (gcc::jit::playback::compound_type::set_fields):
Convert param from const vec<playback::field *> & to
const auto_vec<playback::field *> *.
(gcc::jit::playback::context::new_function_type): Convert param
"param_types" from vec<type *> * to const auto_vec<type *> *.
(gcc::jit::playback::context::new_function): Convert param
"params" from vec<param *> * to const auto_vec<param *> *.
(gcc::jit::playback::context::build_call): Convert param "args"
from vec<rvalue *> to const auto_vec<rvalue *> *.
(gcc::jit::playback::context::new_call): Likewise.
(gcc::jit::playback::context::new_call_through_ptr): Likewise.
(wrapper_finalizer): New function.
(gcc::jit::playback::wrapper::operator new): Call the finalizer
variant of ggc_internal_cleared_alloc, supplying
wrapper_finalizer.
(gcc::jit::playback::function::finalizer): New.
(gcc::jit::playback::block::finalizer): New.
(gcc::jit::playback::source_file::finalizer): New.
(gcc::jit::playback::source_line::finalizer): New.
* jit-playback.h
(gcc::jit::playback::context::new_function_type): Convert param
"param_types" from vec<type *> * to const auto_vec<type *> *.
(gcc::jit::playback::context::new_function): Convert param
"params" from vec<param *> * to const auto_vec<param *> *.
(gcc::jit::playback::context::new_call): Convert param
"args" from vec<rvalue *> to const auto_vec<rvalue *> *.
(gcc::jit::playback::context::new_call_through_ptr): Likewise.
(gcc::jit::playback::context::build_call): Likewise.
(gcc::jit::playback::context): Convert fields "m_functions",
"m_source_files", "m_cached_locations" from vec to auto_vec.
(gcc::jit::playback::wrapper::finalizer): New virtual function.
(gcc::jit::playback::compound_type::set_fields): Convert param fro
const vec<playback::field *> & to
const auto_vec<playback::field *> *.
(gcc::jit::playback::function::finalizer): New.
(gcc::jit::playback::block::finalizer): New.
(gcc::jit::playback::source_file::finalizer): New.
(gcc::jit::playback::source_line::finalizer): New.
* jit-recording.c
(gcc::jit::recording::function_type::replay_into): Convert local
from a vec into an auto_vec.
(gcc::jit::recording::fields::replay_into): Likewise.
(gcc::jit::recording::function::replay_into): Likewise.
(gcc::jit::recording::call::replay_into): Likewise.
(gcc::jit::recording::call_through_ptr::replay_into): Likewise.
* jit-recording.h (gcc::jit::recording::context): Convert fields
"m_mementos", "m_compound_types", "m_functions" from vec<> to
auto_vec <>.
(gcc::jit::recording::function_type::get_param_types): Convert
return type from vec<type *> to const vec<type *> &.
(gcc::jit::recording::function_type): Convert field
"m_param_types" from a vec<> to an auto_vec<>.
(gcc::jit::recording::fields): Likewise for field "m_fields".
(gcc::jit::recording::function::get_params): Convert return type
from vec <param *> to const vec<param *> &.
(gcc::jit::recording::function): Convert fields "m_params",
"m_locals", "m_blocks" from vec<> to auto_vec<>.
(gcc::jit::recording::block): Likewise for field "m_statements".
vec<> to auto_vec<>.
(gcc::jit::recording::call): Likewise for field "m_args".
(gcc::jit::recording::call_through_ptr): Likewise.
From-SVN: r217808
Diffstat (limited to 'gcc/jit/jit-playback.h')
-rw-r--r-- | gcc/jit/jit-playback.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/gcc/jit/jit-playback.h b/gcc/jit/jit-playback.h index dcb19bf..30e9229 100644 --- a/gcc/jit/jit-playback.h +++ b/gcc/jit/jit-playback.h @@ -71,7 +71,7 @@ public: type * new_function_type (type *return_type, - vec<type *> *param_types, + const auto_vec<type *> *param_types, int is_variadic); param * @@ -84,7 +84,7 @@ public: enum gcc_jit_function_kind kind, type *return_type, const char *name, - vec<param *> *params, + const auto_vec<param *> *params, int is_variadic, enum built_in_function builtin_id); @@ -128,12 +128,12 @@ public: rvalue * new_call (location *loc, function *func, - vec<rvalue *> args); + const auto_vec<rvalue *> *args); rvalue * new_call_through_ptr (location *loc, rvalue *fn_ptr, - vec<rvalue *> args); + const auto_vec<rvalue *> *args); rvalue * new_cast (location *loc, @@ -214,7 +214,7 @@ private: rvalue * build_call (location *loc, tree fn_ptr, - vec<rvalue *> args); + const auto_vec<rvalue *> *args); tree build_cast (location *loc, @@ -240,14 +240,14 @@ private: char *m_path_s_file; char *m_path_so_file; - vec<function *> m_functions; + auto_vec<function *> m_functions; tree m_char_array_type_node; tree m_const_char_ptr; /* Source location handling. */ - vec<source_file *> m_source_files; + auto_vec<source_file *> m_source_files; - vec<std::pair<tree, location *> > m_cached_locations; + auto_vec<std::pair<tree, location *> > m_cached_locations; }; /* A temporary wrapper object. @@ -263,6 +263,10 @@ public: /* Allocate in the GC heap. */ void *operator new (size_t sz); + /* Some wrapper subclasses contain vec<> and so need to + release them when they are GC-ed. */ + virtual void finalizer () { } + }; class type : public wrapper @@ -297,7 +301,7 @@ public: : type (inner) {} - void set_fields (const vec<field *> &fields); + void set_fields (const auto_vec<field *> *fields); }; class field : public wrapper @@ -319,6 +323,7 @@ public: function(context *ctxt, tree fndecl, enum gcc_jit_function_kind kind); void gt_ggc_mx (); + void finalizer (); tree get_return_type_as_tree () const; @@ -366,6 +371,8 @@ public: block (function *func, const char *name); + void finalizer (); + tree as_label_decl () const { return m_label_decl; } void @@ -500,6 +507,7 @@ class source_file : public wrapper { public: source_file (tree filename); + void finalizer (); source_line * get_source_line (int line_num); @@ -520,6 +528,7 @@ class source_line : public wrapper { public: source_line (source_file *file, int line_num); + void finalizer (); location * get_location (recording::location *rloc, int column_num); |