Code Monkey home page Code Monkey logo

jreduce-extra's Introduction

JReduce Plugin

How to Run This Plugin

  • prerequisite: java 8, maven
  • compile: mvn package
  • run mvn exec:java -Dexec.mainClass="Main" -Dexec.args="..."
    • commands for sample
# if target is present
rm -rf $PATH_HERE/sample/target
mvn exec:java -Dexec.mainClass="Main" \
  -Dexec.args="-w '$PATH_HERE/sample/target' -l '$PATH_HERE/sample/lib/' -c '$PATH_HERE/sample/classes' -p '$PATH_HERE/sample/predicate.sh' -t '$PATH_HERE/sample/target' -o '$PATH_HERE/sample/omit.txt'"
# multiple input
mvn exec:java -Dexec.mainClass="Main" \
  -Dexec.args="-w '$PATH_HERE/sample/' -l '$PATH_HERE/sample/lib/' -c '$PATH_HERE/sample/classes;$PATH_HERE/sample/classes2.jar' -p '$PATH_HERE/sample/predicate.sh' -t '$PATH_HERE/sample/target;$PATH_HERE/sample/target2' -o '$PATH_HERE/sample/omit.txt'"
    • the number of input paths must match the number of output paths

Configs

  • check main/java/helper/GlobalConfig.java for log options
  • check main/jvm/ClassAnalyzeOptions.java for reduction options, pass this to ClassPool::readClasses for reduction preparation
    • addHierarchy add hierarchy information to global hierarchy
    • doReduction enable reduction work
    • checkClassAdapter enable ASM's ClassAdapter check
    • addMethodRemoval enable method body bytecode reduction, doesn't work with addParamSubtyping
    • addParamSubtyping enable method parameter reduction, doesn't work with addMethodRemoval
    • addParentCollapsing enable class hierarchy collapsing reduction, currently broken.

Input/Output

  • rewrite main/java/reduction/WorkingEnv.java for inputting following folders and files
    • source folder
    • library folder
    • target folder
    • JReducePredicate, currently using shell script from JReduce

How to Run

  • For JReduce artifact
    • check main/java/reduction/WorkingEnv.java for reading paths
    • Call runAll or runWith in main/java/Main.java
    • Run JReduce with copied JReducePredicate.sh and compile.sh (modify run.sh from JReduce)
  • Custom bytecode lib
    • rewrite WorkingEnv.java with building ClassPool, Predicate
    • for non-decompiler cases, replace method call results with null or default values (stubbing) may provide a lot of invalid values: could use a reflection mechanism to create a valid value?

jreduce-extra's People

Contributors

airtnp avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.