APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.classfile.impl

public final Class StackCounter

extends Object
Class Inheritance
Imports
java.lang.classfile.Attributes, .TypeKind, java.lang.classfile.attribute.StackMapFrameInfo, .StackMapTableAttribute, java.lang.classfile.constantpool.ConstantDynamicEntry, .DynamicConstantPoolEntry, .MemberRefEntry, java.lang.constant.ClassDesc, .MethodTypeDesc, java.util.ArrayDeque, .BitSet, .List, .Queue, java.util.stream.Collectors

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record

Field Summary

Modifier and TypeField and Description
private final RawBytecodeHelper
private final SplitConstantPool
private final boolean
private int
private int
private final MethodTypeDesc
private final String
private int
private int
private final Queue<StackCounter.Target>
private final ClassDesc
private final BitSet

Constructor Summary

AccessConstructor and Description
public
StackCounter(LabelContext labelContext, StackMapTableAttribute smta, ClassDesc thisClass, String methodName, MethodTypeDesc methodDesc, boolean isStatic, RawBytecodeHelper.CodeRange bytecode, SplitConstantPool cp, List<AbstractPseudoInstruction.ExceptionCatchImpl> handlers)

Method Summary

Modifier and TypeMethod and Description
private void
addStackSlot(int delta)

private void
ensureLocalSlot(int index)

private IllegalArgumentException
private void
jump(int targetBci)

public int

Returns:

maximum number of the locals required
maxLocals
()

Calculated maximum number of the locals required

public int

Returns:

maximum stack size required
maxStack
()

Calculated maximum stack size required

private boolean
next()

pack-priv static StackCounter
private void
processLdc(int index)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bcsback to summary
private final RawBytecodeHelper bcs
cpback to summary
private final SplitConstantPool cp
isStaticback to summary
private final boolean isStatic
maxLocalsback to summary
private int maxLocals
maxStackback to summary
private int maxStack
methodDescback to summary
private final MethodTypeDesc methodDesc
methodNameback to summary
private final String methodName
retsback to summary
private int rets
stackback to summary
private int stack
targetsback to summary
private final Queue<StackCounter.Target> targets
thisClassback to summary
private final ClassDesc thisClass
visitedback to summary
private final BitSet visited

Constructor Detail

StackCounterback to summary
public StackCounter(LabelContext labelContext, StackMapTableAttribute smta, ClassDesc thisClass, String methodName, MethodTypeDesc methodDesc, boolean isStatic, RawBytecodeHelper.CodeRange bytecode, SplitConstantPool cp, List<AbstractPseudoInstruction.ExceptionCatchImpl> handlers)

Method Detail

addStackSlotback to summary
private void addStackSlot(int delta)
ensureLocalSlotback to summary
private void ensureLocalSlot(int index)
errorback to summary
private IllegalArgumentException error(String msg)
jumpback to summary
private void jump(int targetBci)
maxLocalsback to summary
public int maxLocals()

Calculated maximum number of the locals required

Returns:int

maximum number of the locals required

maxStackback to summary
public int maxStack()

Calculated maximum stack size required

Returns:int

maximum stack size required

nextback to summary
private boolean next()
ofback to summary
pack-priv static StackCounter of(DirectCodeBuilder dcb, BufWriterImpl buf)
processLdcback to summary
private void processLdc(int index)
jdk.internal.classfile.impl back to summary

private final Record StackCounter.Target

extends Record
Class Inheritance
Record Components
bci:int 
stack:int 

Field Summary

Modifier and TypeField and Description
private final int
bci

Record Component accessed by bci().

private final int
stack

Record Component accessed by stack().

Constructor Summary

AccessConstructor and Description
private
Target(int bci, int stack)

Method Summary

Modifier and TypeMethod and Description
public int
bci()

Record Component getter of bci.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public int
stack()

Record Component getter of stack.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

bciback to summary
private final int bci

Record Component accessed by bci().

stackback to summary
private final int stack

Record Component accessed by stack().

Constructor Detail

Targetback to summary
private Target(int bci, int stack)

Method Detail

bciback to summary
public int bci()

Record Component getter of bci.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

stackback to summary
public int stack()

Record Component getter of stack.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.