<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Context-sensitive analysis of data interference for concurrent programs</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Carlos Galindo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marisa Llorens</string-name>
          <email>mllorens@dsic.upv.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sergio Pérez</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Josep Silva</string-name>
          <email>jsilva@dsic.upv.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>VRAIN, Universitat Politècnica de València</institution>
          ,
          <addr-line>Camí de Vera s/n, E-46022 València</addr-line>
          ,
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Context-sensitive analyses enable the precise analysis of programs with procedures, such that only the relevant procedures will be selected, because the calling context is being taken into account. In threaded programs, interference dependence models the efects of concurrent assignments and access to shared variables, but current definitions of this dependence prevent context-sensitivity. Our work redefines interference dependence in order to make it compatible with known context-sensitive analyses, enabling more precise analyses.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Interference dependence</kwd>
        <kwd>dependence graphs</kwd>
        <kwd>context-sensitivity</kwd>
        <kwd>concurrent program analysis</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction and background</title>
      <p>In the software engineering field of static analysis, context-sensitivity is a property that
determines whether an analysis is able to distinguish the diferent calls made to a function, and only
analyse the relevant ones. A context-sensitive analysis can produce faster and/or better results,
by being able to ignore calls that are irrelevant to the question asked.</p>
      <p>
        A common representation used to tackle software analyses are dependence graphs, which
represent instructions in a program as nodes and the relationships or dependences between
them as directed arcs. For example, interference dependence (denoted with ‧‧➡) is a relationship
that connects a variable definition and a variable usage in diferent parallel threads. It is useful
in the analysis of shared-memory concurrent programs. It was originally defined for program
slicing by Krinke [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], based on the concept of a witness (a possible execution of a program). This
kind of dependence is not always transitive ( ‧‧➡  ∧  ‧‧➡  does not necessarily mean that
 ‧‧➡ ), a valid witness must back up every sequence of two or more interference dependences
(( ‧‧➡  ∧  ‧‧➡ ) → ( ‧‧➡ ) if and only if there is a witness that includes an execution
path , ..., ).
      </p>
      <p>Context-sensitive analyses can be performed in multiple ways. A simple but expensive
method is to label each call and store the sequence of call labels that have already been analysed,</p>
      <sec id="sec-1-1">
        <title>Thread A</title>
      </sec>
      <sec id="sec-1-2">
        <title>Thread B</title>
      </sec>
      <sec id="sec-1-3">
        <title>Thread A</title>
      </sec>
      <sec id="sec-1-4">
        <title>Thread B</title>
        <p>Enter f()</p>
        <p>Enter g()</p>
        <p>Enter f()</p>
        <p>Enter g()
DEF</p>
        <p>USE</p>
        <p>DEF</p>
        <p>
          USE
but this leads to an explosion of states which makes the analysis too expensive. An alternative
is the use of summary edges, first proposed by Horwitz et al. [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]. They model the dependences
inside each function’s body at its calls, allowing the analysis to know the efect of the function
without the need to analyse the function’s body. The use of summaries restricts the dependences
that need to be considered, preventing the analysis of unrelated functions (as the calls themselves
are analysed through summaries).
        </p>
        <p>In interference dependence, when a source of dependence is reached, all its dependences
are transitively required (except for other interference dependences, which are analysed on a
case-by-case basis), removing any restriction imposed by other aspects of the analysis, including
context-sensitivity. Both requirements are conflictive, and thus the analysis can either consider
interference or be context-sensitive.</p>
        <p>
          Some authors, like Krinke [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ], used the expensive call-labelling strategy, but was forced to
make it less precise (limiting the length of the sequence of labels to 3-5 elements) in order to
keep the time bound under control, and others, like Nanda and Ramesh [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ], tried to merge
summaries and interference dependence, but failed to account for interprocedural interference
dependences that broke the calling context.
        </p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Context-sensitive interference dependence</title>
      <p>Our approach is a redefinition of interference dependence, such that every instance of it appears
