@@ -132,17 +132,9 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
132
132
(declarationClassNode, source) <- byteCodeRepository.classNodeAndSource(declarationClass): Either [OptimizerWarning , (ClassNode , Source )]
133
133
} yield {
134
134
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)
146
138
}
147
139
148
140
val argInfos = computeArgInfos(callee, call, prodCons)
@@ -256,7 +248,7 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
256
248
/**
257
249
* Just a named tuple used as return type of `analyzeCallsite`.
258
250
*/
259
- private case class CallsiteInfo (safeToInline : Boolean , safeToRewrite : Boolean , canInlineFromSource : Boolean ,
251
+ private case class CallsiteInfo (safeToInline : Boolean , canInlineFromSource : Boolean ,
260
252
annotatedInline : Boolean , annotatedNoInline : Boolean ,
261
253
samParamTypes : IntMap [ClassBType ],
262
254
warning : Option [CalleeInfoWarning ])
@@ -299,16 +291,12 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
299
291
receiverType.info.orThrow.inlineInfo.isEffectivelyFinal // (1)
300
292
}
301
293
302
- val isRewritableTraitCall = false
303
-
304
294
val warning = calleeDeclarationClassBType.info.orThrow.inlineInfo.warning.map(
305
295
MethodInlineInfoIncomplete (calleeDeclarationClassBType.internalName, calleeMethodNode.name, calleeMethodNode.desc, _))
306
296
307
297
// (1) For invocations of final trait methods, the callee isStaticallyResolved but also
308
298
// abstract. Such a callee is not safe to inline - it needs to be re-written to the
309
299
// 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.
312
300
CallsiteInfo (
313
301
safeToInline =
314
302
canInlineFromSource &&
@@ -317,7 +305,6 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
317
305
! BytecodeUtils .isConstructor(calleeMethodNode) &&
318
306
! BytecodeUtils .isNativeMethod(calleeMethodNode) &&
319
307
! BytecodeUtils .hasCallerSensitiveAnnotation(calleeMethodNode),
320
- safeToRewrite = canInlineFromSource && isRewritableTraitCall, // (2)
321
308
canInlineFromSource = canInlineFromSource,
322
309
annotatedInline = methodInlineInfo.annotatedInline,
323
310
annotatedNoInline = methodInlineInfo.annotatedNoInline,
@@ -326,12 +313,12 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
326
313
327
314
case None =>
328
315
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))
330
317
}
331
318
} catch {
332
319
case Invalid (noInfo : NoClassBTypeInfo ) =>
333
320
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))
335
322
}
336
323
}
337
324
@@ -386,20 +373,13 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
386
373
* @param calleeDeclarationClass The class in which the callee is declared
387
374
* @param safeToInline True if the callee can be safely inlined: it cannot be overridden,
388
375
* 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.
391
376
* @param annotatedInline True if the callee is annotated @inline
392
377
* @param annotatedNoInline True if the callee is annotated @noinline
393
378
* @param samParamTypes A map from parameter positions to SAM parameter types
394
379
* @param calleeInfoWarning An inliner warning if some information was not available while
395
380
* gathering the information about this callee.
396
381
*/
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 ]) {
403
383
override def toString = s " Callee( $calleeDeclarationClass. ${callee.name}) "
404
384
}
405
385
0 commit comments