Java Code Examples for jdk.internal.org.objectweb.asm.commons.InstructionAdapter#areturn()

The following examples show how to use jdk.internal.org.objectweb.asm.commons.InstructionAdapter#areturn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaAdapterBytecodeGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 2
Source File: JavaAdapterBytecodeGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        mv.invokespecial(Type.getInternalName(owner), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 3
Source File: JavaAdapterBytecodeGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 4
Source File: JavaAdapterBytecodeGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 5
Source File: JavaAdapterBytecodeGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 6
Source File: JavaAdapterBytecodeGenerator.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 7
Source File: JavaAdapterBytecodeGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void generateSuperMethod(final MethodInfo mi) {
    final Method method = mi.method;

    final String methodDesc = mi.type.toMethodDescriptorString();
    final String name = mi.getName();

    final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(getAccessModifiers(method),
            SUPER_PREFIX + name, methodDesc, null, getExceptionNames(method.getExceptionTypes())));
    mv.visitCode();

    emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc);
    mv.areturn(Type.getType(mi.type.returnType()));
    endMethod(mv);
}
 
Example 8
Source File: JavaAdapterBytecodeGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }
    mv.invokespecial(superClassName, name, methodDesc);
    mv.areturn(methodType.getReturnType());
}
 
Example 9
Source File: JavaAdapterBytecodeGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }
    mv.invokespecial(superClassName, name, methodDesc);
    mv.areturn(methodType.getReturnType());
}
 
Example 10
Source File: JavaAdapterBytecodeGenerator.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }
    mv.invokespecial(superClassName, name, methodDesc);
    mv.areturn(methodType.getReturnType());
}