between threads of the same procedure (removing all interprocedural jumps that break the
calling context). However, interprocedural interference dependences must also be represented,
and we designed a structure of dependences similar to the one generated by summaries. This
allows us to use a system similar to Horwitz et al.’s, and produce context-sensitive interference
dependences.</p>
      <p>As an example, let’s observe the structures in the left side of Figure 1, in which a main
procedure spawns two threads (A and B). Thread A calls procedure f, while thread B calls
procedure g. Concurrently, a variable is defined in f (thread A) and used in g (thread B). Thus,
an interference dependence connects the definition to the usage (marked as DEF and USE in
the graphs, respectively).</p>
      <p>Nanda and Ramesh’s approach place the interference dependence directly between the
definition and the usage, making it an interprocedural dependence (shown as a dotted arc, it
crosses the boundaries of a procedure, from f to g). As a consequence, since all the dependences
of the definition are transitively required by the analysis, it is impossible to determine which
calls to f are relevant and which are not, resulting in the analysis not being context-sensitive.</p>
      <p>On the right side of Figure 1 we see our approach, which creates auxiliary nodes (pink and
dashed) and arcs (vertical and dashed) to move the interference dependence from the real
definition and usage to each of the calls to the procedures that perform these actions. The
horizontal dotted arc represents the interference dependence, which is now intraprocedural.
As a side-efect of this transformation, there is no doubt about which of the two calls to f in
thread A produces the interference dependence, and we can take advantage of Horwitz et al.’s
context-sensitivity framework.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Conclusions</title>
      <p>In summary, our approach redefines interference dependence to be exclusively intraprocedural.
It also generates new nodes that can trace the sequence of calls that link a concurrent
definitionusage of a variable. With these two elements, our approach results in a context-sensitive analysis
of concurrent programs, applying the framework of summaries laid out by Horwitz et al.</p>
    </sec>
    <sec id="sec-4">
      <title>Acknowledgments</title>
      <p>This work has been partially supported by the EU (FEDER) and the Spanish MCI/AEI under grant
PID2019-104735RB-C41, and by the European Union’s Horizon 2020 research and innovation
programme under grant agreement No 952215 (Tailor).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>J.</given-names>
            <surname>Krinke</surname>
          </string-name>
          ,
          <article-title>Static slicing of threaded programs</article-title>
          ,
          <source>SIGPLAN Not</source>
          .
          <volume>33</volume>
          (
          <year>1998</year>
          )
          <fpage>35</fpage>
          -
          <lpage>42</lpage>
          . URL: http://doi.acm.
          <source>org/10</source>
          .1145/277633.277638. doi:
          <volume>10</volume>
          .1145/277633.277638.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>S.</given-names>
            <surname>Horwitz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Reps</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Binkley</surname>
          </string-name>
          ,
          <article-title>Interprocedural slicing using dependence graphs</article-title>
          ,
          <source>in: Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation</source>
          , PLDI '88,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          , New York, NY, USA,
          <year>1988</year>
          , pp.
          <fpage>35</fpage>
          -
          <lpage>46</lpage>
          . URL: http: //doi.acm.
          <source>org/10</source>
          .1145/53990.53994. doi:
          <volume>10</volume>
          .1145/53990.53994.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>Krinke</surname>
          </string-name>
          ,
          <article-title>Context-sensitive slicing of concurrent programs</article-title>
          ,
          <source>SIGSOFT Softw. Eng. Notes</source>
          <volume>28</volume>
          (
          <year>2003</year>
          )
          <fpage>178</fpage>
          -
          <lpage>187</lpage>
          . URL: https://doi.org/10.1145/949952.940096. doi:
          <volume>10</volume>
          .1145/949952. 940096.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Nanda</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ramesh</surname>
          </string-name>
          ,
          <article-title>Interprocedural slicing of multithreaded programs with applications to java</article-title>
          ,
          <source>ACM Trans. Program. Lang. Syst</source>
          .
          <volume>28</volume>
          (
          <year>2006</year>
          )
          <fpage>1088</fpage>
          -
          <lpage>1144</lpage>
          . URL: https://doi.org/10.1145/ 1186632.1186636. doi:
          <volume>10</volume>
          .1145/1186632.1186636.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>