This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Global constants
hunt wrote:
> [...]
> Hien and I are currently rewriting the syscall tapset, so if constants
> get implemented soon, we can make immediate use of them.
You could put the current idiom ("global x probe begin { x = 1 }") in
there today. An emacs macro could transform it to a later form.
> [...] Declaring variables readonly reduces the probe complexity by
> removing the global locks around all variable access. So it clearly
> seems like a win.
That's a good point. It turns out that read-only-ness can be inferred
by the translator, so a specific decoration would be only a diagnostic
aid rather than a performance helper. (The translator would ask
whether this variable only assigned to in a "begin" probe? While at
it, locks within begin/end probes would be elided since those are run
in isolation.)
> Also it would be nice to have a way to declare these constants in
> embedded C [...]
> something like
> %{ const_O_CREAT = O_CREAT; %}
> instead of
> O_CREAT = 64
One problem with this is that globals, if elided by the optimizer,
would still have such references within the opaque embedded-C blocks.
(That's one of the reasons that embedded-C code should not refer to
systemtap data other than its arguments.)
- FChE