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

public final Class CodeStackTrackerImpl

extends Object
implements CodeStackTracker
Class Inheritance
All Implemented Interfaces
jdk.internal.classfile.components.CodeStackTracker, java.lang.classfile.CodeTransform, java.lang.classfile.ClassFileTransform
Imports
java.lang.classfile.CodeBuilder, .CodeElement, .Label, .Opcode, .TypeKind, jdk.internal.classfile.components.CodeStackTracker, java.lang.classfile.instruction.*, java.util.*, java.util.function.Consumer

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
private class

Field Summary

Modifier and TypeField and Description
private final Map<Label, CodeStackTrackerImpl.Stack>
private Integer
private CodeStackTrackerImpl.Stack

Constructor Summary

AccessConstructor and Description
public
CodeStackTrackerImpl(TypeKind... initialStack)

Method Summary

Modifier and TypeMethod and Description
public void
accept(CodeBuilder cb, CodeElement el)

Implements java.lang.classfile.ClassFileTransform.accept.

Transform an element by taking the appropriate actions on the builder.

private CodeStackTrackerImpl.Stack
fork()

public Optional<Integer>
private void
pop(int i)

private void
push(TypeKind type)

public Optional<Collection<TypeKind>>
stack()

Implements jdk.internal.classfile.components.CodeStackTracker.stack.

Returns Collection of TypeKind representing current stack.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private final Map<Label, CodeStackTrackerImpl.Stack> map
maxSizeback to summary
private Integer maxSize
stackback to summary
private CodeStackTrackerImpl.Stack stack

Constructor Detail

CodeStackTrackerImplback to summary
public CodeStackTrackerImpl(TypeKind... initialStack)

Method Detail

acceptback to summary
public void accept(CodeBuilder cb, CodeElement el)

Implements java.lang.classfile.ClassFileTransform.accept.

Doc from java.lang.classfile.ClassFileTransform.accept.

Transform an element by taking the appropriate actions on the builder. Used when transforming a classfile entity (class, method, field, method body.) If no transformation is desired, the element can be presented to B#with(ClassFileElement). If the element is to be dropped, no action is required.

This method is called by the Class-File API. Users should never call this method.

Annotations
@Override
forkback to summary
private CodeStackTrackerImpl.Stack fork()
maxStackSizeback to summary
public Optional<Integer> maxStackSize()

Implements jdk.internal.classfile.components.CodeStackTracker.maxStackSize.

Doc from jdk.internal.classfile.components.CodeStackTracker.maxStackSize.

Returns tracked max stack size. Returns an empty Optional when max stack size tracking has been lost.

Max stack size tracking is permanently lost when a stack instruction appears and the actual stack content is unknown.

Annotations
@Override
popback to summary
private void pop(int i)
pushback to summary
private void push(TypeKind type)
stackback to summary
public Optional<Collection<TypeKind>> stack()

Implements jdk.internal.classfile.components.CodeStackTracker.stack.

Doc from jdk.internal.classfile.components.CodeStackTracker.stack.

Returns Collection of TypeKind representing current stack. Returns an empty Optional when the Stack content is unknown (right after xRETURN, ATHROW, GOTO, GOTO_W, LOOKUPSWITCH, TABLESWITCH instructions).

Temporary unknown stack content can be recovered by binding of a Label used as target of a branch instruction from existing code with known stack (forward branch target), or by binding of a Label defining an exception handler (exception handler code start).

Annotations
@Override
withStackback to summary
private void withStack(Consumer<CodeStackTrackerImpl.Stack> c)
jdk.internal.classfile.impl back to summary

private final Record CodeStackTrackerImpl.Item

extends Record
Class Inheritance
Record Components
type:TypeKind 
next:CodeStackTrackerImpl.Item 

Field Summary

Modifier and TypeField and Description
private final CodeStackTrackerImpl.Item
next

Record Component accessed by next().

private final TypeKind
type

Record Component accessed by type().

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
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 CodeStackTrackerImpl.Item
next()

Record Component getter of next.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public TypeKind
type()

Record Component getter of type.

Field Detail

nextback to summary
private final CodeStackTrackerImpl.Item next

Record Component accessed by next().

typeback to summary
private final TypeKind type

Record Component accessed by type().

Constructor Detail

Itemback to summary
private Item(TypeKind type, CodeStackTrackerImpl.Item next)

Method Detail

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.

nextback to summary
public CodeStackTrackerImpl.Item next()

Record Component getter of next.

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.

typeback to summary
public TypeKind type()

Record Component getter of type.

jdk.internal.classfile.impl back to summary

private final Class CodeStackTrackerImpl.Stack

extends AbstractCollection<TypeKind>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int
private CodeStackTrackerImpl.Item

Constructor Summary

AccessConstructor and Description
pack-priv
Stack(CodeStackTrackerImpl.Item top, int count, int realSize)

Method Summary

Modifier and TypeMethod and Description
public Iterator<TypeKind>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Returns an iterator over the elements contained in this collection.

private TypeKind
pop()

private void
push(TypeKind type)

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Returns the number of elements in this collection.

Inherited from java.util.AbstractCollection:
addaddAllclearcontainscontainsAllisEmptyremoveremoveAllretainAlltoArraytoArraytoString

Field Detail

countback to summary
private int count
realSizeback to summary
private int realSize
topback to summary
private CodeStackTrackerImpl.Item top

Constructor Detail

Stackback to summary
pack-priv Stack(CodeStackTrackerImpl.Item top, int count, int realSize)

Method Detail

iteratorback to summary
public Iterator<TypeKind> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Doc from java.util.AbstractCollection.iterator.

Returns an iterator over the elements contained in this collection.

Annotations
@Override
popback to summary
private TypeKind pop()
pushback to summary
private void push(TypeKind type)
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Doc from java.util.Collection.size.

Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Annotations
@Override