Minor, inline method

This commit is contained in:
Alexander Udalov
2013-10-28 19:29:32 +04:00
parent f75c399128
commit d6aa7c2d23
2 changed files with 8 additions and 18 deletions
@@ -32,7 +32,10 @@ import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
import org.jetbrains.jet.lang.resolve.java.*;
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
import org.jetbrains.jet.lang.resolve.java.JavaVisibilities;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaCallableMemberDescriptor;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.types.JetType;
@@ -321,22 +324,6 @@ public class AsmUtil {
}
}
public static void genInitSingletonField(Type classAsmType, InstructionAdapter iv) {
genInitSingletonField(classAsmType, JvmAbi.INSTANCE_FIELD, classAsmType, iv);
}
public static void genInitSingletonField(FieldInfo info, InstructionAdapter iv) {
assert info.isStatic();
genInitSingletonField(info.getOwnerType(), info.getFieldName(), info.getFieldType(), iv);
}
public static void genInitSingletonField(Type fieldOwnerType, String fieldName, Type fieldAsmType, InstructionAdapter iv) {
iv.anew(fieldAsmType);
iv.dup();
iv.invokespecial(fieldAsmType.getInternalName(), "<init>", "()V");
iv.putstatic(fieldOwnerType.getInternalName(), fieldName, fieldAsmType.getDescriptor());
}
public static int genAssignInstanceFieldFromParam(FieldInfo info, int index, InstructionAdapter iv) {
assert !info.isStatic();
Type fieldType = info.getFieldType();
@@ -162,7 +162,10 @@ public class ClosureCodegen extends ParentCodegenAwareImpl {
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
mv.visitCode();
genInitSingletonField(asmType, iv);
iv.anew(asmType);
iv.dup();
iv.invokespecial(asmType.getInternalName(), "<init>", "()V");
iv.putstatic(asmType.getInternalName(), JvmAbi.INSTANCE_FIELD, asmType.getDescriptor());
mv.visitInsn(RETURN);
FunctionCodegen.endVisit(mv, "<clinit>", fun);
}