aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/jit-recording.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-11-19 20:31:52 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-11-19 20:31:52 +0000
commitb957b2e02582cc7ba739cd3886f38800542759bb (patch)
treedade283afe5efeb7c8a4488a4e81976abfce5de8 /gcc/jit/jit-recording.c
parent1f1e44ed24a448d366e7218044313a497a537fbe (diff)
downloadgcc-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-recording.c')
-rw-r--r--gcc/jit/jit-recording.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
index 8cce277..8069afc 100644
--- a/gcc/jit/jit-recording.c
+++ b/gcc/jit/jit-recording.c
@@ -1602,7 +1602,7 @@ void
recording::function_type::replay_into (replayer *r)
{
/* Convert m_param_types to a vec of playback type. */
- vec <playback::type *> param_types;
+ auto_vec <playback::type *> param_types;
int i;
recording::type *type;
param_types.create (m_param_types.length ());
@@ -1859,11 +1859,11 @@ recording::fields::fields (compound_type *struct_or_union,
void
recording::fields::replay_into (replayer *)
{
- vec<playback::field *> playback_fields;
+ auto_vec<playback::field *> playback_fields;
playback_fields.create (m_fields.length ());
for (unsigned i = 0; i < m_fields.length (); i++)
playback_fields.safe_push (m_fields[i]->playback_field ());
- m_struct_or_union->playback_compound_type ()->set_fields (playback_fields);
+ m_struct_or_union->playback_compound_type ()->set_fields (&playback_fields);
}
/* Override the default implementation of
@@ -2032,7 +2032,7 @@ void
recording::function::replay_into (replayer *r)
{
/* Convert m_params to a vec of playback param. */
- vec <playback::param *> params;
+ auto_vec <playback::param *> params;
int i;
recording::param *param;
params.create (m_params.length ());
@@ -2848,14 +2848,14 @@ recording::call::call (recording::context *ctxt,
void
recording::call::replay_into (replayer *r)
{
- vec<playback::rvalue *> playback_args;
+ auto_vec<playback::rvalue *> playback_args;
playback_args.create (m_args.length ());
for (unsigned i = 0; i< m_args.length (); i++)
playback_args.safe_push (m_args[i]->playback_rvalue ());
set_playback_obj (r->new_call (playback_location (r, m_loc),
m_func->playback_function (),
- playback_args));
+ &playback_args));
}
/* Implementation of recording::memento::make_debug_string for
@@ -2925,14 +2925,14 @@ recording::call_through_ptr::call_through_ptr (recording::context *ctxt,
void
recording::call_through_ptr::replay_into (replayer *r)
{
- vec<playback::rvalue *> playback_args;
+ auto_vec<playback::rvalue *> playback_args;
playback_args.create (m_args.length ());
for (unsigned i = 0; i< m_args.length (); i++)
playback_args.safe_push (m_args[i]->playback_rvalue ());
set_playback_obj (r->new_call_through_ptr (playback_location (r, m_loc),
m_fn_ptr->playback_rvalue (),
- playback_args));
+ &playback_args));
}
/* Implementation of recording::memento::make_debug_string for