Giter Club home page Giter Club logo

jsdelta's Introduction

WALA

WALA logo

GitHub Actions status Join the chat at https://gitter.im/WALAHelp/Lobby


The T. J. Watson Libraries for Analysis (WALA) provide static analysis capabilities for Java bytecode and related languages and for JavaScript. The system is licensed under the Eclipse Public License, which has been approved by the OSI (Open Source Initiative) as a fully certified open source license. The initial WALA infrastructure was independently developed as part of the DOMO research project at the IBM T.J. Watson Research Center. In 2006, IBM donated the software to the community.

For recent updates on WALA, join the mailing list.

Core WALA Features

WALA features include:

  • Java type system and class hierarchy analysis
  • Source language framework supporting Java and JavaScript
  • Interprocedural dataflow analysis (RHS solver)
  • Context-sensitive tabulation-based slicer
  • Pointer analysis and call graph construction
  • SSA-based register-transfer language IR
  • General framework for iterative dataflow
  • General analysis utilities and data structures
  • A bytecode instrumentation library (Shrike)

Getting Started

The fastest way to get started with WALA is to use the packages in Maven Central, as noted here. See the WALA-start repo for a Gradle-based example. We are actively re-organizing the deeper wiki technical documentation. In the meantime, you can check out tutorial slides to get an overview of WALA:

You can also watch screencasts of the WALA JavaScript tutorial here.

Finally, for now, to search the wiki documentation, we recommend a site-specific search on GitHub, e.g., a search for "call graph".

Documentation

We're hosting documentation for WALA on the GitHub wiki. We've chosen a wiki format just so that you can contribute. Don't be shy!

The WALA publications department is populating this wiki with technical documentation on a demand-driven basis, driven by questions posted to the wala-wala mailing list and also Gitter. We recommend this page for searching the mailing list archives.

Currently, we have the JavaDoc documentation for the WALA code being updated continuously. If you think a particular file deserves better javadoc, please open a feature request.

Getting Help

To get help with WALA, please either email the mailing list, ask a question on Gitter, or open an issue.

Required Java Versions

Most components of each official WALA release are built for use with Java 11 or newer. However, components that use Eclipse require at least Java 17.

Building from Source

WALA uses Gradle as its build system. If you intend to modify or build WALA yourself, then see the Gradle-specific README for more instructions and helpful tips.

WALA Tools in JavaScript

Recently, we have been expanding the set of WALA tools implemented in JavaScript. We have released a normalizer and some basic program analyses for JavaScript in the JS_WALA GitHub repository. We have also made available jsdelta and WALA Delta, delta debuggers for JavaScript-processing tools. Please see the linked GitHub repositories for further details on these tools.

WALA-Based Tools

Several groups have built open-source tools that enhance or build on WALA that may be useful to other WALA users. For details, see the Wala-based tools page.

Acknowledgements

YourKit logo

We thank YourKit for providing WALA developers with a complimentary license for their excellent Java profiler, which we use to improve and maintain WALA performance.

jsdelta's People

Contributors

dependabot-preview[bot] avatar esbena avatar michaelficarra avatar msridhar avatar mtorp avatar ribrdb avatar xiemaisi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsdelta's Issues

add a fixed-point mode

It might be useful to have a mode where after finishing a run, the delta search automatically runs again on the minimized input to see if another pass yields further minimization, up until a fixed point.

avoid minimizing function call argument list in quick mode

In quick mode (on the modernise branch), we still seem to try to delete individual arguments to function calls, since we're minimizing all arrays. Ideally, this wouldn't happen. It's not a huge deal, except for cases where each run of the JS-processing program takes a long time, and you really want quick mode to not dig in beyond the statement level.

Non-termination for directory reduction containing dynamically created files

The current implementation of delta_multi.js finds a fix-point for the shasum of the reduced target directory. That process does not terminate if the target program dynamically generates new files in the target directory, since the new files will change the shasum!

Solution: let all reduction steps return true/false based on their success. The fixpoint is reached if they all return false during one fixpoint iteration. (this should also be faster since the shasum computation is avoided)

JSON candidates are reduced to zero bytes, causing crash

To reproduce:

echo '{"foo": 3}' > test.json
jsdelta --cmd false test.json

Result:

Testing candidate /tmp/tmp1/delta_js_0.json (11 bytes)
    aborted with error
Starting iteration #0
Target: /tmp/tmp1/delta_js_1.json (1 bytes)
Testing candidate /tmp/tmp1/delta_js_1.json (1 bytes)
    aborted with error
