jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 17420 6163a8236046
child 23351 d61dce5290a6
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     1
/*
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     3
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
     9
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    14
 * accompanied this code).
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    15
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    19
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    22
 * questions.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    23
 */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    24
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    25
/*
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    26
 * This file is available under and governed by the GNU General Public
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    27
 * License version 2 only, as published by the Free Software Foundation.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    28
 * However, the following notice accompanied the original version of this
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    29
 * file:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    30
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    31
 * ASM: a very small and fast Java bytecode manipulation framework
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    32
 * Copyright (c) 2000-2011 INRIA, France Telecom
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    33
 * All rights reserved.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    34
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    35
 * Redistribution and use in source and binary forms, with or without
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    36
 * modification, are permitted provided that the following conditions
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    37
 * are met:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    38
 * 1. Redistributions of source code must retain the above copyright
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    39
 *    notice, this list of conditions and the following disclaimer.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    40
 * 2. Redistributions in binary form must reproduce the above copyright
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    41
 *    notice, this list of conditions and the following disclaimer in the
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    42
 *    documentation and/or other materials provided with the distribution.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    43
 * 3. Neither the name of the copyright holders nor the names of its
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    44
 *    contributors may be used to endorse or promote products derived from
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    45
 *    this software without specific prior written permission.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    46
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    47
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    48
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    49
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    50
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    51
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    52
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    53
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    54
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    55
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    56
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    57
 * THE POSSIBILITY OF SUCH DAMAGE.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    58
 */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    59
package jdk.internal.org.objectweb.asm.tree.analysis;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    60
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    61
import java.util.List;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    62
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    63
import jdk.internal.org.objectweb.asm.Type;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    64
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    65
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    66
/**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    67
 * A semantic bytecode interpreter. More precisely, this interpreter only
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    68
 * manages the computation of values from other values: it does not manage the
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    69
 * transfer of values to or from the stack, and to or from the local variables.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    70
 * This separation allows a generic bytecode {@link Analyzer} to work with
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    71
 * various semantic interpreters, without needing to duplicate the code to
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    72
 * simulate the transfer of values.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    73
 *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    74
 * @param <V>
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    75
 *            type of the Value used for the analysis.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    76
 *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    77
 * @author Eric Bruneton
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    78
 */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    79
