This is the mail archive of the 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/18431] New: runtime function overloading facility

            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++

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
    - 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.

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