java.lang.Object
org.glavo.classfile.impl.TransformingCodeBuilder
- All Implemented Interfaces:
Consumer<CodeElement>,ClassfileBuilder<CodeElement,,CodeBuilder> CodeBuilder,TerminalCodeBuilder
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.glavo.classfile.CodeBuilder
CodeBuilder.BlockCodeBuilder, CodeBuilder.CatchBuilder -
Constructor Summary
ConstructorsConstructorDescriptionTransformingCodeBuilder(CodeBuilder delegate, Consumer<CodeElement> consumer) -
Method Summary
Modifier and TypeMethodDescriptionintallocateLocal(TypeKind typeKind) Returns the local variable slot of a fresh local variable.Returns the constant pool builder associated with this builder.endLabel()Returns the label associated with the end of the current block.newLabel()Returns a fresh unbound label.original()intparameterSlot(int paramNo) Returns the local variable slot associated with the specified parameter.intReturns the local variable slot associated with the receiver.Returns the label associated with the beginning of the current block.with(CodeElement e) Integrate theClassfileElementinto the entity being built.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.glavo.classfile.ClassfileBuilder
accept, canWriteDirect, transformMethods inherited from interface org.glavo.classfile.CodeBuilder
aaload, aastore, aconst_null, aload, anewarray, anewarray, areturn, arraylength, arrayLoadInstruction, arrayStoreInstruction, astore, athrow, baload, bastore, bipush, block, branchInstruction, caload, castore, characterRange, checkcast, checkcast, constantInstruction, constantInstruction, convertInstruction, d2f, d2i, d2l, dadd, daload, dastore, dcmpg, dcmpl, dconst_0, dconst_1, ddiv, dload, dmul, dneg, drem, dreturn, dstore, dsub, dup, dup_x1, dup_x2, dup2, dup2_x1, dup2_x2, exceptionCatch, exceptionCatch, exceptionCatch, exceptionCatchAll, f2d, f2i, f2l, fadd, faload, fastore, fcmpg, fcmpl, fconst_0, fconst_1, fconst_2, fdiv, fieldInstruction, fieldInstruction, fload, fmul, fneg, frem, freturn, fstore, fsub, getfield, getfield, getstatic, getstatic, goto_, goto_w, i2b, i2c, i2d, i2f, i2l, i2s, iadd, iaload, iand, iastore, iconst_0, iconst_1, iconst_2, iconst_3, iconst_4, iconst_5, iconst_m1, idiv, if_acmpeq, if_acmpne, if_icmpeq, if_icmpge, if_icmpgt, if_icmple, if_icmplt, if_icmpne, if_nonnull, if_null, ifeq, ifge, ifgt, ifle, iflt, ifne, ifThen, ifThen, ifThenElse, ifThenElse, iinc, iload, imul, incrementInstruction, ineg, instanceof_, instanceof_, invokedynamic, invokedynamic, invokeDynamicInstruction, invokeDynamicInstruction, invokeInstruction, invokeInstruction, invokeinterface, invokeinterface, invokespecial, invokespecial, invokespecial, invokespecial, invokestatic, invokestatic, invokestatic, invokestatic, invokevirtual, invokevirtual, ior, irem, ireturn, ishl, ishr, istore, isub, iushr, ixor, l2d, l2f, l2i, labelBinding, ladd, laload, land, lastore, lcmp, lconst_0, lconst_1, ldc, ldiv, lineNumber, lload, lmul, lneg, loadInstruction, localVariable, localVariable, localVariableType, localVariableType, lookupswitch, lookupSwitchInstruction, lor, lrem, lreturn, lshl, lshr, lstore, lsub, lushr, lxor, monitorenter, monitorexit, monitorInstruction, multianewarray, multianewarray, new_, new_, newarray, newBoundLabel, newMultidimensionalArrayInstruction, newMultidimensionalArrayInstruction, newObjectInstruction, newObjectInstruction, newPrimitiveArrayInstruction, newReferenceArrayInstruction, newReferenceArrayInstruction, nop, nopInstruction, operatorInstruction, pop, pop2, putfield, putfield, putstatic, putstatic, return_, returnInstruction, saload, sastore, sipush, stackInstruction, storeInstruction, swap, tableswitch, tableswitch, tableSwitchInstruction, throwInstruction, transforming, trying, typeCheckInstruction, typeCheckInstruction
-
Constructor Details
-
TransformingCodeBuilder
-
-
Method Details
-
with
Description copied from interface:ClassfileBuilderIntegrate theClassfileElementinto the entity being built.- Specified by:
within interfaceClassfileBuilder<CodeElement,CodeBuilder> - Parameters:
e- the element- Returns:
- this builder
-
original
Description copied from interface:CodeBuilderReturns theCodeModelrepresenting the method body being transformed, if this code builder represents the transformation of someCodeModel.- Specified by:
originalin interfaceCodeBuilder- Returns:
- the
CodeModelrepresenting the method body being transformed, if this code builder represents the transformation of someCodeModel
-
newLabel
Description copied from interface:CodeBuilderReturns a fresh unbound label.- Specified by:
newLabelin interfaceCodeBuilder- Returns:
- a fresh unbound label
-
startLabel
Description copied from interface:CodeBuilderReturns the label associated with the beginning of the current block. If the current CodeBuilder is not a "block" builder, such as those provided byCodeBuilder.block(Consumer)orCodeBuilder.ifThenElse(Consumer, Consumer), the current block will be the entire method body.- Specified by:
startLabelin interfaceCodeBuilder- Returns:
- the label associated with the beginning of the current block
-
endLabel
Description copied from interface:CodeBuilderReturns the label associated with the end of the current block. If the current CodeBuilder is not a "block" builder, such as those provided byCodeBuilder.block(Consumer)orCodeBuilder.ifThenElse(Consumer, Consumer), the current block will be the entire method body.- Specified by:
endLabelin interfaceCodeBuilder- Returns:
- the label associated with the end of the current block
-
receiverSlot
public int receiverSlot()Description copied from interface:CodeBuilderReturns the local variable slot associated with the receiver..- Specified by:
receiverSlotin interfaceCodeBuilder- Returns:
- the local variable slot associated with the receiver
-
parameterSlot
public int parameterSlot(int paramNo) Description copied from interface:CodeBuilderReturns the local variable slot associated with the specified parameter.. The returned value is adjusted for the receiver slot (if the method is an instance method) and for the requirement thatlonganddoublevalues require two slots.- Specified by:
parameterSlotin interfaceCodeBuilder- Parameters:
paramNo- the index of the parameter- Returns:
- the local variable slot associated with the specified parameter
-
allocateLocal
Description copied from interface:CodeBuilderReturns the local variable slot of a fresh local variable. This method makes reasonable efforts to determine which slots are in use and which are not. When transforming a method, fresh locals begin at themaxLocalsof the original method. For a method being built directly, fresh locals begin after the last parameter slot.If the current code builder is a "block" code builder provided by
CodeBuilder.block(Consumer),CodeBuilder.ifThen(Consumer), orCodeBuilder.ifThenElse(Consumer, Consumer), at the end of the block, locals are reset to their value at the beginning of the block.- Specified by:
allocateLocalin interfaceCodeBuilder- Parameters:
typeKind- the type of the local variable- Returns:
- the local variable slot of a fresh local variable
-
constantPool
Description copied from interface:ClassfileBuilderReturns the constant pool builder associated with this builder.- Specified by:
constantPoolin interfaceClassfileBuilder<CodeElement,CodeBuilder> - Returns:
- the constant pool builder associated with this builder
-