langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java
author jjg
Tue, 19 May 2009 11:50:54 -0700
changeset 2979 ea39317acd3d
child 3536 dee1b5833af7
permissions -rw-r--r--
6824493: experimental support for additional info for instructions Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2979
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     1
/*
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     4
 *
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    10
 *
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    15
 * accompanied this code).
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    16
 *
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    20
 *
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    23
 * have any questions.
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    24
 */
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    25
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    26
package com.sun.tools.javap;
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    27
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    28
import com.sun.tools.classfile.Instruction;
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    29
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    30
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    31
/*
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    32
 *  Write additional details for an instruction.
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    33
 *
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    34
 *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    35
 *  you write code that depends on this, you do so at your own risk.
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    36
 *  This code and its internal interfaces are subject to change or
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    37
 *  deletion without notice.</b>
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    38
 */
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    39
public abstract class InstructionDetailWriter extends BasicWriter {
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    40
    public enum Kind {
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    41
        LOCAL_VARS("localVariables"),
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    42
        LOCAL_VAR_TYPES("localVariableTypes"),
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    43
        SOURCE("source"),
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    44
        STACKMAPS("stackMaps"),
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    45
        TRY_BLOCKS("tryBlocks");
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    46
        Kind(String option) {
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    47
            this.option = option;
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    48
        }
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    49
        final String option;
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    50
    }
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    51
    InstructionDetailWriter(Context context) {
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    52
        super(context);
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    53
    }
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    54
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    55
    abstract void writeDetails(Instruction instr);
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    56
    void flush() { }
ea39317acd3d 6824493: experimental support for additional info for instructions
jjg
parents:
diff changeset
    57
}