Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 220 forks source link

Request: invokeinterface should compute the count operand when absent #91

Closed toddATavail closed 8 years ago

toddATavail commented 8 years ago

Even the JVM authors admit that the count operand required by invokeinterface is vestigial and redundant, since this information can be deduced from the target method signature. Nonetheless Krakatau requires this (pointless) operand to be supplied. This gives the assembler low-level fidelity, but in my opinion the assembler should automatically compute the correct value when the operand is omitted. If the operand is supplied, then the assembler should behave as it does now.

Storyyeller commented 8 years ago

I looked into this and realized there is one potential issue: in some cases the assembler does not actually know the descriptor. For example, if you use a reference. I could make it so that it fills in the arg count when the descriptor is specified inline. Is that acceptable?

Storyyeller commented 8 years ago

It took 30 lines of code. I hope you like it.

toddATavail commented 8 years ago

Thanks! I will check it out today. :)

toddATavail commented 8 years ago

I don't actually use references in the code generated by my compiler, so what you've done is great. I just verified that it works for a large class file with hundreds of invokeinterface instructions. Thanks again!