JikesBT : Java Glossary

I have left this tombstone entry for historical interest.

JikesBT
Now defunct. Jikes Bytecode Toolkit is a 100% Java class library which enables Java programs to create, read, and write binary Java class files, and to query and update a single high-level representation of the collection of them, including relationships among them. This allows developing tools which report on what APIs (Application Programming Interfaces) the classes use, reorder and change instructions, merge or extend classes, add customized instrumentation (similar to profilers), analyze control and data flow, etc. JikesBT’s main distinction is ease of use due to the removal of the details of the class file format from users concern. For example, each class file has a constant pool, and any reference to another class, a method, a field, or a constant value has to go through this constantpool. Such detail is hidden in JikesBT. Whenever a reference is made to another class, field, or method, an object is created to represent it, and a direct reference to it is provided.

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
on the web at:

http://mindprod.com/jgloss/jikesbt.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\jikesbt.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Blog
IP:[65.110.21.43]
Your face IP:[54.225.1.70]
You are visitor number