@@ -132,17 +132,9 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
132132 (declarationClassNode, source) <- byteCodeRepository.classNodeAndSource(declarationClass): Either [OptimizerWarning , (ClassNode , Source )]
133133 } yield {
134134 val declarationClassBType = classBTypeFromClassNode(declarationClassNode)
135- val CallsiteInfo (safeToInline, safeToRewrite, canInlineFromSource, annotatedInline, annotatedNoInline, samParamTypes, warning) = analyzeCallsite(method, declarationClassBType, call.owner, source)
136- Callee (
137- callee = method,
138- calleeDeclarationClass = declarationClassBType,
139- safeToInline = safeToInline,
140- safeToRewrite = false ,
141- canInlineFromSource = canInlineFromSource,
142- annotatedInline = annotatedInline,
143- annotatedNoInline = annotatedNoInline,
144- samParamTypes = samParamTypes,
145- calleeInfoWarning = warning)
135+ val info = analyzeCallsite(method, declarationClassBType, call.owner, source)
136+ import info ._
137+ Callee (callee = method, calleeDeclarationClass = declarationClassBType, safeToInline = safeToInline, canInlineFromSource = canInlineFromSource, annotatedInline = annotatedInline, annotatedNoInline = annotatedNoInline, samParamTypes = samParamTypes, calleeInfoWarning = warning)
146138 }
147139
148140 val argInfos = computeArgInfos(callee, call, prodCons)
@@ -256,7 +248,7 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
256248 /**
257249 * Just a named tuple used as return type of `analyzeCallsite`.
258250 */
259- private case class CallsiteInfo (safeToInline : Boolean , safeToRewrite : Boolean , canInlineFromSource : Boolean ,
251+ private case class CallsiteInfo (safeToInline : Boolean , canInlineFromSource : Boolean ,
260252 annotatedInline : Boolean , annotatedNoInline : Boolean ,
261253 samParamTypes : IntMap [ClassBType ],
262254 warning : Option [CalleeInfoWarning ])
@@ -299,16 +291,12 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
299291 receiverType.info.orThrow.inlineInfo.isEffectivelyFinal // (1)
300292 }
301293
302- val isRewritableTraitCall = false
303-
304294 val warning = calleeDeclarationClassBType.info.orThrow.inlineInfo.warning.map(
305295 MethodInlineInfoIncomplete (calleeDeclarationClassBType.internalName, calleeMethodNode.name, calleeMethodNode.desc, _))
306296
307297 // (1) For invocations of final trait methods, the callee isStaticallyResolved but also
308298 // abstract. Such a callee is not safe to inline - it needs to be re-written to the
309299 // static impl method first (safeToRewrite).
310- // (2) Final trait methods can be rewritten from the interface to the static implementation
311- // method to enable inlining.
312300 CallsiteInfo (
313301 safeToInline =
314302 canInlineFromSource &&
@@ -317,7 +305,6 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
317305 ! BytecodeUtils .isConstructor(calleeMethodNode) &&
318306 ! BytecodeUtils .isNativeMethod(calleeMethodNode) &&
319307 ! BytecodeUtils .hasCallerSensitiveAnnotation(calleeMethodNode),
320- safeToRewrite = canInlineFromSource && isRewritableTraitCall, // (2)
321308 canInlineFromSource = canInlineFromSource,
322309 annotatedInline = methodInlineInfo.annotatedInline,
323310 annotatedNoInline = methodInlineInfo.annotatedNoInline,
@@ -326,12 +313,12 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
326313
327314 case None =>
328315 val warning = MethodInlineInfoMissing (calleeDeclarationClassBType.internalName, calleeMethodNode.name, calleeMethodNode.desc, calleeDeclarationClassBType.info.orThrow.inlineInfo.warning)
329- CallsiteInfo (false , false , false , false , false , IntMap .empty, Some (warning))
316+ CallsiteInfo (false , false , false , false , IntMap .empty, Some (warning))
330317 }
331318 } catch {
332319 case Invalid (noInfo : NoClassBTypeInfo ) =>
333320 val warning = MethodInlineInfoError (calleeDeclarationClassBType.internalName, calleeMethodNode.name, calleeMethodNode.desc, noInfo)
334- CallsiteInfo (false , false , false , false , false , IntMap .empty, Some (warning))
321+ CallsiteInfo (false , false , false , false , IntMap .empty, Some (warning))
335322 }
336323 }
337324
@@ -386,20 +373,13 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
386373 * @param calleeDeclarationClass The class in which the callee is declared
387374 * @param safeToInline True if the callee can be safely inlined: it cannot be overridden,
388375 * and the inliner settings (project / global) allow inlining it.
389- * @param safeToRewrite True if the callee is the interface method of a concrete trait method
390- * that can be safely re-written to the static implementation method.
391376 * @param annotatedInline True if the callee is annotated @inline
392377 * @param annotatedNoInline True if the callee is annotated @noinline
393378 * @param samParamTypes A map from parameter positions to SAM parameter types
394379 * @param calleeInfoWarning An inliner warning if some information was not available while
395380 * gathering the information about this callee.
396381 */
397- final case class Callee (callee : MethodNode , calleeDeclarationClass : ClassBType ,
398- safeToInline : Boolean , safeToRewrite : Boolean , canInlineFromSource : Boolean ,
399- annotatedInline : Boolean , annotatedNoInline : Boolean ,
400- samParamTypes : IntMap [ClassBType ],
401- calleeInfoWarning : Option [CalleeInfoWarning ]) {
402- assert(! (safeToInline && safeToRewrite), s " A callee of ${callee.name} can be either safeToInline or safeToRewrite, but not both. " )
382+ final case class Callee (callee : MethodNode , calleeDeclarationClass : btypes.ClassBType , safeToInline : Boolean , canInlineFromSource : Boolean , annotatedInline : Boolean , annotatedNoInline : Boolean , samParamTypes : IntMap [btypes.ClassBType ], calleeInfoWarning : Option [CalleeInfoWarning ]) {
403383 override def toString = s " Callee( $calleeDeclarationClass. ${callee.name}) "
404384 }
405385
0 commit comments