Optimize KProperty objects for delegated properties

Don't generate anonymous classes with a lot of methods because this hurts
Android. Add special classes to the runtime instead (also add
FunctionReferenceImpl, to be used later) and just create their instances in the
static initializer of each class
This commit is contained in:
Alexander Udalov
2015-10-25 15:42:13 +03:00
parent 2d1a7163a3
commit a97567ea0c
10 changed files with 444 additions and 41 deletions
@@ -42,6 +42,17 @@ public class AsmTypes {
public static final Type MUTABLE_PROPERTY_REFERENCE1 = Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference1");
public static final Type MUTABLE_PROPERTY_REFERENCE2 = Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference2");
public static final Type[] PROPERTY_REFERENCE_IMPL = {
Type.getObjectType("kotlin/jvm/internal/PropertyReference0Impl"),
Type.getObjectType("kotlin/jvm/internal/PropertyReference1Impl"),
Type.getObjectType("kotlin/jvm/internal/PropertyReference2Impl")
};
public static final Type[] MUTABLE_PROPERTY_REFERENCE_IMPL = {
Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference0Impl"),
Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference1Impl"),
Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference2Impl")
};
public static final Type K_CLASS_TYPE = reflect("KClass");
public static final Type K_CLASS_ARRAY_TYPE = Type.getObjectType("[" + K_CLASS_TYPE.getDescriptor());
public static final Type K_DECLARATION_CONTAINER_TYPE = reflect("KDeclarationContainer");