Re: Dataflow/alias analysis

Tronje Krop <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Organization Darmstadt University of Technology
Message-ID <[email protected]>
Hi Peter,

I needed some time to think about your problem, and my be it is a
little off-topic here. But anyhow: Your problem is that you want to
substitute any access to your object variables against their tran-
local counterparts. As this is a costly operation and thus you want
to reduce the number to the minimum needed.

As I see it, your solution depends on two factors, (1) the boarders
of your defined optimization context (method, class, entity, or trans-
action level), and (2) the assumed usage pattern of these objects.
E.g. if an object is only used by invoke, it is counter productive
to resolve and substitute it with its tranlocal, if it is only used
by field access resolving the tranlocal and substituting it is the
better solution.

Its getting more complex, if you try to optimize across method
boundaries by expecting or providing tranlocals instead of objects
in method calls ...

Actually, I'm not sure, whether you should walk this path. In
general, optimizing is a though task against a moving target as the
JVM. Java compilers today are very stupid generating lots of un-
necessary branches etc. and leaving it for the hot-spot compiler
to fix this. On the other side usage patterns might be not that bad
as you think, e.g. why should a user load/store a field more than
once? So optimizing against false usage patterns may be even more
fruitless.


Anyhow, if you want to do optimizations on method level, one
solution is to use the AnalyzerAdapter for tracking of local
variable and stack types. But be careful it has a small bug ;-)

http://forge.ow2.org/tracker/index.php?func=detail&aid=314592&group_id=23&atid=100023

The core approach is to analyze each method for variable usage
patterns and to decide whether the stack element should be
substitution, an additional local variable should be reserved,
or an element stays untouched. This pattern can be extended
across classes as long as you can define the borders of your
transaction correctly.

I have build a very complex parser for my project that analyzes
the usage patterns and decides on the optimization model used for
each method and class in this way. It recursively follows call-
graphs, which makes it very brittle against cyclic class access
etc. So you should strongly define, the limits of your analysis
and optimizations from begin.

But before you start to implement optimization you should let the
analyzer count whether it really makes a difference if you provide
an complex optimization pattern.

Best regards,

Tronje

Peter Veentjer wrote:
> Hi guys
> 
> I'm working on an stm and one of the optimizitions i want to add is to  
> minimize transaction access and i want to do this by optimizing the  
> bytecode.
> 
> If there is à transactional class, all managed fields of this class  
> are removed and stored in à new class 'the tranlocal'. If a  
> transactional object is used, the tranlocal of that object is stored  
> in the transaction. This all works perfectly.
> 
> But what i want to do is to minimize the number of retrievals of the  
> tranlocal from à transaction. One of the optimizitions i already added  
> is that the tranlocal of the owner of an instance method automatically  
> is added as extra method argument (i add extra parameters to a method  
> including the transaction).
> 
> The problem is finding à safe way to figure out which object is on the  
> stack when an put/getfield/invoke is executed. I could go back to the  
> previous instruction and see if it was an aload 0, but this doesnt  
> cover all the cases (cant deal with dup, swap etc). So i need  
> something more intelligent.
> 
> Another related optimization i want to add is that the same tranlocal  
> for the same transactional object doesnt need to be retrieved more  
> than once in the same method body. But what is a safe way to determine  
> this.
> 
> If someone could point me in the right direction.
> 
> 

-- 
     Tronje Krop <[email protected]>

   Encrypted eMail welcome! GPG/PGP-Key: 0x9AD43A05
  68E5 A3D3 75A0 B096 AC75  62D5 8EEE 3D18 9AD4 3A05

 No responsibility is taken for the correctness of the
previous information. Please delete if you receive this
                  mail unintentional.
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.