Giter Site home page Giter Site logo

it-univr-bcel's Introduction

Java-Build Action Status Maven Central License

it-univr-bcel

BCEL utilities for inferring types in Java bytecode and for recomputing stack maps for a method. A stack map is compulsory from Java bytecode version 50 and higher. It specifies types at specific program points, ie., at targets of jumps. Compilers generate code with stack map tables, but code instrumentation might invalidate them. These utilities allow one to recompute stack map tables after code instrumentation with the BCEL library for bytecode instrumentation.

Type Inference

Given a BCEL MethodGen named m, this library allows one to infer the types at each of its instruction by computing

TypeInferrer inferrer = TypeInferrer.of(m);

Types at each instruction handle ih in m can then be accessed by using an intuitive API, as in the following example:

Types types = inferrer.getTypesAt(ih);
int stackHeight = types.stackHeight();
int localsCount = types.localsCount();
Type top = types.getStack(stackHeight - 1);
Type local0 = types.getLocal(0);

Stack-Map Inference

Given a BCEL MethodGen named m (with or without a stack map), this library allows one to infer a new stack map for m by computing

StackMapInferrer inferrer = StackMapInferrer.of(m);
Optional<StackMap> = inferrer.getStackMap();

The result is Optional since not all methods need a stack map.

Stack-Map Recomputation

Given a BCEL MethodGen named m (with or without a stack map), this library allows one to modify m by removing its old stack map (if any) and adding a new inferred stack map for it (if needed), by computing:

StackMapReplacer.of(m);

it-univr-bcel's People

Contributors

olilucjuliasoft avatar olivieriluca avatar spoto avatar

Stargazers

 avatar  avatar

Watchers

 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.