public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { MethodHandleConstant otherMethodHandleConstant = (MethodHandleConstant)otherConstant; int kind = methodHandleConstant.getReferenceKind(); int otherKind = otherMethodHandleConstant.getReferenceKind(); result = kind < otherKind ? -1 : kind > otherKind ? 1 : compare(methodHandleConstant.getClassName(clazz), methodHandleConstant.getName(clazz), methodHandleConstant.getType(clazz), otherMethodHandleConstant.getClassName(clazz), otherMethodHandleConstant.getName(clazz), otherMethodHandleConstant.getType(clazz)); }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { MethodHandleConstant methodHandlePatternConstant = (MethodHandleConstant)patternConstant; // Check the handle type and the name and type. matchingConstant = matchingArguments(methodHandleConstant.getReferenceKind(), methodHandlePatternConstant.getReferenceKind()) && matchingConstantIndices(clazz, methodHandleConstant.getReferenceIndex(), methodHandlePatternConstant.getReferenceIndex()); }
/** * Finds or creates a MethodHandleConstant constant pool entry of the * specified kind and with the given field ref, interface method ref, * or method ref constant pool entry index. * @return the constant pool index of the MethodHandleConstant. */ public int addMethodHandleConstant(int referenceKind, int referenceIndex) { int constantPoolCount = targetClass.u2constantPoolCount; Constant[] constantPool = targetClass.constantPool; // Check if the entry already exists. for (int index = 1; index < constantPoolCount; index++) { Constant constant = constantPool[index]; if (constant != null && constant.getTag() == ClassConstants.CONSTANT_MethodHandle) { MethodHandleConstant methodHandleConstant = (MethodHandleConstant)constant; if (methodHandleConstant.u1referenceKind == referenceKind && methodHandleConstant.u2referenceIndex == referenceIndex) { return index; } } } return addConstant(new MethodHandleConstant(referenceKind, referenceIndex)); }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { // First add the field ref, interface method ref, or method ref // constant. clazz.constantPoolEntryAccept(methodHandleConstant.u2referenceIndex, this); // Then add the actual method handle constant. constantIndex = constantPoolEditor.addMethodHandleConstant(methodHandleConstant.getReferenceKind(), constantIndex); }
@Override public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo) { ProgramClass programClass = (ProgramClass) clazz; MethodHandleConstant bootstrapMethodHandle = (MethodHandleConstant) programClass.getConstant(bootstrapMethodInfo.u2methodHandleIndex); if (isStringConcatFactory(bootstrapMethodHandle.getClassName(clazz))) { concatenationRecipe = ((StringConstant) programClass.getConstant(bootstrapMethodInfo.u2methodArguments[0])).getString(programClass); concatenationConstants = bootstrapMethodInfo.u2methodArgumentCount > 1 ? Arrays.copyOfRange(bootstrapMethodInfo.u2methodArguments, 1, bootstrapMethodInfo.u2methodArgumentCount) : new int[0]; } }
/** * Finds or creates a MethodHandleConstant constant pool entry of the * specified kind and with the given field ref, interface method ref, * or method ref constant pool entry index. * @return the constant pool index of the MethodHandleConstant. */ public int addMethodHandleConstant(int referenceKind, int referenceIndex) { int constantPoolCount = targetClass.u2constantPoolCount; Constant[] constantPool = targetClass.constantPool; // Check if the entry already exists. for (int index = 1; index < constantPoolCount; index++) { Constant constant = constantPool[index]; if (constant != null && constant.getTag() == ClassConstants.CONSTANT_MethodHandle) { MethodHandleConstant methodHandleConstant = (MethodHandleConstant)constant; if (methodHandleConstant.u1referenceKind == referenceKind && methodHandleConstant.u2referenceIndex == referenceIndex) { return index; } } } return addConstant(new MethodHandleConstant(referenceKind, referenceIndex)); }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { // First add the field ref, interface method ref, or method ref // constant. clazz.constantPoolEntryAccept(methodHandleConstant.u2referenceIndex, this); // Then add the actual method handle constant. constantIndex = constantPoolEditor.addMethodHandleConstant(methodHandleConstant.getReferenceKind(), constantIndex); }
@Override public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo) { ProgramClass programClass = (ProgramClass) clazz; MethodHandleConstant bootstrapMethodHandle = (MethodHandleConstant) programClass.getConstant(bootstrapMethodInfo.u2methodHandleIndex); if (isStringConcatFactory(bootstrapMethodHandle.getClassName(clazz))) { concatenationRecipe = ((StringConstant) programClass.getConstant(bootstrapMethodInfo.u2methodArguments[0])).getString(programClass); concatenationConstants = bootstrapMethodInfo.u2methodArgumentCount > 1 ? Arrays.copyOfRange(bootstrapMethodInfo.u2methodArguments, 1, bootstrapMethodInfo.u2methodArgumentCount) : new int[0]; } }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { MethodHandleConstant otherMethodHandleConstant = (MethodHandleConstant)otherConstant; int kind = methodHandleConstant.getReferenceKind(); int otherKind = otherMethodHandleConstant.getReferenceKind(); result = kind < otherKind ? -1 : kind > otherKind ? 1 : compare(methodHandleConstant.getClassName(clazz), methodHandleConstant.getName(clazz), methodHandleConstant.getType(clazz), otherMethodHandleConstant.getClassName(clazz), otherMethodHandleConstant.getName(clazz), otherMethodHandleConstant.getType(clazz)); }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { MethodHandleConstant methodHandlePatternConstant = (MethodHandleConstant)patternConstant; // Check the handle type and the name and type. matchingConstant = matchingArguments(methodHandleConstant.getReferenceKind(), methodHandlePatternConstant.getReferenceKind()) && matchingConstantIndices(clazz, methodHandleConstant.getReferenceIndex(), methodHandlePatternConstant.getReferenceIndex()); }
/** * Finds or creates a MethodHandleConstant constant pool entry of the * specified kind and with the given field ref, interface method ref, * or method ref constant pool entry index. * @return the constant pool index of the MethodHandleConstant. */ public int addMethodHandleConstant(int referenceKind, int referenceIndex) { int constantPoolCount = targetClass.u2constantPoolCount; Constant[] constantPool = targetClass.constantPool; // Check if the entry already exists. for (int index = 1; index < constantPoolCount; index++) { Constant constant = constantPool[index]; if (constant != null && constant.getTag() == ClassConstants.CONSTANT_MethodHandle) { MethodHandleConstant methodHandleConstant = (MethodHandleConstant)constant; if (methodHandleConstant.u1referenceKind == referenceKind && methodHandleConstant.u2referenceIndex == referenceIndex) { return index; } } } return addConstant(new MethodHandleConstant(referenceKind, referenceIndex)); }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { // First add the field ref, interface method ref, or method ref // constant. clazz.constantPoolEntryAccept(methodHandleConstant.u2referenceIndex, this); // Then add the actual method handle constant. constantIndex = constantPoolEditor.addMethodHandleConstant(methodHandleConstant.getReferenceKind(), constantIndex); }
@Override public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo) { ProgramClass programClass = (ProgramClass) clazz; MethodHandleConstant bootstrapMethodHandle = (MethodHandleConstant) programClass.getConstant(bootstrapMethodInfo.u2methodHandleIndex); if (isStringConcatFactory(bootstrapMethodHandle.getClassName(clazz))) { concatenationRecipe = ((StringConstant) programClass.getConstant(bootstrapMethodInfo.u2methodArguments[0])).getString(programClass); concatenationConstants = bootstrapMethodInfo.u2methodArgumentCount > 1 ? Arrays.copyOfRange(bootstrapMethodInfo.u2methodArguments, 1, bootstrapMethodInfo.u2methodArgumentCount) : new int[0]; } }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { MethodHandleConstant otherMethodHandleConstant = (MethodHandleConstant)otherConstant; int kind = methodHandleConstant.getReferenceKind(); int otherKind = otherMethodHandleConstant.getReferenceKind(); result = kind < otherKind ? -1 : kind > otherKind ? 1 : compare(methodHandleConstant.getClassName(clazz), methodHandleConstant.getName(clazz), methodHandleConstant.getType(clazz), otherMethodHandleConstant.getClassName(clazz), otherMethodHandleConstant.getName(clazz), otherMethodHandleConstant.getType(clazz)); }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { MethodHandleConstant methodHandlePatternConstant = (MethodHandleConstant)patternConstant; // Check the handle type and the name and type. matchingConstant = matchingArguments(methodHandleConstant.getReferenceKind(), methodHandlePatternConstant.getReferenceKind()) && matchingConstantIndices(clazz, methodHandleConstant.getReferenceIndex(), methodHandlePatternConstant.getReferenceIndex()); }
private Constant createConstant() { int u1tag = dataInput.readUnsignedByte(); switch (u1tag) { case ClassConstants.CONSTANT_Integer: return new IntegerConstant(); case ClassConstants.CONSTANT_Float: return new FloatConstant(); case ClassConstants.CONSTANT_Long: return new LongConstant(); case ClassConstants.CONSTANT_Double: return new DoubleConstant(); case ClassConstants.CONSTANT_String: return new StringConstant(); case ClassConstants.CONSTANT_Utf8: return new Utf8Constant(); case ClassConstants.CONSTANT_InvokeDynamic: return new InvokeDynamicConstant(); case ClassConstants.CONSTANT_MethodHandle: return new MethodHandleConstant(); case ClassConstants.CONSTANT_Fieldref: return new FieldrefConstant(); case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant(); case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant(); case ClassConstants.CONSTANT_Class: return new ClassConstant(); case ClassConstants.CONSTANT_MethodType: return new MethodTypeConstant(); case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant(); case ClassConstants.CONSTANT_Module: return new ModuleConstant(); case ClassConstants.CONSTANT_Package: return new PackageConstant(); default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool"); } }
(MethodHandleConstant) programClass.getConstant(bootstrapMethodInfo.u2methodHandleIndex); if (isLambdaMetaFactory(bootstrapMethodHandle.getClassName(clazz))) referencedInvokeDynamicConstant.getName(clazz), getMethodTypeConstant(programClass, bootstrapMethodInfo.u2methodArguments[0]).getType(clazz), invokedMethodHandle.getReferenceKind(), invokedMethodHandle.getClassName(clazz), invokedMethodHandle.getName(clazz), invokedMethodHandle.getType(clazz), referencedInvokedClass, referencedInvokedMethod); if (isAlternateFactoryMethod(bootstrapMethodHandle.getName(clazz)))
private Constant createConstant() { int u1tag = dataInput.readUnsignedByte(); switch (u1tag) { case ClassConstants.CONSTANT_Integer: return new IntegerConstant(); case ClassConstants.CONSTANT_Float: return new FloatConstant(); case ClassConstants.CONSTANT_Long: return new LongConstant(); case ClassConstants.CONSTANT_Double: return new DoubleConstant(); case ClassConstants.CONSTANT_String: return new StringConstant(); case ClassConstants.CONSTANT_Utf8: return new Utf8Constant(); case ClassConstants.CONSTANT_InvokeDynamic: return new InvokeDynamicConstant(); case ClassConstants.CONSTANT_MethodHandle: return new MethodHandleConstant(); case ClassConstants.CONSTANT_Fieldref: return new FieldrefConstant(); case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant(); case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant(); case ClassConstants.CONSTANT_Class: return new ClassConstant(); case ClassConstants.CONSTANT_MethodType: return new MethodTypeConstant(); case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant(); case ClassConstants.CONSTANT_Module: return new ModuleConstant(); case ClassConstants.CONSTANT_Package: return new PackageConstant(); default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool"); } }
(MethodHandleConstant) programClass.getConstant(bootstrapMethodInfo.u2methodHandleIndex); if (isLambdaMetaFactory(bootstrapMethodHandle.getClassName(clazz))) referencedInvokeDynamicConstant.getName(clazz), getMethodTypeConstant(programClass, bootstrapMethodInfo.u2methodArguments[0]).getType(clazz), invokedMethodHandle.getReferenceKind(), invokedMethodHandle.getClassName(clazz), invokedMethodHandle.getName(clazz), invokedMethodHandle.getType(clazz), referencedInvokedClass, referencedInvokedMethod); if (isAlternateFactoryMethod(bootstrapMethodHandle.getName(clazz)))
private Constant createConstant() { int u1tag = dataInput.readUnsignedByte(); switch (u1tag) { case ClassConstants.CONSTANT_Integer: return new IntegerConstant(); case ClassConstants.CONSTANT_Float: return new FloatConstant(); case ClassConstants.CONSTANT_Long: return new LongConstant(); case ClassConstants.CONSTANT_Double: return new DoubleConstant(); case ClassConstants.CONSTANT_String: return new StringConstant(); case ClassConstants.CONSTANT_Utf8: return new Utf8Constant(); case ClassConstants.CONSTANT_InvokeDynamic: return new InvokeDynamicConstant(); case ClassConstants.CONSTANT_MethodHandle: return new MethodHandleConstant(); case ClassConstants.CONSTANT_Fieldref: return new FieldrefConstant(); case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant(); case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant(); case ClassConstants.CONSTANT_Class: return new ClassConstant(); case ClassConstants.CONSTANT_MethodType: return new MethodTypeConstant(); case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant(); case ClassConstants.CONSTANT_Module: return new ModuleConstant(); case ClassConstants.CONSTANT_Package: return new PackageConstant(); default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool"); } }