|
This week I provide not a simple applet but a complete application written in Java. For the Java 1.1 version of this application click here. Its name is Spill The Beans! and I think that such a name is really appropriate because it has at least a triple meaning. This program is useful to view in an understandable form the class files, showing them in three ways: a dump view, an assembly view with the VM sintax and an assembly view with a simplified sintax. This is not a decompiler, it's a disassembler. DON'T TRY TO DECOMPILE this program, because it's against international laws. However, you can ask me the source code, it's simpler ![]() If these notes below are not enough, feel free to ask more with the comments form. |
To install the program simply unzip it in a directory of your choice. Then open the SpillTheBeans.bat file (I use Windows 95 and OS/2) and you'll see something like
set SPILL_PATH=
path=c:\java\bin;%path%
set classpath=%SPILL_PATH%;c:\windows\java\classes
javaw Spill
You have to write the path of the program after the SPILL_PATH=
, then substitute c:\java\bin
with the directory in which you keep javaw.exe
and, finally, c:\windows\java\classes
with the path of the classes.zip
file. I hope that all this will work properly.
As usual there is a text area, a status bar, a speed bar and a menu bar. The use is very simple and the items in the menus are few.
When a class file is selected and DUMP is not checked, in the speed bar appears the list of the methods. If a method is large, it is spanned on several text areas (due to a text size limit for standard text areas).
Changes in the check of SIMPLE SINTAX and SHOW PACKAGES involve only the current method, unless the text area shows the class header (first page).
To understand the DUMP view and the VM sintax read The Java Virtual Machine Specification. You can find it somewhere at JavaSoft.
Remember that the Java Virtual Machine uses only stack, no registers.
nop | no operation | load | loads a value from the stack | store | store a value into the stack |
---|---|---|---|---|---|
pop | pops a value | pop2 | pops two values | dup | duplicates a value |
dup_x1 | ...,x2,x1-> ...,x1,x2,x1 | dup_x2 | ...,x3,x2,x1-> ...,x1,x3,x2,x1 | dup2 | duplicates two values |
dup2_x1 | ...,x4,x3,x2,x1-> ...,x2,x1,x4,x3,x2,x1 | dup2_x2 | ...,x4,x3,x2,x1-> ...,x2,x1,x4,x3,x2,x1 | swap | ...,x2,x1-> ...,x1,x2 |
add | adds | sub | subtracts | mul | multiplies |
div | divides | mod | finds the remainder | neg | negates |
shl | shift left | shr | signed shift right | ushr | unsigned shift right |
and | logical and | or | logical or | xor | logical xor |
long | conversion | float | conversion | double | conversion |
byte | conversion | char | conversion | short | conversion |
cmpl | true if equal or less | cmpg | true if equal or greater | ifXX | jumps if XX is satisfied |
goto | jumps | jsr | jumps to subroutine | ret | returns from subroutine |
switch | switch clause | return | returns from method | invoke | invokes a method |
new | new object | newarray | new array | checkcast | checks casting |
instanceof | checks if instance of |
![]() |
In the next Issue Weekly Applet will be Galactic Collider | ![]() |
---|