Giter Site home page Giter Site logo

Comments (6)

Mumfrey avatar Mumfrey commented on May 18, 2024 1

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.

Mumfrey avatar Mumfrey commented on May 18, 2024

This is pretty much impossible.

from mixin.

Mumfrey avatar Mumfrey commented on May 18, 2024

However there are other things which are planned which you could probably leverage to do something like that.

from mixin.

Lunaphied avatar Lunaphied commented on May 18, 2024

Why is this impossible?

from mixin.

Mumfrey avatar Mumfrey commented on May 18, 2024

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.

thomas15v avatar thomas15v commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.