Starting iteration #1

/usr/lib/node_modules/jsdelta/src/file_util.js:43
        throw e;
        ^
Error: Line 2: Unexpected end of input
    at constructError (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:2406:21)
    at createError (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:2425:17)
    at unexpectedTokenError (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:2499:13)
    at throwUnexpectedToken (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:2504:15)
    at expect (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:2522:13)
    at parseGroupExpression (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:3138:17)
    at inheritCoverGrammar (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:2680:18)
    at parsePrimaryExpression (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:3238:20)
    at inheritCoverGrammar (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:2680:18)
    at parseLeftHandSideExpressionAllowCall (/usr/lib/node_modules/jsdelta/node_modules/esprima/esprima.js:3413:20)

delta_js_1.json consists of a single newline; I assume what's going on here is that the JSON is being reduced down to what would be a syntactically valid JavaScript program (which does nothing at all) and then interpreted as JSON (which doesn't like an empty string).

execSync dependency does not work in node v0.12

$ node --version
v0.12.2
$ node delta.js 
module.js:338
    throw err;
          ^
Error: Cannot find module './build/Release/shell'
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (...jsdelta/node_modules/execSync/index.js:30:11)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

Better docs for multi-file mode?

I've been trying to use jsdelta in a multi-file scenario but not having much success. Here's the command I am using:

node delta.js --cmd predicate.sh --msg some_msg --dir program_dir relative/path/to/main.js

The first thing that tripped me up is that I think the path to the "main" source file must be relative to program_dir, not an absolute path. If this is correct, we should document it.

Then, I ran into an issue with delta_multi.js trying to delete entire directories, as it would also delete parent directories of main.js, leading to a failure to stat the file. This I think we can fix.

My main problem is the following. Really, my analysis is running over all scripts in program_dir; there is no "main" source file to be distinguished from the others. When jsdelta is minimizing other files, I still see printed in the output:

Testing candidate main.js (XXXX bytes)
              aborted with other error
          Original file doesn't satisfy predicate.

Is this expected? Or is the search getting messed up somehow because the "Original file doesn't satisfy predicate"?

I think in the multi-file mode, there should be no need to specify a "main" file, and things should just work. Maybe my mental model for how the tool is working is wrong, though.

@esbena any thoughts / memories around this? πŸ™‚

JSDelta Cookbook

I don’t use JSDelta very often, so when I do have need for it I generally have to puzzle out how to get it do do what I want again. I'm therefore opening this issue to serve as a collection of recipes for using JSDelta in different situations.

robustify command-line option parsing

Right now the file to be minimized needs to be passed as the final argument (I think). We should use a standard library so that the argument order isn't so sensitive.

Incoming feature: multi-file support

JSDelta is currently only able to do reductions for a single source
file at a time. We will soon be developing support for exploring
reductions of multiple files in a single run of JSDelta, and we will
make a pull request when the feature is done.

The feature is JavaScript independent, and any delta-debugger could
make use of it, but I am not aware of any available solutions. Are
you?

If not, then we will implement it from scratch according to the
following plan, input is welcome.

Plan

Conceptually, two new AST-nodes will be added: directories and files.

This means that:

  • directories will be treated as statements currently are
    (i.e. "binary-search" and recursive deletions of files/directories)
  • files will be treated as expressions currently are (i.e. individual
    mutations, but through an application of the current JSDelta)

Practically, each iteration will be a done on a full copy of the
latest successful reduction (we might need to delete the unsuccessful
copies for space reasons). File- and directory-names probably needs to
be kept unchanged.


Implementation-wise, JSDelta will need to remember (these two are
currently the same thing):

  • where the "main-file" is relative to the root directory
  • which file/directory that is being reduced

JSON candidates are wrapped in parentheses

When jsdelta is passed a JSON file, it outputs candidate files (delta_js_1.json and so on) with the JSON wrapped in parentheses, like so:

({"foo": "bar"});

This means that the file is not valid JSON, so trying to delta JSON files doesn't work properly.

I don't know enough about esprima to be able to immediately identify why it's doing this and how to stop it. For my test script I have worked around this by stripping the characters out with the following ugly hack:

if grep '^({' $1 > /dev/null ; then
        cat $1 | head -c-2 | tail -c+2 > $TMPDIR/npm-shrinkwrap.json
else
        cp $1 $TMPDIR/npm-shrinkwrap.json
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.