public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/18431] New: runtime function overloading facility
@ 2015-05-19 15:46 fche at redhat dot com
  2015-09-23 21:54 ` [Bug translator/18431] " ajakop at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: fche at redhat dot com @ 2015-05-19 15:46 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 18431
           Summary: runtime function overloading facility
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: fche at redhat dot com
  Target Milestone: ---

It turns out to be necessary to have a facility that allows end-user scripts to
call generic functions like jstack(), while multiple alternative
implementations available in the tapset library.  The method of choosing
between the alternatives must be done at run-time (since it's run-time state
such as "which VM is this thread running in?" that decides), so we're talking
about a control-flow extension rather than translate-time processing like c++
overloading.

Possible syntax at call site: foo() - i.e., no visible change.

Possible syntax at definitions:
   function foo () {
      ...
      ... if (condition) next; ...
      ...
   }

Possible semantics: for a call, expand to:

- at translate time, construct sorted list of functions that match call
  - prefer end-user script highest/first, to provide override capability
  - sort others somehow (maybe have explicit ranking like begin(N) probes)

- pseudocode for generated call:
  - evaluate PARAMS into temporary variable, for side-effects
  - foreach FUNCTION in ALTERNATIVES
    - call FUNCTION(PARAM_copies)
    - if it returned normally or with an exception/error, done
    - else it exited with a 'next' (a new flag in the context structure);
      continue looping
  - if all alternatives functions exited with 'next', throw an exception
  - (All this can be optimized to current code etc, if the translator
    detects no 'next' statements in the function body.  Ignore
    transitively called functions.)

- pseudocode for function-side next: easy peasy
  - set function-context nexted-out flag
  - return

In this model, any side-effects caused by the alternative functions, before
they run 'next', will persist.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug translator/18431] runtime function overloading facility
  2015-05-19 15:46 [Bug translator/18431] New: runtime function overloading facility fche at redhat dot com
@ 2015-09-23 21:54 ` ajakop at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: ajakop at redhat dot com @ 2015-09-23 21:54 UTC (permalink / raw)
  To: systemtap

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

Abe Jakop <ajakop at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ajakop at redhat dot com
           Assignee|systemtap at sourceware dot org    |ajakop at redhat dot com

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-23 21:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19 15:46 [Bug translator/18431] New: runtime function overloading facility fche at redhat dot com
2015-09-23 21:54 ` [Bug translator/18431] " ajakop at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).