F
Francesco Devittori
Hi all,
I want to port an application from BCEL to ASM (which is smaller and
seems to be faster)
What I currently do with BCEL is:
an existing class is read. For each method in the class:
- l is the list of instructions in the method
- an algorithm re-creates the control flow graph:
some Node objects are created, each node contains:
- an instructionHandler that points to the instruction in l that
starts the node
- a size, i.e. the number of instructions in the node.
- then some instructions are inserted in each node (actually inserted
in l)
finally the class is dumped as an array of bytes (with the modified
instruction list of each method).
For example, imagine a fake example, with a method that has the
following instructions:
1: ldc
2: ifeq
3: iadd
4: ifnull
5: iinc
6: ldc
7: goto
Then these nodes are created:
Node 1: { start = 1; size = 2 }
Node 2: { start = 3; size = 1 }
Node 3: { start = 4; size = 4 }
What I whish to know from someone that already used ASM is: is it
possible to do something like that?
I played a bit with ASM and I was not able to do anything in the right
direction (but maybe it's because I'm used to BCEL).
TIA
Francesco
I want to port an application from BCEL to ASM (which is smaller and
seems to be faster)
What I currently do with BCEL is:
an existing class is read. For each method in the class:
- l is the list of instructions in the method
- an algorithm re-creates the control flow graph:
some Node objects are created, each node contains:
- an instructionHandler that points to the instruction in l that
starts the node
- a size, i.e. the number of instructions in the node.
- then some instructions are inserted in each node (actually inserted
in l)
finally the class is dumped as an array of bytes (with the modified
instruction list of each method).
For example, imagine a fake example, with a method that has the
following instructions:
1: ldc
2: ifeq
3: iadd
4: ifnull
5: iinc
6: ldc
7: goto
Then these nodes are created:
Node 1: { start = 1; size = 2 }
Node 2: { start = 3; size = 1 }
Node 3: { start = 4; size = 4 }
What I whish to know from someone that already used ASM is: is it
possible to do something like that?
I played a bit with ASM and I was not able to do anything in the right
direction (but maybe it's because I'm used to BCEL).
TIA
Francesco