Rename invokeWithout assertion to genInvokeInstruction

This commit is contained in:
Michael Bogdanov
2015-04-07 12:02:44 +03:00
parent 8b4886e3e0
commit 7abbf1ec12
8 changed files with 13 additions and 29 deletions
@@ -628,17 +628,6 @@ public class AsmUtil {
genNotNullAssertion(v, state, descriptor, "checkFieldIsNotNull"); genNotNullAssertion(v, state, descriptor, "checkFieldIsNotNull");
} }
public static void genNotNullAssertionForMethod(
@NotNull InstructionAdapter v,
@NotNull GenerationState state,
@NotNull ResolvedCall resolvedCall
) {
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
if (descriptor instanceof ConstructorDescriptor) return;
genNotNullAssertion(v, state, descriptor, "checkReturnedValueIsNotNull");
}
private static void genNotNullAssertion( private static void genNotNullAssertion(
@NotNull InstructionAdapter v, @NotNull InstructionAdapter v,
@NotNull GenerationState state, @NotNull GenerationState state,
@@ -41,10 +41,10 @@ public abstract class CallGenerator {
@NotNull ExpressionCodegen codegen @NotNull ExpressionCodegen codegen
) { ) {
if (!callDefault) { if (!callDefault) {
callableMethod.invokeWithoutAssertions(codegen.v); callableMethod.genInvokeInstruction(codegen.v);
} }
else { else {
((CallableMethod)callableMethod).invokeDefaultWithNotNullAssertion(codegen.v, codegen.getState(), resolvedCall); ((CallableMethod)callableMethod).genInvokeDefaultInstruction(codegen.v);
} }
} }
@@ -52,7 +52,7 @@ public abstract class CallGenerator {
public void genCallWithoutAssertions( public void genCallWithoutAssertions(
@NotNull CallableMethod method, @NotNull ExpressionCodegen codegen @NotNull CallableMethod method, @NotNull ExpressionCodegen codegen
) { ) {
method.invokeWithoutAssertions(codegen.v); method.genInvokeInstruction(codegen.v);
} }
@Override @Override
@@ -40,7 +40,7 @@ public trait Callable {
public val returnType: Type public val returnType: Type
public fun invokeWithoutAssertions(v: InstructionAdapter) public fun genInvokeInstruction(v: InstructionAdapter)
public fun isStaticCall(): Boolean public fun isStaticCall(): Boolean
@@ -55,11 +55,11 @@ public class CallableMethod(override val owner: Type, private val defaultImplOwn
get() = getAsmMethod().getArgumentTypes() get() = getAsmMethod().getArgumentTypes()
public override fun invokeWithoutAssertions(v: InstructionAdapter) { public override fun genInvokeInstruction(v: InstructionAdapter) {
v.visitMethodInsn(invokeOpcode, owner.getInternalName(), getAsmMethod().getName(), getAsmMethod().getDescriptor()) v.visitMethodInsn(invokeOpcode, owner.getInternalName(), getAsmMethod().getName(), getAsmMethod().getDescriptor())
} }
private fun invokeDefault(v: InstructionAdapter) { public fun genInvokeDefaultInstruction(v: InstructionAdapter) {
if (defaultImplOwner == null || defaultImplParam == null) { if (defaultImplOwner == null || defaultImplParam == null) {
throw IllegalStateException() throw IllegalStateException()
} }
@@ -79,11 +79,6 @@ public class CallableMethod(override val owner: Type, private val defaultImplOwn
} }
} }
public fun invokeDefaultWithNotNullAssertion(v: InstructionAdapter, state: GenerationState, resolvedCall: ResolvedCall<*>) {
invokeDefault(v)
AsmUtil.genNotNullAssertionForMethod(v, state, resolvedCall)
}
override val returnType: Type override val returnType: Type
get() = signature.getReturnType() get() = signature.getReturnType()
@@ -958,7 +958,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
iv.load(reg, argType); iv.load(reg, argType);
reg += argType.getSize(); reg += argType.getSize();
} }
callableMethod.invokeWithoutAssertions(iv); callableMethod.genInvokeInstruction(iv);
} }
private void generateFieldForSingleton() { private void generateFieldForSingleton() {
@@ -71,7 +71,7 @@ class PlatformStaticGenerator(
false, false,
codegen.getContext() codegen.getContext()
) )
syntheticOrOriginalMethod.invokeWithoutAssertions(iv) syntheticOrOriginalMethod.genInvokeInstruction(iv)
iv.areturn(asmMethod.getReturnType()); iv.areturn(asmMethod.getReturnType());
} }
} }
@@ -910,7 +910,7 @@ public abstract class StackValue {
throw new UnsupportedOperationException("no getter specified"); throw new UnsupportedOperationException("no getter specified");
} }
getter.invokeWithoutAssertions(v); getter.genInvokeInstruction(v);
coerceTo(type, v); coerceTo(type, v);
} }
@@ -963,7 +963,7 @@ public abstract class StackValue {
Type[] argumentTypes = setter.getParameterTypes(); Type[] argumentTypes = setter.getParameterTypes();
coerce(topOfStackType, argumentTypes[argumentTypes.length - 1], v); coerce(topOfStackType, argumentTypes[argumentTypes.length - 1], v);
setter.invokeWithoutAssertions(v); setter.genInvokeInstruction(v);
Type returnType = setter.getReturnType(); Type returnType = setter.getReturnType();
if (returnType != Type.VOID_TYPE) { if (returnType != Type.VOID_TYPE) {
pop(v, returnType); pop(v, returnType);
@@ -1029,7 +1029,7 @@ public abstract class StackValue {
coerceTo(type, v); coerceTo(type, v);
} }
else { else {
getter.invokeWithoutAssertions(v); getter.genInvokeInstruction(v);
coerce(getter.getReturnType(), type, v); coerce(getter.getReturnType(), type, v);
} }
} }
@@ -1042,7 +1042,7 @@ public abstract class StackValue {
v.visitFieldInsn(isStaticStore ? PUTSTATIC : PUTFIELD, backingFieldOwner.getInternalName(), fieldName, this.type.getDescriptor()); v.visitFieldInsn(isStaticStore ? PUTSTATIC : PUTFIELD, backingFieldOwner.getInternalName(), fieldName, this.type.getDescriptor());
} }
else { else {
setter.invokeWithoutAssertions(v); setter.genInvokeInstruction(v);
} }
} }
@@ -36,7 +36,7 @@ public open class IntrinsicCallable(override val returnType: Type,
} }
override fun invokeWithoutAssertions(v: InstructionAdapter) { override fun genInvokeInstruction(v: InstructionAdapter) {
invokeIntrinsic(v) invokeIntrinsic(v)
} }