[K/N] ForLoopsLowering: Use get without bounds check in ArrayIterationHandler
This commit is contained in:
@@ -332,6 +332,10 @@ abstract class Symbols<out T : CommonBackendContext>(val context: T, irBuiltIns:
|
|||||||
|
|
||||||
open val unsafeCoerceIntrinsic: IrSimpleFunctionSymbol? = null
|
open val unsafeCoerceIntrinsic: IrSimpleFunctionSymbol? = null
|
||||||
|
|
||||||
|
open val getWithoutBCName: Name? = null
|
||||||
|
|
||||||
|
open val setWithoutBCName: Name? = null
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun isLateinitIsInitializedPropertyGetter(symbol: IrFunctionSymbol): Boolean =
|
fun isLateinitIsInitializedPropertyGetter(symbol: IrFunctionSymbol): Boolean =
|
||||||
symbol is IrSimpleFunctionSymbol && symbol.owner.let { function ->
|
symbol is IrSimpleFunctionSymbol && symbol.owner.let { function ->
|
||||||
|
|||||||
+5
-1
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.ir.util.getPropertyGetter
|
|||||||
import org.jetbrains.kotlin.ir.util.getSimpleFunction
|
import org.jetbrains.kotlin.ir.util.getSimpleFunction
|
||||||
import org.jetbrains.kotlin.ir.util.isPrimitiveArray
|
import org.jetbrains.kotlin.ir.util.isPrimitiveArray
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
|
|
||||||
/** Builds a [HeaderInfo] for iteration over iterables using the `get / []` operator and an index. */
|
/** Builds a [HeaderInfo] for iteration over iterables using the `get / []` operator and an index. */
|
||||||
@@ -79,9 +80,12 @@ internal class ArrayIterationHandler(context: CommonBackendContext) : IndexedGet
|
|||||||
override val IrType.sizePropertyGetter
|
override val IrType.sizePropertyGetter
|
||||||
get() = getClass()!!.getPropertyGetter("size")!!.owner
|
get() = getClass()!!.getPropertyGetter("size")!!.owner
|
||||||
|
|
||||||
|
private val getFunctionName: Name
|
||||||
|
get() = context.ir.symbols.getWithoutBCName ?: OperatorNameConventions.GET
|
||||||
|
|
||||||
override val IrType.getFunction
|
override val IrType.getFunction
|
||||||
get() = getClass()!!.functions.single {
|
get() = getClass()!!.functions.single {
|
||||||
it.name == OperatorNameConventions.GET &&
|
it.name == getFunctionName &&
|
||||||
it.valueParameters.size == 1 &&
|
it.valueParameters.size == 1 &&
|
||||||
it.valueParameters[0].type.isInt()
|
it.valueParameters[0].type.isInt()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -575,6 +575,10 @@ internal class KonanSymbols(
|
|||||||
val topLevelSuite = getKonanTestClass("TopLevelSuite")
|
val topLevelSuite = getKonanTestClass("TopLevelSuite")
|
||||||
val testFunctionKind = getKonanTestClass("TestFunctionKind")
|
val testFunctionKind = getKonanTestClass("TestFunctionKind")
|
||||||
|
|
||||||
|
override val getWithoutBCName: Name? = KonanNameConventions.getWithoutBC
|
||||||
|
|
||||||
|
override val setWithoutBCName: Name? = KonanNameConventions.setWithoutBC
|
||||||
|
|
||||||
private val testFunctionKindCache = TestProcessor.FunctionKind.values().associate {
|
private val testFunctionKindCache = TestProcessor.FunctionKind.values().associate {
|
||||||
val symbol = if (it.runtimeKindString.isEmpty())
|
val symbol = if (it.runtimeKindString.isEmpty())
|
||||||
null
|
null
|
||||||
|
|||||||
Reference in New Issue
Block a user