class BackendUtils[BT <: BTypes] extends AnyRef
This component hosts tools and utilities used in the backend that require access to a BTypes
instance.
One example is the AsmAnalyzer class, which runs computeMaxLocalsMaxStack
on the methodNode to
be analyzed. This method in turn lives inside the BTypes assembly because it queries the per-run
cache maxLocalsMaxStackComputed
defined in there.
- Source
- BackendUtils.scala
- Alphabetic
- By Inheritance
- BackendUtils
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new BackendUtils(btypes: BT)
Type Members
-
class
AsmAnalyzer
[V <: Value] extends AnyRef
A wrapper to make ASM's Analyzer a bit easier to use.
- class NonLubbingTypeFlowAnalyzer extends AsmAnalyzer[BasicValue]
- class ProdConsAnalyzer extends AsmAnalyzer[SourceValue] with ProdConsAnalyzerImpl
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to any2stringadd[BackendUtils[BT]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (BackendUtils[BT], B)
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to ArrowAssoc[BackendUtils[BT]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addLambdaDeserialize(classNode: ClassNode, implMethods: Iterable[Handle]): Unit
Add: private static Object $deserializeLambda$(SerializedLambda l) { return indy[scala.runtime.LambdaDeserialize.bootstrap](l) }
Add: private static Object $deserializeLambda$(SerializedLambda l) { return indy[scala.runtime.LambdaDeserialize.bootstrap](l) }
We use invokedynamic here to enable caching within the deserializer without needing to host a static field in the enclosing class. This allows us to add this method to interfaces that define lambdas in default methods.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val btypes: BT
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
cloneInstructions(methodNode: MethodNode, labelMap: Map[LabelNode, LabelNode], keepLineNumbers: Boolean): (InsnList, Map[AbstractInsnNode, AbstractInsnNode], List[Handle])
Clone the instructions in
methodNode
into a new InsnList, mapping labels according to thelabelMap
.Clone the instructions in
methodNode
into a new InsnList, mapping labels according to thelabelMap
. Returns the new instruction list and a map from old to new instructions, and a list of lambda implementation methods references by invokedynamic[LambdaMetafactory] for a serializable SAM types. -
def
collectNestedClasses(classNode: ClassNode): List[BT.ClassBType]
Visit the class node and collect all referenced nested classes.
-
def
computeMaxLocalsMaxStack(method: MethodNode): Unit
In order to run an Analyzer, the maxLocals / maxStack fields need to be available.
In order to run an Analyzer, the maxLocals / maxStack fields need to be available. The ASM framework only computes these values during bytecode generation.
NOTE 1: as explained in the
analysis
package object, the maxStack value used by the Analyzer may be smaller than the correct maxStack value in the classfile (Analyzers only use a single slot for long / double values). The maxStack computed here are correct for running an analyzer, but not for writing in the classfile. We let the ClassWriter recompute max's.NOTE 2: the maxStack value computed here may be larger than the smallest correct value that would allow running an analyzer, see
InstructionStackEffect.forAsmAnalysis
andInstructionStackEffect.maxStackGrowth
.NOTE 3: the implementation doesn't look at instructions that cannot be reached, it computes the max local / stack size in the reachable code. These max's work just fine for running an Analyzer: its implementation also skips over unreachable code in the same way.
-
def
ensuring(cond: (BackendUtils[BT]) ⇒ Boolean, msg: ⇒ Any): BackendUtils[BT]
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to Ensuring[BackendUtils[BT]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (BackendUtils[BT]) ⇒ Boolean): BackendUtils[BT]
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to Ensuring[BackendUtils[BT]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): BackendUtils[BT]
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to Ensuring[BackendUtils[BT]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): BackendUtils[BT]
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to Ensuring[BackendUtils[BT]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to StringFormat[BackendUtils[BT]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
- def getBoxedUnit: FieldInsnNode
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- def getScalaBox(primitiveType: Type): MethodInsnNode
- def getScalaUnbox(primitiveType: Type): MethodInsnNode
- def hasAdaptedImplMethod(closureInit: ClosureInstantiation): Boolean
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- def isBoxedUnit(insn: AbstractInsnNode): Boolean
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isJavaBox(insn: MethodInsnNode): Boolean
- def isJavaUnbox(insn: MethodInsnNode): Boolean
- def isModuleLoad(insn: AbstractInsnNode, moduleName: InternalName): Boolean
- def isNewForSideEffectFreeConstructor(insn: AbstractInsnNode): Boolean
- def isNonNullMethodInvocation(mi: MethodInsnNode): Boolean
- def isPredefAutoBox(insn: MethodInsnNode): Boolean
- def isPredefAutoUnbox(insn: MethodInsnNode): Boolean
- def isPredefLoad(insn: AbstractInsnNode): Boolean
- def isPrimitiveBoxConstructor(insn: MethodInsnNode): Boolean
- def isRefCreate(insn: MethodInsnNode): Boolean
- def isRefZero(insn: MethodInsnNode): Boolean
- def isRuntimeRefConstructor(insn: MethodInsnNode): Boolean
- def isScalaBox(insn: MethodInsnNode): Boolean
- def isScalaUnbox(insn: MethodInsnNode): Boolean
- def isSideEffectFreeCall(insn: MethodInsnNode): Boolean
- def isSideEffectFreeConstructorCall(insn: MethodInsnNode): Boolean
- def isTupleConstructor(insn: MethodInsnNode): Boolean
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- def runtimeRefClassBoxedType(refClass: InternalName): Type
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
→[B](y: B): (BackendUtils[BT], B)
- Implicit
- This member is added by an implicit conversion from BackendUtils[BT] to ArrowAssoc[BackendUtils[BT]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
-
object
AsmAnalyzer
See the doc comment on package object
analysis
for a discussion on performance.
The Scala compiler and reflection APIs.