Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#H_INVOKESTATIC

The following examples show how to use jdk.internal.org.objectweb.asm.Opcodes#H_INVOKESTATIC . 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: CheckMethodAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
Example 2
Source File: CheckMethodAdapter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
Example 3
Source File: CheckMethodAdapter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
Example 4
Source File: CheckMethodAdapter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
Example 5
Source File: CheckMethodAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
Example 6
Source File: CheckMethodAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
Example 7
Source File: CheckMethodAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
Example 8
Source File: CheckMethodAdapter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public void visitInvokeDynamicInsn(
        final String name,
        final String descriptor,
        final Handle bootstrapMethodHandle,
        final Object... bootstrapMethodArguments) {
    checkVisitCodeCalled();
    checkVisitMaxsNotCalled();
    checkMethodIdentifier(version, name, "name");
    checkMethodDescriptor(version, descriptor);
    if (bootstrapMethodHandle.getTag() != Opcodes.H_INVOKESTATIC
            && bootstrapMethodHandle.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag " + bootstrapMethodHandle.getTag());
    }
    for (Object bootstrapMethodArgument : bootstrapMethodArguments) {
        checkLdcConstant(bootstrapMethodArgument);
    }
    super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments);
    ++insnCount;
}
 
Example 9
Source File: Textifier.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    buf.append('\n').append(tab3);
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    buf.append('(');
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    buf.append(')').append('\n');
}
 
Example 10
Source File: Textifier.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        isMethodHandle = true;
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    if(!isMethodHandle){
        buf.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    if(!isMethodHandle){
        buf.append(')');
    }
}
 
Example 11
Source File: Textifier.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        isMethodHandle = true;
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    if(!isMethodHandle){
        buf.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    if(!isMethodHandle){
        buf.append(')');
    }
}
 
Example 12
Source File: Textifier.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        isMethodHandle = true;
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    if(!isMethodHandle){
        buf.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    if(!isMethodHandle){
        buf.append(')');
    }
}
 
Example 13
Source File: Textifier.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        isMethodHandle = true;
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    if(!isMethodHandle){
        buf.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    if(!isMethodHandle){
        buf.append(')');
    }
}
 
Example 14
Source File: Textifier.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    buf.append('\n').append(tab3);
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    buf.append('(');
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    buf.append(')').append('\n');
}
 
Example 15
Source File: Textifier.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        isMethodHandle = true;
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    if(!isMethodHandle){
        buf.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    if(!isMethodHandle){
        buf.append(')');
    }
}
 
Example 16
Source File: InvokeDynamicPatcher.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MethodVisitor visitMethod(final int access, final String name,
        final String desc, final String signature,
        final String[] exceptions) {
    /* a code generate looks like
     *  0: aload_0
     *  1: ldc           #125  // int 1
     *  3: ldc2_w        #126  // long 2l
     *  6: ldc           #128  // float 3.0f
     *  8: ldc2_w        #129  // double 4.0d
     * 11: ldc           #132  // String 5
     * 13: aload_0
     * 14: getfield      #135  // Field nativeCallee:Z
     * 17: ifeq          28
     * 20: invokedynamic #181,  0            // InvokeDynamic #1:calleeNative:(Lcompiler/calls/common/InvokeDynamic;IJFDLjava/lang/String;)Z
     * 25: goto          33
     * 28: invokedynamic #183,  0            // InvokeDynamic #1:callee:(Lcompiler/calls/common/InvokeDynamic;IJFDLjava/lang/String;)Z
     * 33: ldc           #185                // String Call insuccessfull
     * 35: invokestatic  #191                // Method jdk/test/lib/Asserts.assertTrue:(ZLjava/lang/String;)V
     * 38: return
     *
     * or, using java-like pseudo-code
     * if (this.nativeCallee == false) {
     *     invokedynamic-call-return-value = invokedynamic-of-callee
     * } else {
     *     invokedynamic-call-return-value = invokedynamic-of-nativeCallee
     * }
     * Asserts.assertTrue(invokedynamic-call-return-value, error-message);
     * return;
     */
    if (name.equals(CALLER_METHOD_NAME)) {
        MethodVisitor mv = cv.visitMethod(access, name, desc,
                signature, exceptions);
        Label nonNativeLabel = new Label();
        Label checkLabel = new Label();
        MethodType mtype = MethodType.methodType(CallSite.class,
                MethodHandles.Lookup.class, String.class, MethodType.class);
        Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, CLASS,
                BOOTSTRAP_METHOD_NAME, mtype.toMethodDescriptorString());
        mv.visitCode();
        // push callee parameters onto stack
        mv.visitVarInsn(Opcodes.ALOAD, 0);//push "this"
        mv.visitLdcInsn(1);
        mv.visitLdcInsn(2L);
        mv.visitLdcInsn(3.0f);
        mv.visitLdcInsn(4.0d);
        mv.visitLdcInsn("5");
        // params loaded. let's decide what method to call
        mv.visitVarInsn(Opcodes.ALOAD, 0); // push "this"
        // get nativeCallee field
        mv.visitFieldInsn(Opcodes.GETFIELD, CLASS, CALL_NATIVE_FIELD,
                CALL_NATIVE_FIELD_DESC);
        // if nativeCallee == false goto nonNativeLabel
        mv.visitJumpInsn(Opcodes.IFEQ, nonNativeLabel);
        // invokedynamic nativeCalleeMethod using bootstrap method
        mv.visitInvokeDynamicInsn(NATIVE_CALLEE_METHOD_NAME,
                CALLEE_METHOD_DESC, bootstrap);
        // goto checkLabel
        mv.visitJumpInsn(Opcodes.GOTO, checkLabel);
        // label: nonNativeLabel
        mv.visitLabel(nonNativeLabel);
        // invokedynamic calleeMethod using bootstrap method
        mv.visitInvokeDynamicInsn(CALLEE_METHOD_NAME, CALLEE_METHOD_DESC,
                bootstrap);
        mv.visitLabel(checkLabel);
        mv.visitLdcInsn(CallsBase.CALL_ERR_MSG);
        mv.visitMethodInsn(Opcodes.INVOKESTATIC, ASSERTS_CLASS,
                ASSERTTRUE_METHOD_NAME, ASSERTTRUE_METHOD_DESC, false);
        // label: return
        mv.visitInsn(Opcodes.RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
        return null;
    }
    return super.visitMethod(access, name, desc, signature, exceptions);
}
 