public abstract class Interpreter<V extends Value> {
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    80
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    81
    protected final int api;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    82
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    83
    protected Interpreter(final int api) {
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    84
        this.api = api;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    85
    }
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    86
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    87
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    88
     * Creates a new value that represents the given type.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    89
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    90
     * Called for method parameters (including <code>this</code>), exception
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    91
     * handler variable and with <code>null</code> type for variables reserved
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    92
     * by long and double types.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    93
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    94
     * @param type
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    95
     *            a primitive or reference type, or <tt>null</tt> to represent
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
    96
     *            an uninitialized value.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    97
     * @return a value that represents the given type. The size of the returned
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    98
     *         value must be equal to the size of the given type.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
    99
     */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   100
    public abstract V newValue(Type type);
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   101
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   102
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   103
     * Interprets a bytecode instruction without arguments. This method is
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   104
     * called for the following opcodes:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   105
     *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   106
     * ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   107
     * ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   108
     * DCONST_1, BIPUSH, SIPUSH, LDC, JSR, GETSTATIC, NEW
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   109
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   110
     * @param insn
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   111
     *            the bytecode instruction to be interpreted.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   112
     * @return the result of the interpretation of the given instruction.
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   113
     * @throws AnalyzerException
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17420
diff changeset
   114
     *             if an error occurred during the interpretation.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   115
     */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   116
    public abstract V newOperation(AbstractInsnNode insn)
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   117
            throws AnalyzerException;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   118
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   119
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   120
     * Interprets a bytecode instruction that moves a value on the stack or to
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   121
     * or from local variables. This method is called for the following opcodes:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   122
     *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   123
     * ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   124
     * ASTORE, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   125
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   126
     * @param insn
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   127
     *            the bytecode instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   128
     * @param value
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   129
     *            the value that must be moved by the instruction.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   130
     * @return the result of the interpretation of the given instruction. The
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   131
     *         returned value must be <tt>equal</tt> to the given value.
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   132
     * @throws AnalyzerException
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17420
diff changeset
   133
     *             if an error occurred during the interpretation.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   134
     */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   135
    public abstract V copyOperation(AbstractInsnNode insn, V value)
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   136
            throws AnalyzerException;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   137
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   138
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   139
     * Interprets a bytecode instruction with a single argument. This method is
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   140
     * called for the following opcodes:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   141
     *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   142
     * INEG, LNEG, FNEG, DNEG, IINC, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   143
     * F2D, D2I, D2L, D2F, I2B, I2C, I2S, IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   144
     * TABLESWITCH, LOOKUPSWITCH, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   145
     * PUTSTATIC, GETFIELD, NEWARRAY, ANEWARRAY, ARRAYLENGTH, ATHROW, CHECKCAST,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   146
     * INSTANCEOF, MONITORENTER, MONITOREXIT, IFNULL, IFNONNULL
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   147
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   148
     * @param insn
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   149
     *            the bytecode instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   150
     * @param value
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   151
     *            the argument of the instruction to be interpreted.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   152
     * @return the result of the interpretation of the given instruction.
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   153
     * @throws AnalyzerException
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17420
diff changeset
   154
     *             if an error occurred during the interpretation.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   155
     */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   156
    public abstract V unaryOperation(AbstractInsnNode insn, V value)
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   157
            throws AnalyzerException;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   158
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   159
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   160
     * Interprets a bytecode instruction with two arguments. This method is
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   161
     * called for the following opcodes:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   162
     *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   163
     * IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IADD,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   164
     * LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   165
     * LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, ISHL, LSHL, ISHR, LSHR, IUSHR,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   166
     * LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, LCMP, FCMPL, FCMPG, DCMPL,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   167
     * DCMPG, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   168
     * IF_ACMPEQ, IF_ACMPNE, PUTFIELD
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   169
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   170
     * @param insn
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   171
     *            the bytecode instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   172
     * @param value1
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   173
     *            the first argument of the instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   174
     * @param value2
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   175
     *            the second argument of the instruction to be interpreted.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   176
     * @return the result of the interpretation of the given instruction.
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   177
     * @throws AnalyzerException
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17420
diff changeset
   178
     *             if an error occurred during the interpretation.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   179
     */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   180
    public abstract V binaryOperation(AbstractInsnNode insn, V value1, V value2)
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   181
            throws AnalyzerException;
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   182
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   183
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   184
     * Interprets a bytecode instruction with three arguments. This method is
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   185
     * called for the following opcodes:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   186
     *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   187
     * IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   188
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   189
     * @param insn
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   190
     *            the bytecode instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   191
     * @param value1
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   192
     *            the first argument of the instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   193
     * @param value2
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   194
     *            the second argument of the instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   195
     * @param value3
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   196
     *            the third argument of the instruction to be interpreted.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   197
     * @return the result of the interpretation of the given instruction.
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   198
     * @throws AnalyzerException
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17420
diff changeset
   199
     *             if an error occurred during the interpretation.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   200
     */
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   201
    public abstract V ternaryOperation(AbstractInsnNode insn, V value1,
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   202
            V value2, V value3) throws AnalyzerException;
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   203
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   204
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   205
     * Interprets a bytecode instruction with a variable number of arguments.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   206
     * This method is called for the following opcodes:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   207
     *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   208
     * INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC, INVOKEINTERFACE,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   209
     * MULTIANEWARRAY and INVOKEDYNAMIC
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   210
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   211
     * @param insn
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   212
     *            the bytecode instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   213
     * @param values
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   214
     *            the arguments of the instruction to be interpreted.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   215
     * @return the result of the interpretation of the given instruction.
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   216
     * @throws AnalyzerException
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17420
diff changeset
   217
     *             if an error occurred during the interpretation.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   218
     */
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   219
    public abstract V naryOperation(AbstractInsnNode insn,
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   220
            List<? extends V> values) throws AnalyzerException;
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   221
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   222
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   223
     * Interprets a bytecode return instruction. This method is called for the
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   224
     * following opcodes:
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   225
     *
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   226
     * IRETURN, LRETURN, FRETURN, DRETURN, ARETURN
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   227
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   228
     * @param insn
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   229
     *            the bytecode instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   230
     * @param value
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   231
     *            the argument of the instruction to be interpreted.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   232
     * @param expected
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   233
     *            the expected return type of the analyzed method.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   234
     * @throws AnalyzerException
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17420
diff changeset
   235
     *             if an error occurred during the interpretation.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   236
     */
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   237
    public abstract void returnOperation(AbstractInsnNode insn, V value,
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   238
            V expected) throws AnalyzerException;
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   239
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   240
    /**
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   241
     * Merges two values. The merge operation must return a value that
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   242
     * represents both values (for instance, if the two values are two types,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   243
     * the merged value must be a common super type of the two types. If the two
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   244
     * values are integer intervals, the merged value must be an interval that
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   245
     * contains the previous ones. Likewise for other types of values).
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   246
     *
17420
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   247
     * @param v
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   248
     *            a value.
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   249
     * @param w
6163a8236046 8013225: Refresh jdk's private ASM to the latest.
ksrini
parents: 14198
diff changeset
   250
     *            another value.
14198
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   251
     * @return the merged value. If the merged value is equal to <tt>v</tt>,
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   252
     *         this method <i>must</i> return <tt>v</tt>.
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   253
     */
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   254
    public abstract V merge(V v, V w);
071fd6fd257d 7197401: Add a subset of the org.objectweb.asm packages to jdk8
jjh
parents:
diff changeset
   255
}