Coder Social home page Coder Social logo

muralisr / jimple-statement-and-heap-locations Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shreyas-dharanesh/jimple-statement-and-heap-locations

0.0 0.0 0.0 16.2 MB

The project implements an intra-procedural transform that iterates over the set of all Jimple statements and print out those that read and write heap locations.

License: MIT License

Java 87.05% HTML 12.95%

jimple-statement-and-heap-locations's Introduction

The project implements an intra-procedural transform that iterates over the set of all Jimple statements and prints out those that read and write heap locations. Each Java method in soot is represented by a SootMethod object. From this object, we retrieve the body of the method by calling getActiveBody(). This will give us a Body object, through which we have access to all information on the Java method, such as local variables and statements. We can then use the method getUnits() to get a chain of statements the method contains. Write a while loop that iterates over the statements in the chain. In Jimple, each statement is an object of interface Stmt, which has many different implementing classes. Among these Stmt classes, we are interested in JAssignStmt, which represents assignment statements (e.g., anything of the form a = b). To identify statements that access the heap, we need to understand what the left-hand-side (LHS) and RHS operands are for each statement. To do this, we can call methods getLeftOp() and getRightOp() on each statement object. These calls return objects of type Value, which is an interface representing all expressions, locals, constants, and references in a Java program. We are particularly interested in InstanceFieldRef, StaticFieldRef, and ArrayRef, each of which represents a type of heap access. If the LHS/RHS of an assignment is an InstanceFieldRef, the assignment is of the form: a.f = b(heap write) b = a.f (heap read); If the LHS/RHS of an assignment is a StaticFieldRef, the assignment is of the form: A.f = b (heap write) b=A.f (heap read); If the LHS/RHS of an assignment is an ArrayRef, the assignment is of the form: a[i] = b (heap write) b=a[i] (heap read); The output of the analysis should have the following format: Statement a.f = b, heap write; Statement b = a[i], heap read;

jimple-statement-and-heap-locations's People

Contributors

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