For instance, classes contain methods, methods contain code and code contains bytecode instructions. One such instruction is the new instruction which creates an object. In the standard class file representation the bytecode is followed by two other bytes, which together form an index into the constantpool, where a string can be found with the name of the class. To attach a certain property to this target class (like a creation site), one first needs to find the class through some kind of repository. This process is complicated, repetitive and error-prone.
In JikesBT, classes still have methods, methods still have code and code still has instructions. But these instructions are represented by objects and the object representing the new instruction does not have a number to index into the constantpool anymore. Instead, a direct Java reference to the target class is provided. Adding properties to the class is a simple matter of following the link. As a matter of fact, a class’s constantpool is optionally removed after the class is loaded and the constant pool is transparently regenerated when the class is saved. Users will never even see the constantpool unless they want to.
Summarizing, JikesBT provides a logical representation of the class file, whereas most bytecode representation packages give a more direct, more detailed and more low-level, physical representation.
JikesBT’s model is quite rich and provides a number of relationships, such as an easy way to find each instruction where a given class is allocated, where a given method is invoked and where a given field is accessed. It records which methods override which others, which will be inherited from other classes and even which method implements a method declared in a given interface even if via inheritance. There’s an extraInformation reference field in the major objects which is available for use by the user and even a way to subclass some of JikesBT’s classes with user-written classes to provide additional or altered functionality.
When a class is being written, JikesBT chooses the proper opcode depending on the size of an inline constant or the placement of an item in the constant pool. JikesBT can even do peep-hole optimization.
Also included with JikesBT are examples such as javaSpy which is an easily extended tool which adds instrumentation to an application which allows the application’s execution to be observed.
This page is posted
Optional Replicator mirror
|no blog for this page||Canadian
Your face IP:[188.8.131.52]
You are visitor number|