Comments (6)
No, injectors already are a little too close to needing to understand bytecode for my liking, but there's no way around it. With rerouters, understanding bytecode is actually required but the code generated is still safe. There is no way I am going to allow the mixin author to control the bytecode, see this old reply, that is not what mixin is about.
Mixin isn't just a library for "making ASM hackery easy", that is not what it is about. It is a way of defining deterministic transformations to target classes which can be generated and injected into the target class in such a way that the output bytecode falls in to one of two guarantees:
- The bytecode will be sane OR
- The bytecode will not be injected
This is why there are so many checks and balances in Mixin and why any type of hackery is not happening.
Rerouters are by the far the hackiest feature, and are not going to be released until I'm satisfied that the LVT inflection upon which they rely is stable to my satisfaction. Even then, their scope is limited such that the code they inject will always be sane.
This has always been the case, people get so fixated on doing things with mixins that they forget that you can do whatever you want to with a transformer. But I am not prepared to ever let the end user have any direct control over the bytecode which is injected. Literally the only exception to this currently is the BY
argument in @At
annotations, and that only exists because that functionality was ported directly from liteloader and I didn't think to remove it at the time.
from mixin.
This is pretty much impossible.
from mixin.
However there are other things which are planned which you could probably leverage to do something like that.
from mixin.
Why is this impossible?
from mixin.
Because there's no such thing as a loop or the concept of continue
in bytecode, the compiler converts it all to jumps. Working out where a loop is is incredibly difficult, working out the semantics of a continue
at an arbitrary point in the bytecode would be much harder.
Okay, "impossible" is probably over-stating somewhat, but "incredibly hard, bordering on impossible" would be closer.
from mixin.
Wouldn't it be possible to make something like this:
callbackInfo.goto("L1");
Than this also could be helpfully to overwrite pieces of code in a method. Like you inject and than jump over the code you don't want to use anymore.
from mixin.
Related Issues (20)
- `Accessor` and `Invoker` Mixins delete methods with the same name in the target class
- java.lang.NoClassDefFoundError: org/spongepowered/asm/synthetic/args/Args$1 HOT 1
- [Feature Request] Inject goto instructuion
- [Forge][Build error] Using class from custom lib in Mixin class throw Exception
- `MappingWriterTSrg` is named incorrectly
- Thread: Render thread Suspected Mod: Patchouli (patchouli), Version: 1.20.1-83-FORGE HOT 1
- Allow `@ModifyVariable` to capture locals HOT 1
- Mixins Not Being Read, Force Disabling Them. Game Crashes. HOT 1
- Trying to add another 'case' value to a 'switch' statement
- injection failed HOT 1
- INVOKE_ASSIGN gets stopped by CHECKCASTs HOT 2
- Wiki Subsection Titles
- [Forge] Stack Overflow when a invoked method is called HOT 1
- Support ModLauncher loaded as JPMS Module / Classes-Folder
- Initializer merging behavior seems to have changed in 0.8.6 snapshots HOT 1
- Constructor redirect incorrectly handles nested constructor invocations
- Redirect can not find its target. HOT 4
- Inability to get all classes targetted by mixin HOT 6
- Modpack Server Crash HOT 1
- When you log in it shows this HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mixin.