diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-05-21 13:37:07 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-05-21 13:37:07 -0400 |
commit | e3339150b3c04f50b0abdc4a6d132a6b75b22cb6 (patch) | |
tree | c80892afd79625f95ff0a2543728804464c2961a /staptree.cxx | |
parent | 332ddc9f7354fe51c32c504087575b3ea2b70990 (diff) | |
parent | aa8a3b1797da54a14d04cd57758a65064056376e (diff) | |
download | systemtap-steved-e3339150b3c04f50b0abdc4a6d132a6b75b22cb6.tar.gz systemtap-steved-e3339150b3c04f50b0abdc4a6d132a6b75b22cb6.tar.xz systemtap-steved-e3339150b3c04f50b0abdc4a6d132a6b75b22cb6.zip |
Merge commit 'origin/master' into pr6429-comp-unwindsyms
* commit 'origin/master':
Fix assignment optimization expected results.
PR6538: more testsuite tweaks for read-only warnings
PR6538: more tapset fixes
PR6538: explain why absentstats.stp logs will contain warnings
PR6538: fix treatment of initialized globals
Use pointer_arg to fetch arguments for syscall.utime and compat_utime.
Optimize compound and binary expression assignments.
Check new (sub) functions of _struct_utimbuf_* and _struct_compat_utimbuf_*.
PR6538: tapset changes
PR6538: testsuite changes
PR5001: fix test suite collateral damage
PR6538: warn about read-only variables
Add some scripts and descriptions to the systemtap.examples.
PR5001: Remove _stp_ctime and always use ctime.
Use tr1/unordered_map instead of the deprecated ext/hash_map.
PR6524: ctime() on bad values hangs system.
Optimize away assignments in other contexts.
Optimize away assignments in other contexts.
dummy commit for testing systemtap-cvs notification
Remove sa_restorer initialization.
Diffstat (limited to 'staptree.cxx')
-rw-r--r-- | staptree.cxx | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/staptree.cxx b/staptree.cxx index 02a6c8dc..347d799f 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -1713,6 +1713,15 @@ varuse_collecting_visitor::visit_symbol (symbol *e) if (e->referent == 0) throw semantic_error ("symbol without referent", e->tok); + // We could handle initialized globals by marking them as "written". + // However, this current visitor may be called for a function or + // probe body, from the point of view of which this global is + // already initialized, so not written. + /* + if (e->referent->init) + written.insert (e->referent); + */ + if (current_lvalue == e || current_lrvalue == e) { written.insert (e->referent); @@ -1789,10 +1798,19 @@ varuse_collecting_visitor::visit_post_crement (post_crement *e) void varuse_collecting_visitor::visit_foreach_loop (foreach_loop* s) { - functioncall_traversing_visitor::visit_foreach_loop (s); + // NB: we duplicate so don't bother call + // functioncall_traversing_visitor::visit_foreach_loop (s); + + symbol *array = NULL; + hist_op *hist = NULL; + classify_indexable (s->base, array, hist); + if (array) + array->visit(this); + else + hist->visit(this); + // If the collection is sorted, imply a "write" access to the - // array in addition to the "read" one already noted in the - // base class call above. + // array in addition to the "read" one already noted above. if (s->sort_direction) { symbol *array = NULL; @@ -1801,6 +1819,20 @@ varuse_collecting_visitor::visit_foreach_loop (foreach_loop* s) if (array) this->written.insert (array->referent); // XXX: Can hist_op iterations be sorted? } + + // NB: don't forget to visit the index expressions, which are lvalues. + for (unsigned i=0; i<s->indexes.size(); i++) + { + expression* last_lvalue = current_lvalue; + current_lvalue = s->indexes[i]; // leave a mark for ::visit_symbol + s->indexes[i]->visit (this); + current_lvalue = last_lvalue; + } + + if (s->limit) + s->limit->visit (this); + + s->block->visit (this); } |