- All Superinterfaces:
ClassfileTransform<CodeTransform,,CodeElement, CodeBuilder> CodeTransform
- All Known Implementing Classes:
CodeRelabeler.CodeRelabelerImpl
A code relabeler is a
CodeTransform replacing all occurrences
of Label in the transformed code with new instances.
All LabelTarget instructions are adjusted accordingly.
Relabeled code graph is identical to the original.
Primary purpose of CodeRelabeler is for repeated injections of the same code blocks.
Repeated injection of the same code block must be relabeled, so each instance of
Label is bound in the target bytecode exactly once.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.glavo.classfile.ClassfileTransform
ClassfileTransform.ResolvedTransform<E extends ClassfileElement> -
Field Summary
Fields inherited from interface org.glavo.classfile.CodeTransform
ACCEPT_ALL -
Method Summary
Modifier and TypeMethodDescriptionstatic CodeRelabelerof()Creates new instance of CodeRelabelerstatic CodeRelabelerof(BiFunction<Label, CodeBuilder, Label> mapFunction) Creates new instance of CodeRelabeler using providedBiFunctionto re-label the code.static CodeRelabelerCreates new instance of CodeRelabeler storing the label mapping into the provided maprelabel(Label label, CodeBuilder codeBuilder) Access method to internal re-labeling function.Methods inherited from interface org.glavo.classfile.ClassfileTransform
accept, atEnd, atStartMethods inherited from interface org.glavo.classfile.CodeTransform
andThen, resolve
-
Method Details
-
of
Creates new instance of CodeRelabeler- Returns:
- new instance of CodeRelabeler
-
of
Creates new instance of CodeRelabeler storing the label mapping into the provided map- Parameters:
map- label map actively used for relabeling- Returns:
- new instance of CodeRelabeler
-
of
Creates new instance of CodeRelabeler using providedBiFunctionto re-label the code.- Parameters:
mapFunction-- Returns:
-
relabel
Access method to internal re-labeling function.- Parameters:
label- source labelcodeBuilder- builder to create new labels- Returns:
- target label
-