From 46392da3e1bfad96fd428122fa1f0ed5182dbb9a Mon Sep 17 00:00:00 2001 From: dsmith Date: Fri, 12 Jan 2007 16:33:16 +0000 Subject: 2007-01-12 David Smith * tapsets.cxx (dwarf_var_expanding_copy_visitor::visit_target_symbol): Since array behavior has changed (setting to 0 no longer deletes the array element), we delete the internal counter array element when providing target variable access in return probes. --- tapsets.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index d08e8633..5869a318 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3012,6 +3012,8 @@ dwarf_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e) // _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]] // delete _dwarf_tvar_{name}_{num}[_dwarf_tvar_tid, // _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]--] + // if (! _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]) + // delete _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid] // (2a) Synthesize the tid temporary expression, which will look // like this: @@ -3117,6 +3119,28 @@ dwarf_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e) add_block->statements.push_back (ds); + // (2d) Delete the counter value if it is 0. It will look like + // this: + // if (! _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]) + // delete _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid] + + ds = new delete_statement; + ds->tok = e->tok; + ds->value = ai_ctr; + + unary_expression *ue = new unary_expression; + ue->tok = e->tok; + ue->op = "!"; + ue->operand = ai_ctr; + + if_statement *ifs = new if_statement; + ifs->tok = e->tok; + ifs->condition = ue; + ifs->thenblock = ds; + ifs->elseblock = NULL; + + add_block->statements.push_back (ifs); + // (3) We need an entry probe that saves the value for us in the // global array we created. Create the entry probe, which will // look like this: -- cgit