0.7.8 - Fix 2 issues with ArgsClassGenerator, closes #249

1) Class generator was not sanitising incoming descriptors and would not
handle non-void candidates
2) Class generator was not correctly walking the argument list when
2-slot args (long, double) were present
This commit is contained in:
Mumfrey committed 2018-04-18 12:32:31 +01:00
1 parent 4f8967ee3c
commit 1f936baea1
3 files changed
+9 -11

No files matched your search

@@ -60,7 +60,7 @@ public abstract class MixinBootstrap {
/**
* Subsystem version
*/
public static final String VERSION = "0.7.7";
public static final String VERSION = "0.7.8";
/**
* Log all the things
@@ -107,19 +107,16 @@ public final class ArgsClassGenerator implements IClassGenerator {
* will not be generated until it is used. Calling this method simply
* allocates a name for the specified descriptor.
*
* @param desc Descriptor of the <em>target</em> method, with the return
* type changed to void (V)
* @param desc Descriptor of the <em>target</em> method, the return type is
* ignored for the purposes of generating Args subclasses
* @return name of the Args subclass to use
*/
public String getClassName(String desc) {
if (!desc.endsWith(")V")) {
throw new IllegalArgumentException("Invalid @ModifyArgs method descriptor");
}
String name = this.classNames.get(desc);
String voidDesc = Bytecode.changeDescriptorReturnType(desc, "V");
String name = this.classNames.get(voidDesc);
if (name == null) {
name = String.format("%s%d", ArgsClassGenerator.CLASS_NAME_BASE, this.nextIndex++);
this.classNames.put(desc, name);
this.classNames.put(voidDesc, name);
}
return name;
}
@@ -263,9 +260,10 @@ public final class ArgsClassGenerator implements IClassGenerator {
for (Type arg : args) {
of.visitInsn(Opcodes.DUP);
of.visitConstant(argIndex);
of.visitVarInsn(arg.getOpcode(Opcodes.ILOAD), argIndex++);
of.visitVarInsn(arg.getOpcode(Opcodes.ILOAD), argIndex);
ArgsClassGenerator.box(of, arg);
of.visitInsn(Opcodes.AASTORE);
argIndex += arg.getSize();
}
// Call the constructor passing in the generated array