Lazy evaluation of an error prefix in MethodInliner (performance optimization)
This commit is contained in:
committed by
Space Team
parent
5aa0000b3e
commit
ece40ca775
+1
-1
@@ -334,7 +334,7 @@ class AnonymousObjectTransformer(
|
|||||||
inliningContext.subInline(transformationInfo.nameGenerator),
|
inliningContext.subInline(transformationInfo.nameGenerator),
|
||||||
remapper,
|
remapper,
|
||||||
isSameModule,
|
isSameModule,
|
||||||
"Transformer for " + transformationInfo.oldClassName,
|
{ "Transformer for " + transformationInfo.oldClassName },
|
||||||
SourceMapCopier(sourceMapper, sourceMap),
|
SourceMapCopier(sourceMapper, sourceMap),
|
||||||
InlineCallSiteInfo(
|
InlineCallSiteInfo(
|
||||||
transformationInfo.oldClassName,
|
transformationInfo.oldClassName,
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
|||||||
val callSite = SourcePosition(codegen.lastLineNumber, sourceInfo.sourceFileName!!, sourceInfo.pathOrCleanFQN)
|
val callSite = SourcePosition(codegen.lastLineNumber, sourceInfo.sourceFileName!!, sourceInfo.pathOrCleanFQN)
|
||||||
val inliner = MethodInliner(
|
val inliner = MethodInliner(
|
||||||
node, parameters, info, FieldRemapper(null, null, parameters), sourceCompiler.isCallInsideSameModuleAsCallee,
|
node, parameters, info, FieldRemapper(null, null, parameters), sourceCompiler.isCallInsideSameModuleAsCallee,
|
||||||
"Method inlining " + sourceCompiler.callElementText,
|
{ "Method inlining " + sourceCompiler.callElementText },
|
||||||
SourceMapCopier(sourceMapper, nodeAndSmap.classSMAP, callSite),
|
SourceMapCopier(sourceMapper, nodeAndSmap.classSMAP, callSite),
|
||||||
info.callSiteInfo,
|
info.callSiteInfo,
|
||||||
isInlineOnlyMethod = isInlineOnly,
|
isInlineOnlyMethod = isInlineOnly,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class MethodInliner(
|
|||||||
private val inliningContext: InliningContext,
|
private val inliningContext: InliningContext,
|
||||||
private val nodeRemapper: FieldRemapper,
|
private val nodeRemapper: FieldRemapper,
|
||||||
private val isSameModule: Boolean,
|
private val isSameModule: Boolean,
|
||||||
private val errorPrefix: String,
|
private val errorPrefixSupplier: () -> String,
|
||||||
private val sourceMapper: SourceMapCopier,
|
private val sourceMapper: SourceMapCopier,
|
||||||
private val inlineCallSiteInfo: InlineCallSiteInfo,
|
private val inlineCallSiteInfo: InlineCallSiteInfo,
|
||||||
private val isInlineOnlyMethod: Boolean = false,
|
private val isInlineOnlyMethod: Boolean = false,
|
||||||
@@ -297,7 +297,7 @@ class MethodInliner(
|
|||||||
info.node.node, lambdaParameters, inliningContext.subInlineLambda(info),
|
info.node.node, lambdaParameters, inliningContext.subInlineLambda(info),
|
||||||
newCapturedRemapper,
|
newCapturedRemapper,
|
||||||
if (info is DefaultLambda) isSameModule else true /*cause all nested objects in same module as lambda*/,
|
if (info is DefaultLambda) isSameModule else true /*cause all nested objects in same module as lambda*/,
|
||||||
"Lambda inlining " + info.lambdaClassType.internalName,
|
{ "Lambda inlining " + info.lambdaClassType.internalName },
|
||||||
SourceMapCopier(sourceMapper.parent, info.node.classSMAP, callSite), inlineCallSiteInfo,
|
SourceMapCopier(sourceMapper.parent, info.node.classSMAP, callSite), inlineCallSiteInfo,
|
||||||
isInlineOnlyMethod = false
|
isInlineOnlyMethod = false
|
||||||
)
|
)
|
||||||
@@ -1014,9 +1014,9 @@ class MethodInliner(
|
|||||||
@Suppress("SameParameterValue")
|
@Suppress("SameParameterValue")
|
||||||
private fun wrapException(originalException: Throwable, node: MethodNode, errorSuffix: String): RuntimeException {
|
private fun wrapException(originalException: Throwable, node: MethodNode, errorSuffix: String): RuntimeException {
|
||||||
return if (originalException is InlineException) {
|
return if (originalException is InlineException) {
|
||||||
InlineException("$errorPrefix: $errorSuffix", originalException)
|
InlineException("${errorPrefixSupplier()}: $errorSuffix", originalException)
|
||||||
} else {
|
} else {
|
||||||
InlineException("$errorPrefix: $errorSuffix\nCause: ${node.nodeText}", originalException)
|
InlineException("${errorPrefixSupplier()}: $errorSuffix\nCause: ${node.nodeText}", originalException)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user