add the ability to remap mixin annotation as an extension of tiny-remapper#63
add the ability to remap mixin annotation as an extension of tiny-remapper#63Player3324 merged 65 commits intoFabricMC:masterfrom Logiquo:mixinRemap
Conversation
|
Don't think tiny remapper should add this. This should go standalone as tiny remapper shouldn't have any relationship to mixin. |
|
It can be standalone once the pre/post visitor API is introduced. I carefully separated the code so it can be a matter of copy & paste if we want to separate them. (i.e. this will act as an extension of tiny-remapper). |
|
For mixin to run under multiple namespaces, it is supposed to just carry the mapping data in the jars. Also this doesnt' solve all bytecode transformation issue as this doesn't handle access wideners. Imo the remapping mixin thing should go into a separate project. |
|
It supposes to be a replacement of AP that can solves
Why does it suppose to carry the mapping data in the jars? Can we just remap the binary instead?
The AP also does not handle access wideners. And access widener is handled by loom, why do we want to handle it here? The idea is that, if I choose to do it in a separate project, then many logical need to be copied from tiny-remapper. If it acts like an extension of tiny-remapper, then many things will be easier. |
|
This should be part of the loader. The main logic of tiny remapper is handling bytecodes, while mixin's storage format itself does not touch bytecodes.
This is what mixin is doing with the compile extension right now.
I don't see why in one situation we only want to remap mixin but not access wideners.
No. Mixin compile extensions does remapping, and it doesn't use remapper at all. You probably mean you want to use mapping parser or the mapping io library instead. |
aw is already handled by loom, why do we want to do it again? And also
Using tiny-remapper is the easiest place to see how remap mixin will go. We can talk about its appreciated place once this thing works.
The idea is to completely remove the need for refmap. We just remap the string, shadow, etc all to the correct namespace. In the end, the resulting jar should run without any refmap. |
Same, mixin is already handled by loom and has both intermediary/named format, while aw is always intermediary.
It is out of the remapper's scope. You can always use any part of the remapper in the loader, where mixin actually exist, than introducing another unneeded and error-prone dependency to the remapper. Also there is no proof for your argument as what you have in the pr is just a few data classes.
It's not possible. For shadows etc, you still need refmap so you know what member should this mixin member change with. This is actually a current shortcoming with mixin refmap, as it only shows the name to remap without referencing the member it actually tracks in one mapping. |
I do not want to argue this one with you anymore, since the whole thing is still in a very early stage. And if anything goes for plans, no new dependency should be introduced.
The loom uses mixin AP to handle this, which has limitations as I explained above. I don't see any limitation for aw processing.
It's possible, you just remap the field name based on your knowledge of the current class & target class annotated by |
|
TR is in a much better position to remap the data than Mixin's annotation processor with MCE, it has the better model, doesn't incur runtime overhead, can modify the data to remap directly and doesn't have all the issues MCE tries to work around. It is in line with the regular remapping purpose of making the Jar behave as if it was written against the target namespace in the first place. PR 62 can provide the isolation necessary to leave TR core untouched beyond activating the feature. |
|
Agree that #62 would be the best approach. |
|
@LogicFan I wonder if it's feasible to create only 1 custom annotation node class that handles remapping, while the remapping configurations (e.g. what field has what type) goes to a separate class (the updated data will be applied to the annotation node itself). With only the mixin and shadow annotations, this is currently fine, but mixin has quite a few more annotations, and many of those annotations have string fields of effectively the same type (many are also descriptors, etc.) |
|
So there are 3 things that need to be remapped for a mixin.
The only thing needs to be considered here is 2 and 3. I would like to talk about some limitations of the existing mixin AP approach.
My solution will be:
Notice that the reason for 2 need another pass is that remapping a hard-target could affect things out of the current class instance, and hence cannot be done within this pass. |
|
Needing another pass doesn't sound right, it'd have to influence the propagation/analysis step instead of we want to go there (not sure it's worth it..) |
Suppose there is a But, the good news is that it won't affect any propagation/analysis step. Because all of these things are done by another tiny-remapper, with the newly generated mapping. Say if we want to use it in the loom, then loom will use the first tiny-remapper as before, but with a extra visitor to remap to soft-target and generate mapping for hard-target. Then loom will create another tiny remapper to remap the jar outputted by the first tiny-remapper based on the mapping generated by the previous extra visitor. |
|
Hmm, if we need another pass, can we just collect the needed hard mappings in the previsit? I don't think that those hard-targets can only be discovered after one round of remap is completed. |
If you are talking about This can be done and is what has been done by the mixin AP. But the problem is either
Thus, I think a second pass is better. Create another tiny-remapper inside loom does not sound too problematic. In the end, it just a chain of remapping. If you are talking about another pre-visitor, then it propergate only on the class level, not the entire classpath level, so it won't work. |
|
Based on my experiment in |
|
I think an extra analysis pass is needed for both incomplete |
|
This one is ready for review. (pending for #62 ) |
|
Since #62 is merged, this one is ready to review. Also, I think this one can be in its own repo similar to https://github.com/FabricMC/fabric-mixin-compile-extensions . The benefit would be to have two independent version numbers, so we can bump one's version without affects the other in the loom build. |
Currently WIP.finishedHere is the list of annotation need to be remapped. Please add more if I forget something.
@Mixin@Shadow@Overrite@Accessor@Invoker@Implements@Inject@ModifyArg@ModifyArgs@Redirect@ModifyVaribale@ModifyConstant@Desc@At@Slice@Descriptors