Example 17
Source File: Textifier.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
  * Appends a string representation of the given handle to {@link #stringBuilder}.
  *
  * @param handle a handle.
  */
protected void appendHandle(final Handle handle) {
    int tag = handle.getTag();
    stringBuilder.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
        case Opcodes.H_GETFIELD:
            stringBuilder.append("GETFIELD");
            break;
        case Opcodes.H_GETSTATIC:
            stringBuilder.append("GETSTATIC");
            break;
        case Opcodes.H_PUTFIELD:
            stringBuilder.append("PUTFIELD");
            break;
        case Opcodes.H_PUTSTATIC:
            stringBuilder.append("PUTSTATIC");
            break;
        case Opcodes.H_INVOKEINTERFACE:
            stringBuilder.append("INVOKEINTERFACE");
            isMethodHandle = true;
            break;
        case Opcodes.H_INVOKESPECIAL:
            stringBuilder.append("INVOKESPECIAL");
            isMethodHandle = true;
            break;
        case Opcodes.H_INVOKESTATIC:
            stringBuilder.append("INVOKESTATIC");
            isMethodHandle = true;
            break;
        case Opcodes.H_INVOKEVIRTUAL:
            stringBuilder.append("INVOKEVIRTUAL");
            isMethodHandle = true;
            break;
        case Opcodes.H_NEWINVOKESPECIAL:
            stringBuilder.append("NEWINVOKESPECIAL");
            isMethodHandle = true;
            break;
        default:
            throw new IllegalArgumentException();
    }
    stringBuilder.append('\n');
    stringBuilder.append(tab3);
    appendDescriptor(INTERNAL_NAME, handle.getOwner());
    stringBuilder.append('.');
    stringBuilder.append(handle.getName());
    if (!isMethodHandle) {
        stringBuilder.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, handle.getDesc());
    if (!isMethodHandle) {
        stringBuilder.append(')');
    }
    if (handle.isInterface()) {
        stringBuilder.append(" itf");
    }
}
 
Example 18
Source File: Textifier.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        isMethodHandle = true;
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    if(!isMethodHandle){
        buf.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    if(!isMethodHandle){
        buf.append(')');
    }
}
 
Example 19
Source File: Textifier.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *            a handle, non null.
 */
protected void appendHandle(final Handle h) {
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag))
            .append(" : ");
    boolean isMethodHandle = false;
    switch (tag) {
    case Opcodes.H_GETFIELD:
        buf.append("GETFIELD");
        break;
    case Opcodes.H_GETSTATIC:
        buf.append("GETSTATIC");
        break;
    case Opcodes.H_PUTFIELD:
        buf.append("PUTFIELD");
        break;
    case Opcodes.H_PUTSTATIC:
        buf.append("PUTSTATIC");
        break;
    case Opcodes.H_INVOKEINTERFACE:
        buf.append("INVOKEINTERFACE");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESPECIAL:
        buf.append("INVOKESPECIAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKESTATIC:
        buf.append("INVOKESTATIC");
        isMethodHandle = true;
        break;
    case Opcodes.H_INVOKEVIRTUAL:
        buf.append("INVOKEVIRTUAL");
        isMethodHandle = true;
        break;
    case Opcodes.H_NEWINVOKESPECIAL:
        buf.append("NEWINVOKESPECIAL");
        isMethodHandle = true;
        break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    if(!isMethodHandle){
        buf.append('(');
    }
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    if(!isMethodHandle){
        buf.append(')');
    }
}
 
Example 20
Source File: Textifier.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h a handle, non null.
 */
protected void appendHandle(final Handle h) {
    buf.append('\n').append(tab3);
    int tag = h.getTag();
    buf.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : ");
    switch (tag) {
        case Opcodes.H_GETFIELD:
            buf.append("GETFIELD");
            break;
        case Opcodes.H_GETSTATIC:
            buf.append("GETSTATIC");
            break;
        case Opcodes.H_PUTFIELD:
            buf.append("PUTFIELD");
            break;
        case Opcodes.H_PUTSTATIC:
            buf.append("PUTSTATIC");
            break;
        case Opcodes.H_INVOKEINTERFACE:
            buf.append("INVOKEINTERFACE");
            break;
        case Opcodes.H_INVOKESPECIAL:
            buf.append("INVOKESPECIAL");
            break;
        case Opcodes.H_INVOKESTATIC:
            buf.append("INVOKESTATIC");
            break;
        case Opcodes.H_INVOKEVIRTUAL:
            buf.append("INVOKEVIRTUAL");
            break;
        case Opcodes.H_NEWINVOKESPECIAL:
            buf.append("NEWINVOKESPECIAL");
            break;
    }
    buf.append('\n');
    buf.append(tab3);
    appendDescriptor(INTERNAL_NAME, h.getOwner());
    buf.append('.');
    buf.append(h.getName());
    buf.append('(');
    appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
    buf.append(')').append('\n');
}