Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.VerifyError: Operand stack underflow when multiple redirector injectors target the same opcode #127

Closed
Barteks2x opened this issue May 19, 2016 · 5 comments
Assignees
Labels

Comments

@Barteks2x
Copy link

When updating to forge 1.9.4 my ChunkCache mixin caused VerifyError, this is the smallest Mixin that still causes it:

@Mixin(ChunkCache.class)
public abstract class MixinChunkCache {
    @Redirect(method = "getBlockState", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/BlockPos;getY()I"))
    public int getPosYOverride(BlockPos pos) {
        return pos.getY();
    }
}

And here is the whole error: http://pastebin.com/Kp1Pe83N

@Mumfrey
Copy link
Member

Mumfrey commented May 19, 2016

Thanks for the report, I will look into it and see what's going on.

@Mumfrey Mumfrey self-assigned this May 19, 2016
@Mumfrey Mumfrey added the bug label May 19, 2016
@Mumfrey
Copy link
Member

Mumfrey commented May 19, 2016

I can't reproduce this in vanilla with your test code so I guess some change that forge is making is the cause of the issue. I guess I will have to set up a forge workspace to test this out so it'll take a bit longer to investigate.

@Barteks2x
Copy link
Author

Barteks2x commented May 19, 2016

It turns out it was my own mistake. I was redirecting BlockPos.getY ffrom that method from 2 different mixins. I asked on #spongedev before reporting it and I was told to report it here. Sorry for confusion. I should have disabled all other mixins before reporting anything.

In 1.9 there was getBlockStateRaw method in RegionRenderCache, but in 1.9.4 this class wasn't there. So I moved the redirect from RegionRenderCache to client version of ChunkCache mixin. But there was already the same redirect in common version of ChunkCache mixin.

@Mumfrey
Copy link
Member

Mumfrey commented May 19, 2016

Redirectors are actually supposed to detect that kind of thing though, so it's kind of still a bug. In a nutshell if a redirector from one mixin "claims" a particular opcode, then only a mixin with a higher priority should be able to "claim" that same opcode and redirect it. This is part of the design which is there to ensure that multiple mixins can safely target the same classes and the priority semantics then determine the winners.

Basically, if this mechanism is not functioning as intended then it's still a bug, albeit a different bug to the one you were anticipating. I will investigate further.

@Mumfrey Mumfrey changed the title java.lang.VerifyError: Operand stack underflow when redirecting BlcokPos.getY in ChunkCache.getBlockState in MC 1.9.4 java.lang.VerifyError: Operand stack underflow when multiple redirector injectors target the same opcode May 19, 2016
@Mumfrey Mumfrey reopened this May 19, 2016
@Mumfrey
Copy link
Member

Mumfrey commented May 19, 2016

I have tracked down the problem, thanks for reporting this, it means I can push a fix and next time you'll get a sensible error instead of a corrupted class file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants