Purity analysis for Java']JavaScript through abstract interpretation

被引:5
|
作者
Nicolay, Jens [1 ]
Stievenart, Quentin [1 ]
De Meuter, Wolfgang [1 ]
De Roover, Coen [1 ]
机构
[1] Vrije Univ Brussel, Software Languages Lab, Pl Laan 2, B-1050 Brussels, Belgium
关键词
abstract interpretation; freshness analysis; !text type='Java']Java[!/text]Script; purity analysis; side effect analysis;
D O I
10.1002/smr.1889
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
We present a static analysis for determining whether and to what extent functions in JavaScript programs are pure. To this end, the analysis classifies functions as pure functions, observers, or procedures. A function is pure if none of its executions generate or depend upon externally observable side effects. A function is an observer as soon as one of its executions depends on an external side effect, but none of its executions generate observable side effects. Otherwise, the function is classified as a procedure. Function executions and associated callers are found by traversing all reachable function execution contexts on the call stack at the point where an effect occurs. Our approach is based on a flow analysis that, in addition to computing traditional control and value flow, keeps track of read and write effects. To increase the precision of our purity analysis, we combine it with an intraprocedural analysis that determines freshness of variables and objects. We formalize the core aspects of our technique and discuss its implementation and results on common JavaScript benchmarks. Results show that our approach is capable of determining function purity in the presence of higher-order functions, dynamic property expressions, and prototypal inheritance. When compared with existing purity analyses, we find that our approach is as precise or more precise than the existing analyses.
引用
收藏
页数:34
相关论文
共 50 条
  • [1] Flow: Abstract Interpretation of Java']JavaScript for Type Checking and Beyond
    Chaudhuri, Avik
    [J]. PROCEEDINGS OF THE 2016 ACM WORKSHOP ON PROGRAMMING LANGUAGES AND ANALYSIS FOR SECURITY (PLAS'16), 2016, : 1 - 1
  • [2] RATA: Rapid Atomic Type Analysis by Abstract Interpretation - Application to Java']JavaScript Optimization
    Logozzo, Francesco
    Venter, Herman
    [J]. COMPILER CONSTRUCTION, PROCEEDINGS, 2010, 6011 : 66 - 83
  • [3] Detecting Function Purity in Java']JavaScript
    Nicolay, Jens
    Noguera, Carlos
    De Roover, Coen
    De Meuter, Wolfgang
    [J]. 2015 IEEE 15TH INTERNATIONAL WORKING CONFERENCE ON SOURCE CODE ANALYSIS AND MANIPULATION (SCAM), 2015, : 101 - 110
  • [4] Purity Analysis: An Abstract Interpretation Formulation
    Madhavan, Ravichandhran
    Ramalingam, Ganesan
    Vaswani, Kapil
    [J]. STATIC ANALYSIS, 2011, 6887 : 7 - 24
  • [5] Fully Abstract Compilation to Java']JavaScript
    Fournet, Cedric
    Swamy, Nikhil
    Chen, Juan
    Dagand, Pierre-Evariste
    Strub, Pierre-Yves
    Livshits, Benjamin
    [J]. ACM SIGPLAN NOTICES, 2013, 48 (01) : 371 - 383
  • [6] A Parallel Abstract Interpreter for Java']JavaScript
    Dewey, Kyle
    Kashyap, Vineeth
    Hardekopf, Ben
    [J]. 2015 IEEE/ACM INTERNATIONAL SYMPOSIUM ON CODE GENERATION AND OPTIMIZATION (CGO), 2015, : 34 - 45
  • [7] Completeness of Abstract Domains for String Analysis of Java']JavaScript Programs
    Arceri, Vincenzo
    Olliaro, Martina
    Cortesi, Agostino
    Mastroeni, Isabella
    [J]. THEORETICAL ASPECTS OF COMPUTING - ICTAC 2019, 2019, 11884 : 255 - 272
  • [8] Combining String Abstract Domains for Java']JavaScript Analysis: An Evaluation
    Amadini, Roberto
    Jordan, Alexander
    Gange, Graeme
    Gauthier, Francois
    Schachte, Peter
    Sondergaard, Harald
    Stuckey, Peter J.
    Zhang, Chenyi
    [J]. TOOLS AND ALGORITHMS FOR THE CONSTRUCTION AND ANALYSIS OF SYSTEMS, TACAS 2017, PT I, 2017, 10205 : 41 - 57
  • [9] Type Analysis for Java']JavaScript
    Jensen, Simon Holm
    Moller, Anders
    Thiemann, Peter
    [J]. STATIC ANALYSIS, 2009, 5673 : 238 - +
  • [10] A Study on Abstract Syntax Tree for Development of a Java']JavaScript Compiler
    Kim, Jaehyun
    Lee, Yangsun
    [J]. INTERNATIONAL JOURNAL OF GRID AND DISTRIBUTED COMPUTING, 2018, 11 (06): : 37 - 47