java.lang.Object
org.glavo.classfile.impl.NonterminalCodeBuilder
org.glavo.classfile.impl.BlockCodeBuilderImpl
- All Implemented Interfaces:
Consumer<CodeElement>,ClassFileBuilder<CodeElement,,CodeBuilder> CodeBuilder,CodeBuilder.BlockCodeBuilder
public final class BlockCodeBuilderImpl
extends NonterminalCodeBuilder
implements CodeBuilder.BlockCodeBuilder
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.glavo.classfile.CodeBuilder
CodeBuilder.BlockCodeBuilder, CodeBuilder.CatchBuilder -
Field Summary
Fields inherited from class org.glavo.classfile.impl.NonterminalCodeBuilder
parent, terminal -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintallocateLocal(TypeKind typeKind) Returns the local variable slot of a fresh local variable.Returns the label locating where control is passed back to the parent block..voidend()endLabel()Returns the label associated with the end of the current block.booleanisEmpty()booleanvoidstart()Returns the label associated with the beginning of the current block.with(CodeElement element) Integrate theClassFileElementinto the entity being built.Methods inherited from class org.glavo.classfile.impl.NonterminalCodeBuilder
constantPool, newLabel, original, parameterSlot, receiverSlotMethods 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, constantPool, 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, 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, newLabel, newMultidimensionalArrayInstruction, newMultidimensionalArrayInstruction, newObjectInstruction, newObjectInstruction, newPrimitiveArrayInstruction, newReferenceArrayInstruction, newReferenceArrayInstruction, nop, nopInstruction, operatorInstruction, original, parameterSlot, pop, pop2, putfield, putfield, putstatic, putstatic, receiverSlot, return_, returnInstruction, saload, sastore, sipush, stackInstruction, storeInstruction, swap, tableswitch, tableswitch, tableSwitchInstruction, throwInstruction, transforming, trying, typeCheckInstruction, typeCheckInstruction
-
Constructor Details
-
BlockCodeBuilderImpl
-
-
Method Details
-
start
public void start() -
end
public void end() -
reachable
public boolean reachable() -
isEmpty
public boolean isEmpty() -
with
Description copied from interface:ClassFileBuilderIntegrate theClassFileElementinto the entity being built.- Specified by:
within interfaceClassFileBuilder<CodeElement,CodeBuilder> - Parameters:
element- the element- Returns:
- this builder
-
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
-
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
-
breakLabel
Description copied from interface:CodeBuilder.BlockCodeBuilderReturns the label locating where control is passed back to the parent block.. A branch to this label "break"'s out of the current block.If an instruction occurring immediately after the built block's last instruction would be reachable from that last instruction, then a goto instruction targeting the "break" label is appended to the built block.
- Specified by:
breakLabelin interfaceCodeBuilder.BlockCodeBuilder- Returns:
- the label locating where control is passed back to the parent block.
-