[EE-IR] Use reflection to avoid the need for accessors when compiling
evaluator fragments - Refactor JvmIrCodegenFactory to allow for caller's choice of lowerings. - Refactor of SyntheticAccessorLowering to expose the accessibility check used to determine the need for accessors. - Replacement of field, method and constructor uses with corresponding java.lang.reflection API via additional lowering running _before_ the existing IR pipeline. - Emulating super calls in the context of class methods via new compiler intrinsic. - psi2ir: Add support for `_field` suffix on properties in the evaluator for accessing underlying fields when applicable. - Add `JvmGeneratorExtensions` point for determining whether a property accessor has a user-supplied body in order to predict how they are ultimately compiled for the JVM.
This commit is contained in:
committed by
Alexander Udalov
parent
2e535366f1
commit
771b79d045
@@ -121,3 +121,14 @@ fun IrStatementOrigin.isAssignmentOperatorWithResult() =
|
||||
else ->
|
||||
false
|
||||
}
|
||||
|
||||
fun IrStatementOrigin.isAssignmentOperator(): Boolean =
|
||||
when (this) {
|
||||
IrStatementOrigin.EQ,
|
||||
IrStatementOrigin.PLUSEQ,
|
||||
IrStatementOrigin.MINUSEQ,
|
||||
IrStatementOrigin.MULTEQ,
|
||||
IrStatementOrigin.DIVEQ,
|
||||
IrStatementOrigin.PERCEQ -> true
|
||||
else -> isAssignmentOperatorWithResult()
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyClass
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
@@ -35,6 +34,15 @@ open class StubGeneratorExtensions {
|
||||
// intercept and supply "fake" deserialized sources.
|
||||
open fun getContainerSource(descriptor: DeclarationDescriptor): DeserializedContainerSource? = null
|
||||
|
||||
// Extension point for the JVM Debugger IDEA plug-in: to replace accesses
|
||||
// to private properties _without_ accessor implementations, the fragment
|
||||
// compiler needs to predict the compilation output for properties.
|
||||
// To do this, we need to know whether the property accessors have explicit
|
||||
// bodies, information that is _not_ present in the IR structure, but _is_
|
||||
// available in the corresponding PSI. See `CodeFragmentCompiler` in the
|
||||
// plug-in for the implementation.
|
||||
open fun isAccessorWithExplicitImplementation(accessor: IrSimpleFunction): Boolean = false
|
||||
|
||||
open fun isPropertyWithPlatformField(descriptor: PropertyDescriptor): Boolean = false
|
||||
|
||||
open fun isStaticFunction(descriptor: FunctionDescriptor): Boolean = false
|
||||
|
||||
Reference in New Issue
Block a user