Modify / Add Instruction set of Java & Add New SuperInstruction to It

David Holmes david.holmes at
Tue Oct 24 05:07:40 UTC 2017


On 23/10/2017 12:23 AM, Adeel Iqbal wrote:
> Hi,
> i am working on a project where i have to modify the java bytecode instruction set by adding custom instruction  (SuperInstructions) as a replacement of sequence of instructions in order to reduce the size of the generated file and to modify the JVM to recognize these new instructions.
> can you please guide me.

That's a significant project. Not knowing how much you know about 
anything makes it hard to give guidance. But you're not the first to 
attempt such a thing so I suggest doing some initial research. This is a 
quick hit I got when I googled "bytecode compaction for the JVM":

It's only a preview, you'll need to get full access to the paper by some 
means. But their project has a wikipedia entry:

Disclaimer: I know nothing about this system.

The theory is simple enough:

1. Identify the sequences you want to replace
2. Write a tool (or modify javac) to recognize the sequences and replace 
them with the new bytecode.
3. Add the new bytecode to the interpreter.

Before proceeding with step 3 run the tool over your benchmark 
application and see if you're really achieving your goals with regards 
to saving space.

But please don't expect step-by-step assistance with this.


More information about the hotspot-dev mailing list