Skip to content

Fix failure to recompute frames in mixins involving mixin-generated classes in stack frames - #435

Open
lukebemish wants to merge 4 commits into
neoforged:mainfrom
lukebemish:fix-mixin-frame-computing
Open

Fix failure to recompute frames in mixins involving mixin-generated classes in stack frames#435
lukebemish wants to merge 4 commits into
neoforged:mainfrom
lukebemish:fix-mixin-frame-computing

Conversation

@lukebemish

Copy link
Copy Markdown
Contributor

Fixes #434

In certain scenarios frame recomputation of Mixin classes needs to see the superclass of a class mixin generates. However, mixin-generated classes (as well as normal mixin classes) themselves may need frame computation, so that transform cannot be placed before neoforge:computing_frames! (Basically, a given class processor can either have the ability to have its changes be counted for frame computing, or can request computing itself. This is to avoid circularity).

I fix this through a few changes:

  • Make a new class processor, neoforge:mixin_frame_context, responsible for making any mixin changes that will affect frame computation
  • Move the bytecode capture point used by mixin to look up class hierarchy to this point (this is necessary to avoid circularity)
  • neoforge:mixin_frame_context runs generateClass on classes-to-be-generated on a copy of the received class node, then copies over any changes in super type to the actual classnode.This occurs before neoforge:computing_frames
  • neoforge:mixin runs generateClass to properly generate the class normally, later, as before.

Basically: I apply the changes in super type earlier by re-running the generator. Generators are safe to re-run -- FML already did that in FMLClassBytecodeProvider. The capture point has to be moved earlier because generators could request stuff from the mixin service, including looking up class info; I suspect this will not have any interesting effects in practice.

@neoforged-automation neoforged-automation Bot added the bug Something isn't working label Jul 31, 2026
@neoforged-pr-publishing

neoforged-pr-publishing Bot commented Jul 31, 2026

Copy link
Copy Markdown
  • Publish PR to GitHub Packages

Last commit published: b0f19ccdef7badb7f40625d9f34c07397ac5f5b0 - version: 11.0.21-pr-435-fix-mixin-frame-computing

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name = "Maven for PR #435" // https://github.com/neoforged/FancyModLoader/pull/435
        url = uri("https://prmaven.neoforged.net/FancyModLoader/pr435")
        content {
            includeModule("net.neoforged.fancymodloader", "earlydisplay")
            includeModule("net.neoforged.fancymodloader", "junit-fml")
            includeModule("net.neoforged.fancymodloader", "loader")
        }
    }
}

@lukebemish
lukebemish marked this pull request as draft July 31, 2026 04:28
@lukebemish

Copy link
Copy Markdown
Contributor Author

This PR also includes a test replicating #434; this test will fail without the changes from this PR.

@lukebemish
lukebemish marked this pull request as ready for review July 31, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mixin fails to load generated class

2 participants