class CallGraph[BT <: BTypes] extends AnyRef
- Alphabetic
- By Inheritance
- CallGraph
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new CallGraph(btypes: BT)
Type Members
-
sealed
trait
ArgInfo
extends AnyRef
Information about invocation arguments, obtained through data flow analysis of the callsite method.
-
final
case class
Callee
(callee: MethodNode, calleeDeclarationClass: BT.ClassBType, safeToInline: Boolean, safeToRewrite: Boolean, canInlineFromSource: Boolean, annotatedInline: Boolean, annotatedNoInline: Boolean, samParamTypes: IntMap[BT.ClassBType], calleeInfoWarning: Option[CalleeInfoWarning]) extends Product with Serializable
A callee in the call graph.
A callee in the call graph.
- callee
The callee, as it appears in the invocation instruction. For virtual calls, an override of the callee might be invoked. Also, the callee can be abstract.
- calleeDeclarationClass
The class in which the callee is declared
- safeToInline
True if the callee can be safely inlined: it cannot be overridden, and the inliner settings (project / global) allow inlining it.
- safeToRewrite
True if the callee is the interface method of a concrete trait method that can be safely re-written to the static implementation method.
- annotatedInline
True if the callee is annotated @inline
- annotatedNoInline
True if the callee is annotated @noinline
- samParamTypes
A map from parameter positions to SAM parameter types
- calleeInfoWarning
An inliner warning if some information was not available while gathering the information about this callee.
-
final
case class
Callsite
(callsiteInstruction: MethodInsnNode, callsiteMethod: MethodNode, callsiteClass: BT.ClassBType, callee: Either[OptimizerWarning, Callee], argInfos: IntMap[ArgInfo], callsiteStackHeight: Int, receiverKnownNotNull: Boolean, callsitePosition: Position, annotatedInline: Boolean, annotatedNoInline: Boolean) extends Product with Serializable
A callsite in the call graph.
A callsite in the call graph.
- callsiteInstruction
The invocation instruction
- callsiteMethod
The method containing the callsite
- callsiteClass
The class containing the callsite
- callee
The callee, as it appears in the invocation instruction. For virtual calls, an override of the callee might be invoked. Also, the callee can be abstract. Contains a warning message if the callee MethodNode cannot be found in the bytecode repository.
- argInfos
Information about the invocation receiver and arguments
- callsiteStackHeight
The stack height at the callsite, required by the inliner
- callsitePosition
The source position of the callsite, used for inliner warnings.
- final case class ClonedCallsite (callsite: Callsite, clonedWhenInlining: Callsite) extends Product with Serializable
-
final
case class
ClosureInstantiation
(lambdaMetaFactoryCall: LambdaMetaFactoryCall, ownerMethod: MethodNode, ownerClass: BT.ClassBType, capturedArgInfos: IntMap[ArgInfo]) extends Product with Serializable
Metadata about a closure instantiation, stored in the call graph
Metadata about a closure instantiation, stored in the call graph
- lambdaMetaFactoryCall
the InvokeDynamic instruction
- ownerMethod
the method where the closure is allocated
- ownerClass
the class containing the above method
- capturedArgInfos
information about captured arguments. Used for updating the call graph when re-writing a closure invocation to the body method.
- final case class ForwardedParam (index: Int) extends ArgInfo with Product with Serializable
- final case class LambdaMetaFactoryCall (indy: InvokeDynamicInsnNode, samMethodType: Type, implMethod: Handle, instantiatedMethodType: Type) extends Product with Serializable
Value Members
-
final
def
!=(arg0: Any): Boolean
Test two objects for inequality.
Test two objects for inequality.
- returns
true
if !(this == that), false otherwise.
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
Equivalent to
x.hashCode
except for boxed numeric types andnull
.Equivalent to
x.hashCode
except for boxed numeric types andnull
. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. Fornull
returns a hashcode wherenull.hashCode
throws aNullPointerException
.- returns
a hash value consistent with ==
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (CallGraph[BT], B)
-
final
def
==(arg0: Any): Boolean
The expression
x == that
is equivalent toif (x eq null) that eq null else x.equals(that)
.The expression
x == that
is equivalent toif (x eq null) that eq null else x.equals(that)
.- returns
true
if the receiver object is equivalent to the argument;false
otherwise.
- Definition Classes
- AnyRef → Any
- def addCallsite(callsite: Callsite): Unit
- def addClass(classNode: ClassNode): Unit
- def addClosureInstantiation(closureInit: ClosureInstantiation): Unit
- def addIfMissing(methodNode: MethodNode, definingClass: BT.ClassBType): Unit
- def addMethod(methodNode: MethodNode, definingClass: BT.ClassBType): Unit
-
final
def
asInstanceOf[T0]: T0
Cast the receiver object to be of type
T0
.Cast the receiver object to be of type
T0
.Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression
1.asInstanceOf[String]
will throw aClassCastException
at runtime, while the expressionList(1).asInstanceOf[List[String]]
will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.- returns
the receiver object.
- Definition Classes
- Any
- Exceptions thrown
ClassCastException
if the receiver object is not an instance of the erasure of typeT0
.
- val btypes: BT
-
val
callsites: Map[MethodNode, Map[MethodInsnNode, Callsite]]
The call graph contains the callsites in the program being compiled.
The call graph contains the callsites in the program being compiled.
Indexing the call graph by the containing MethodNode and the invocation MethodInsnNode allows finding callsites efficiently. For example, an inlining heuristic might want to know all callsites withing a callee method.
Note that the call graph is not guaranteed to be complete: callsites may be missing. In particular, if a method is very large, all of its callsites might not be in the hash map. The reason is that adding a method to the call graph requires running an ASM analyzer, which can be too slow.
Note that call graph entries (Callsite instances) keep a reference to the invocation MethodInsnNode, which keeps all AbstractInsnNodes of the method reachable. Adding classes from the classpath to the call graph (in addition to classes being compiled) may prevent method instruction nodes from being GCd. The ByteCodeRepository has a fixed size cache for parsed ClassNodes - keeping all ClassNodes alive consumed too much memory. The call graph is less problematic because only methods being called are kept alive, not entire classes. But we should keep an eye on this.
- def capturedSamTypes(lmf: LambdaMetaFactoryCall): IntMap[BT.ClassBType]
-
def
clone(): AnyRef
Create a copy of the receiver object.
Create a copy of the receiver object.
The default implementation of the
clone
method is platform dependent.- returns
a copy of the receiver object.
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- Note
not specified by SLS as a member of AnyRef
-
val
closureInstantiations: Map[MethodNode, Map[InvokeDynamicInsnNode, ClosureInstantiation]]
Closure instantiations in the program being compiled.
Closure instantiations in the program being compiled.
Indexing closure instantiations by the containing MethodNode is beneficial for the closure optimizer: finding callsites to re-write requires running a producers-consumers analysis on the method. Here the closure instantiations are already grouped by method.
- def computeArgInfos(callee: Either[OptimizerWarning, Callee], callsiteInsn: MethodInsnNode, prodCons: ⇒ ProdConsAnalyzer): IntMap[ArgInfo]
- def computeCapturedArgInfos(lmf: LambdaMetaFactoryCall, prodCons: ⇒ ProdConsAnalyzer): IntMap[ArgInfo]
- def containsCallsite(callsite: Callsite): Boolean
- def ensuring(cond: (CallGraph[BT]) ⇒ Boolean, msg: ⇒ Any): CallGraph[BT]
- def ensuring(cond: (CallGraph[BT]) ⇒ Boolean): CallGraph[BT]
- def ensuring(cond: Boolean, msg: ⇒ Any): CallGraph[BT]
- def ensuring(cond: Boolean): CallGraph[BT]
-
final
def
eq(arg0: AnyRef): Boolean
Tests whether the argument (
that
) is a reference to the receiver object (this
).Tests whether the argument (
that
) is a reference to the receiver object (this
).The
eq
method implements an equivalence relation on non-null instances ofAnyRef
, and has three additional properties:- It is consistent: for any non-null instances
x
andy
of typeAnyRef
, multiple invocations ofx.eq(y)
consistently returnstrue
or consistently returnsfalse
. - For any non-null instance
x
of typeAnyRef
,x.eq(null)
andnull.eq(x)
returnsfalse
. null.eq(null)
returnstrue
.
When overriding the
equals
orhashCode
methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2
), they should be equal to each other (o1 == o2
) and they should hash to the same value (o1.hashCode == o2.hashCode
).- returns
true
if the argument is a reference to the receiver object;false
otherwise.
- Definition Classes
- AnyRef
- It is consistent: for any non-null instances
-
def
equals(arg0: Any): Boolean
The equality method for reference types.
-
def
finalize(): Unit
Called by the garbage collector on the receiver object when there are no more references to the object.
Called by the garbage collector on the receiver object when there are no more references to the object.
The details of when and if the
finalize
method is invoked, as well as the interaction betweenfinalize
and non-local returns and exceptions, are all platform dependent.- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- Note
not specified by SLS as a member of AnyRef
- def formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
Returns the runtime class representation of the object.
Returns the runtime class representation of the object.
- returns
a class object corresponding to the runtime type of the receiver.
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
The hashCode method for reference types.
-
final
def
isInstanceOf[T0]: Boolean
Test whether the dynamic type of the receiver object is
T0
.Test whether the dynamic type of the receiver object is
T0
.Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression
1.isInstanceOf[String]
will returnfalse
, while the expressionList(1).isInstanceOf[List[String]]
will returntrue
. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.- returns
true
if the receiver object is an instance of erasure of typeT0
;false
otherwise.
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
Equivalent to
!(this eq that)
.Equivalent to
!(this eq that)
.- returns
true
if the argument is not a reference to the receiver object;false
otherwise.
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up a single thread that is waiting on the receiver object's monitor.
- Definition Classes
- AnyRef
- Note
not specified by SLS as a member of AnyRef
-
final
def
notifyAll(): Unit
Wakes up all threads that are waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
- Definition Classes
- AnyRef
- Note
not specified by SLS as a member of AnyRef
- def removeCallsite(invocation: MethodInsnNode, methodNode: MethodNode): Option[Callsite]
- def removeClosureInstantiation(indy: InvokeDynamicInsnNode, methodNode: MethodNode): Option[ClosureInstantiation]
- def samParamTypes(methodNode: MethodNode, receiverType: BT.ClassBType): IntMap[BT.ClassBType]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
Creates a String representation of this object.
Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.
- returns
a String representation of the object.
- 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): (CallGraph[BT], B)
- object FunctionLiteral extends ArgInfo with Product with Serializable
- object LambdaMetaFactoryCall extends Serializable
The Scala compiler API.
The following resources are useful for Scala plugin/compiler development: