[Common IR] Get rid of inlineConstVal flag
The hack involving disabling constant inlining via the inlineConstVal flag was necessary to avoid a JS IR incremental compilation issue. Since the issue has been fixed, the hack is no longer needed.
This commit is contained in:
committed by
Space Team
parent
188cdf2f98
commit
b9c7a672b8
-2
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
* @param createNonCompileTimeObjects
|
||||
* 'true' - interpreter will construct object and initialize its properties despite the fact it is not marked as compile time;
|
||||
* 'false' - interpreter will create a representation of empty object, that can be used to get const properties
|
||||
* @param inlineConstVal tell the interpreter that value of const property can be inlined instead of getter call
|
||||
*/
|
||||
// TODO maybe create some sort of builder
|
||||
data class IrInterpreterConfiguration(
|
||||
@@ -24,5 +23,4 @@ data class IrInterpreterConfiguration(
|
||||
val createNonCompileTimeObjects: Boolean = false,
|
||||
val printOnlyExceptionMessage: Boolean = false,
|
||||
val collapseStackTraceFromJDK: Boolean = true,
|
||||
val inlineConstVal: Boolean = true,
|
||||
)
|
||||
|
||||
+1
-3
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.ir.interpreter.checker
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.interpreter.IrInterpreterConfiguration
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
|
||||
interface IrInterpreterChecker : IrElementVisitor<Boolean, IrInterpreterCheckerData>
|
||||
@@ -16,5 +15,4 @@ class IrInterpreterCheckerData(
|
||||
val irFile: IrFile,
|
||||
val mode: EvaluationMode,
|
||||
val irBuiltIns: IrBuiltIns,
|
||||
val interpreterConfiguration: IrInterpreterConfiguration,
|
||||
)
|
||||
)
|
||||
|
||||
+1
-3
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.ir.types.classifierOrNull
|
||||
import org.jetbrains.kotlin.ir.types.isAny
|
||||
import org.jetbrains.kotlin.ir.types.isPrimitiveType
|
||||
import org.jetbrains.kotlin.ir.types.isStringClassType
|
||||
import org.jetbrains.kotlin.ir.util.fileOrNull
|
||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||
import org.jetbrains.kotlin.ir.util.statements
|
||||
|
||||
@@ -65,7 +64,6 @@ class IrInterpreterCommonChecker : IrInterpreterChecker {
|
||||
override fun visitCall(expression: IrCall, data: IrInterpreterCheckerData): Boolean {
|
||||
val owner = expression.symbol.owner
|
||||
return when {
|
||||
!data.interpreterConfiguration.inlineConstVal && expression.isGetterToConstVal() && data.irFile != owner.fileOrNull -> false
|
||||
expression.dispatchReceiver.isAccessToNotNullableObject() && expression.isGetterToConstVal() -> visitBodyIfNeeded(owner, data)
|
||||
!data.mode.canEvaluateExpression(expression) || !data.mode.canEvaluateFunction(owner) -> false
|
||||
expression.isKCallableNameCall(data.irBuiltIns) || expression.isEnumName() -> true
|
||||
@@ -330,4 +328,4 @@ class IrInterpreterCommonChecker : IrInterpreterChecker {
|
||||
override fun visitClassReference(expression: IrClassReference, data: IrInterpreterCheckerData): Boolean {
|
||||
return data.mode.canEvaluateClassReference(expression)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-5
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||
import org.jetbrains.kotlin.ir.interpreter.IrInterpreter
|
||||
import org.jetbrains.kotlin.ir.interpreter.IrInterpreterConfiguration
|
||||
import org.jetbrains.kotlin.ir.interpreter.checker.EvaluationMode
|
||||
import org.jetbrains.kotlin.ir.interpreter.checker.IrInterpreterChecker
|
||||
import org.jetbrains.kotlin.ir.interpreter.checker.IrInterpreterCheckerData
|
||||
@@ -121,11 +120,9 @@ internal abstract class IrConstTransformer(
|
||||
return this
|
||||
}
|
||||
|
||||
protected fun IrExpression.canBeInterpreted(
|
||||
configuration: IrInterpreterConfiguration = interpreter.environment.configuration
|
||||
): Boolean {
|
||||
protected fun IrExpression.canBeInterpreted(): Boolean {
|
||||
return try {
|
||||
this.accept(checker, IrInterpreterCheckerData(irFile, mode, interpreter.irBuiltIns, configuration))
|
||||
this.accept(checker, IrInterpreterCheckerData(irFile, mode, interpreter.irBuiltIns))
|
||||
} catch (e: Throwable) {
|
||||
if (suppressExceptions) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user