This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/20341] New: optimizer does not remove variables that are read in probe aliases but not end-user probes


https://sourceware.org/bugzilla/show_bug.cgi?id=20341

            Bug ID: 20341
           Summary: optimizer does not remove variables that are read in
                    probe aliases but not end-user probes
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: flu at redhat dot com
  Target Milestone: ---

Sometimes a string or integer must be constructed through accumulation in a
tapset:

result = ""
result2 = 0
while (condition) {
  result .= "str"
  result += 1
}

If this accumulation were to be done in a probe alias, the compiler marks these
variables as being read even though consumer of the probe alias may not have
used these variables.

probe alias = begin {
  read = "TEST"
  unused = "1"
  unused = unused . "2"
}

$ stap -p2 -e 'probe alias {print(read)}'
begin /* <- alias = begin <- alias */
# locals
read:string
unused:string
{
  (read) = ("TEST");
  (unused) = ("1");
  (unused) = ((unused) . ("2"));
  print(read);
}

Here, only the variable "read" is read by the consumer probe but the variable
"unused" does not get elided by the optimizer. The accumulation may be
expensive and the user should not be penalized by the unused variable.

The current workaround is to wrap the accumulation in a function to prevent the
compiler from marking the variable as being read but this may be cumbersome for
a tapset library author.

Currently, there are not that many patterns like this in the library.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]