Storyyeller / Krakatau

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

Register Contains Wrong Type #7

Closed ghost closed 11 years ago

ghost commented 11 years ago

I don't believe this is a bug w/ Krakatau however I don't know who else to ask. I am modifying another class and putting in an extra private method. However whenever I run the program I am getting an error w/ the method saying one of the registers contains the wrong type.

http://pastebin.com/W7xjaNmS New Method Code

This is the portion of the error that should be useful

cpw.mods.fml.common.LoaderException: java.lang.VerifyError: (class: dan200/turtle/shared/BlockTurtle, method: setOwner signature: (Lyc;IIILjava/lang/String;)V) Register 5 contains wrong type

Storyyeller commented 11 years ago

The problem is the line iload 5

You're loading a value from local 5 without storing anything in it first.

ghost commented 11 years ago

Is that how you load up arguments being passed in though?

Storyyeller commented 11 years ago

Well setOwner is a virtual method, so it has 6 arguments, passed in through slots 0-5. So there actually is a value in slot 5, but it's the wrong type. The last argument is a string, but you're trying to load an int out of it.

ghost commented 11 years ago

Yea I figured it out and fixed it but now I have a new error! This is done w/o any major modifications, I just disassembled and removed the LocalVariableTable & LineNumberTable.

java.lang.VerifyError: (class: dan200/turtle/shared/TileEntityTurtle, method: createTurtlePlayer signature: (Lyc;IIII)Ldan200/turtle/shared/TurtlePlayer;) Inconsistent stack height 1 != 0

https://dl.dropbox.com/u/7231478/TileEntityTurtle.class

ghost commented 11 years ago

https://dl.dropbox.com/u/7231478/computercraft.zip These ones?

Arg, keep clicking the close button

Storyyeller commented 11 years ago

Where is the 'any' class that TitleEntityTurtle is inheriting from? It's not in the zip you gave me.

ghost commented 11 years ago

https://dl.dropbox.com/u/7231478/mcpc-plus.jar Somewhere in there

Storyyeller commented 11 years ago

Are you sure that zip contains the original TitleEntityTurtle? It looks like the tableswitch entries are messed up, so it should have never been runnable in the first place.

ghost commented 11 years ago

https://dl.dropbox.com/u/7231478/computercraft.zip I reuploaded it, might of done the wrong one by accident

ghost commented 11 years ago

I will retry it later, very weird bug.

Storyyeller commented 11 years ago

Ok, I found the problem. Due to a stupid mistake, the parser discards all the jump offsets when reassembling a tableswitch. And due to the way the code is written, it still runs without error, it just produces incorrect bytecode, so I didn't notice the problem during test

ghost commented 11 years ago

Lol, alright

Storyyeller commented 11 years ago

Ok, try it now. It should be fixed.