Bug 12151 - support /* stable */ embedded-c pragma
Summary: support /* stable */ embedded-c pragma
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-22 00:51 UTC by Frank Ch. Eigler
Modified: 2015-08-14 18:19 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2010-10-22 00:51:27 UTC
The intent of this markup would be to allow the optimizer to
call the given embedded-c function more than once per probe
handler.  i.e:

probe foo { 
  println(pid())
  bar[pid()]=5
  println(zoo[pid(),execname()])
}

With current code, pid() would need to be called three times.
With the /* stable */ marker, it would be called once, and the
result memoized.

This would probably apply only to arity-0 functions, or perhaps
only to those with literal/stable parameters.
Comment 1 Felix Lu 2015-08-14 18:19:00 UTC
Optimizer now supports /* stable */ pragma for arity-0 functions.

/* stable */ functioncalls get pulled out of the top level loop
then left inside the enclosing if-else statement(if any).