The Artima Developer Community
Sponsored Link

Artima Developer Spotlight Forum
Dataflow Analysis for Javassist

1 reply on 1 page. Most recent reply: Jun 23, 2008 12:02 PM by Raoul Duke

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Dataflow Analysis for Javassist Posted: Jun 18, 2008 8:29 PM
Reply to this message Reply
Advertisement

Many types of applications rely on the ability to alter Java bytecode prior to loading classes into the JVM. Code verifiers, coverage analyzers, O/R mapping tools, distributed object caches, or profilers are just a few examples of applications that need the ability to enhance Java bytecode.

Several open-source tools have been providing programmatic access to byte codes, such as ASM and Javassist. In a recent blog post, Jason Green, a lead developer on JBoss Cache, describes in a recent blog post, Javassist now provides data-flow analysis API , why he needed to add dataflow analysis capabilities to Javassist:

A lot of information is lost once a Java program is compiled, since it is not really needed when the program is executed, and leaving it out helps keep class files small...

For security reasons, the JVM actually does its own data-flow analysis to verify that a class does not violate type rules before it can be ran. This poses an interesting challenge to any application that manipulates bytecode, since any change that affects the possible type-state can lead to a verify error and the JVM throwing out the class...

To get around that problem, Greene added the ability to perform such dataflow analysis from within Javassist:

The framework allows an application to determine, by inference, the type-state of the local variable table and stack frame at the start of every bytecode instruction...

The analysis framework provides this by modeling the effect of every instruction, until it can eventually infer the type information. This process does not use any debugging information, since there is no guarantee it is available. Instead, it extrapolates it by tracking all possible type states, as every branch is evaluated, until the type information is reduced to the most specific type state available...

What do you think of Javassist and other bytecode manipulation libraries?


Raoul Duke

Posts: 127
Nickname: raoulduke
Registered: Apr, 2006

Re: Dataflow Analysis for Javassist Posted: Jun 23, 2008 12:02 PM
Reply to this message Reply
> <p>What do you think of Javassist and other bytecode
> manipulation libraries?</p>


yeah, well. i've been burned by having one bytecode-hackery-thing get all fouled up with another bytecode-hackery-thing. so each worked OK individually, but could not work together. which completely turned me off of the idea of every using anything 3rd party that does bytecode hackery. of course, this was a while ago, so maybe things suck less now, but since i'm a natural pessimist i suspect they still kinda suck. or that at the very least there can easily be come gotchya waiting to jump out of the bushes at you.

Flat View: This topic has 1 reply on 1 page
Topic: Dataflow Analysis for Javassist Previous Topic   Next Topic Topic: eoSense Introduces JPA Visualization Tool

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use