Recaf icon indicating copy to clipboard operation
Recaf copied to clipboard

Option to "Disable code optimization"

Open CipherCloak opened this issue 5 years ago • 3 comments

Option to "Disable code optimization"

Maybe something like Config -> Assembler => Disable code optimization

The main idea is to have an option to "disable" code optimization when modifying a class.

Please refer to the following images for a better explanation.

Original code with the instruction IFNONNULL J replaced with GOTO T image

Resulting method after the optimization image

Recaf-2.4.1

CipherCloak avatar Aug 24 '20 20:08 CipherCloak

That can't be turned off. ASM replaces dead code with nops plus athrow in order to generate valid stack map.

xxDark avatar Aug 24 '20 20:08 xxDark

Thanks for the info.

CipherCloak avatar Aug 24 '20 20:08 CipherCloak

Yeah, it would be nice, but this is an ASM feature: MethodWriter.java

Like most things in ASM, its code inside a private method and is tightly coupled with other private logic, so it can't be easily removed by extension (This is a common head-ache when attempting to mess with adding behavior to ASM). Great library, but the developers don't intend on making large portions of their code extensible.

I'd be happy to accept a PR if somebody finds a magical (and clean) way to resolve this. I would prefer to not ship our own fork of ASM.

Col-E avatar Aug 24 '20 23:08 Col-E