Search code examples
javaassemblyjvmbytecodejava-bytecode-asm

How do I compile JVM assembly code into bytecode?


If I ran javap -c ASM.class > ASM.java to get the assembly code, how would I recompile this back into JVM bytecode?


Solution

  • Jasmin is an assembler for Java bytecodes. However, I don't know whether it can cope with the output from javap.


    UPDATE

    The Jasmin documentation says this about javap output:

    Sun does provide a javap program which can print the assembly code in a class file. However, the javap output is inappropriate for use as an assembler format. It is designed to be read by a person, not to be parsed by an assembler, so it has a number of omissions and drawbacks.

    On the basis of this, I'd say there is little chance of finding an assembler that takes javap output as its input.