hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java
author jiangli
Wed, 06 Jun 2012 14:33:43 -0400
changeset 12937 0032fb2caff6
parent 10251 71b8938a2821
child 13282 9872915dd78d
permissions -rw-r--r--
7172967: Eliminate constMethod's _method backpointer to methodOop. Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod. Reviewed-by: roland, bdelsart, kamg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
     2
 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
package sun.jvm.hotspot.oops;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
import java.io.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
import java.util.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
import sun.jvm.hotspot.code.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
import sun.jvm.hotspot.debugger.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
import sun.jvm.hotspot.interpreter.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
import sun.jvm.hotspot.memory.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
import sun.jvm.hotspot.runtime.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
import sun.jvm.hotspot.types.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
import sun.jvm.hotspot.utilities.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
public class ConstMethod extends Oop {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  static {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    VM.registerVMInitializedObserver(new Observer() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
        public void update(Observable o, Object data) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
          initialize(VM.getVM().getTypeDataBase());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
      });
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // anon-enum constants for _flags.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  private static int HAS_LINENUMBER_TABLE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  private static int HAS_CHECKED_EXCEPTIONS;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  private static int HAS_LOCALVARIABLE_TABLE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    Type type                  = db.lookupType("constMethodOopDesc");
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
    53
    constants                  = new OopField(type.getOopField("_constants"), 0);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    // The exception handler table. 4-tuples of ints [start_pc, end_pc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    // handler_pc, catch_type index] For methods with no exceptions the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    // table is pointing to Universe::the_empty_int_array
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    exceptionTable             = new OopField(type.getOopField("_exception_table"), 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    constMethodSize            = new CIntField(type.getCIntegerField("_constMethod_size"), 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    flags                      = new ByteField(type.getJByteField("_flags"), 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    // enum constants for flags
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    HAS_LINENUMBER_TABLE      = db.lookupIntConstant("constMethodOopDesc::_has_linenumber_table").intValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    HAS_CHECKED_EXCEPTIONS     = db.lookupIntConstant("constMethodOopDesc::_has_checked_exceptions").intValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    HAS_LOCALVARIABLE_TABLE   = db.lookupIntConstant("constMethodOopDesc::_has_localvariable_table").intValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    // Size of Java bytecodes allocated immediately after constMethodOop.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    codeSize                   = new CIntField(type.getCIntegerField("_code_size"), 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    nameIndex                  = new CIntField(type.getCIntegerField("_name_index"), 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    signatureIndex             = new CIntField(type.getCIntegerField("_signature_index"), 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    genericSignatureIndex      = new CIntField(type.getCIntegerField("_generic_signature_index"),0);
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
    71
    idnum                      = new CIntField(type.getCIntegerField("_method_idnum"), 0);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    // start of byte code
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    bytecodeOffset = type.getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    type                       = db.lookupType("CheckedExceptionElement");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    checkedExceptionElementSize = type.getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    type                       = db.lookupType("LocalVariableTableElement");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    localVariableTableElementSize = type.getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  ConstMethod(OopHandle handle, ObjectHeap heap) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    super(handle, heap);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  // Fields
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
    88
  private static OopField  constants;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  private static OopField  exceptionTable;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  private static CIntField constMethodSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  private static ByteField flags;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  private static CIntField codeSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  private static CIntField nameIndex;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  private static CIntField signatureIndex;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  private static CIntField genericSignatureIndex;
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
    96
  private static CIntField idnum;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  // start of bytecode
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  private static long bytecodeOffset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  private static long checkedExceptionElementSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  private static long localVariableTableElementSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   104
  public Method getMethod() {
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   105
    InstanceKlass ik = (InstanceKlass)getConstants().getPoolHolder();
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   106
    ObjArray methods = ik.getMethods();
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   107
    return (Method)methods.getObjAt(getIdNum());
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   108
  }
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   109
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  // Accessors for declared fields
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   111
  public ConstantPool getConstants() {
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   112
    return (ConstantPool) constants.getValue(this);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  public TypeArray getExceptionTable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    return (TypeArray) exceptionTable.getValue(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  public long getConstMethodSize() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    return constMethodSize.getValue(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  public byte getFlags() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    return flags.getValue(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  public long getCodeSize() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    return codeSize.getValue(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  public long getNameIndex() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    return nameIndex.getValue(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  public long getSignatureIndex() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    return signatureIndex.getValue(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  public long getGenericSignatureIndex() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    return genericSignatureIndex.getValue(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   143
  public long getIdNum() {
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   144
    return idnum.getValue(this);
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   145
  }
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   146
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  public Symbol getName() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    return getMethod().getName();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  public Symbol getSignature() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    return getMethod().getSignature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  public Symbol getGenericSignature() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    return getMethod().getGenericSignature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  // bytecode accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  /** Get a bytecode or breakpoint at the given bci */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  public int getBytecodeOrBPAt(int bci) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    return getHandle().getJByteAt(bytecodeOffset + bci) & 0xFF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  public byte getBytecodeByteArg(int bci) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    return (byte) getBytecodeOrBPAt(bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  /** Fetches a 16-bit big-endian ("Java ordered") value from the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
      bytecode stream */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  public short getBytecodeShortArg(int bci) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    int hi = getBytecodeOrBPAt(bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    int lo = getBytecodeOrBPAt(bci + 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    return (short) ((hi << 8) | lo);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
10251
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   178
  /** Fetches a 16-bit native ordered value from the
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   179
      bytecode stream */
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   180
  public short getNativeShortArg(int bci) {
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   181
    int hi = getBytecodeOrBPAt(bci);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   182
    int lo = getBytecodeOrBPAt(bci + 1);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   183
    if (VM.getVM().isBigEndian()) {
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   184
        return (short) ((hi << 8) | lo);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   185
    } else {
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   186
        return (short) ((lo << 8) | hi);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   187
    }
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   188
  }
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   189
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  /** Fetches a 32-bit big-endian ("Java ordered") value from the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
      bytecode stream */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  public int getBytecodeIntArg(int bci) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    int b4 = getBytecodeOrBPAt(bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    int b3 = getBytecodeOrBPAt(bci + 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    int b2 = getBytecodeOrBPAt(bci + 2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    int b1 = getBytecodeOrBPAt(bci + 3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
10251
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   201
  /** Fetches a 32-bit native ordered value from the
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   202
      bytecode stream */
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   203
  public int getNativeIntArg(int bci) {
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   204
    int b4 = getBytecodeOrBPAt(bci);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   205
    int b3 = getBytecodeOrBPAt(bci + 1);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   206
    int b2 = getBytecodeOrBPAt(bci + 2);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   207
    int b1 = getBytecodeOrBPAt(bci + 3);
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   208
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   209
    if (VM.getVM().isBigEndian()) {
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   210
        return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   211
    } else {
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   212
        return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   213
    }
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   214
  }
71b8938a2821 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 5547
diff changeset
   215
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  public byte[] getByteCode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
     byte[] bc = new byte[ (int) getCodeSize() ];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
     for( int i=0; i < bc.length; i++ )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
     {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
        long offs = bytecodeOffset + i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
        bc[i] = getHandle().getJByteAt( offs );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
     return bc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  public long getObjectSize() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    return getConstMethodSize() * getHeap().getOopSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  public void printValueOn(PrintStream tty) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    tty.print("ConstMethod " + getName().asString() + getSignature().asString() + "@" + getHandle());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  public void iterateFields(OopVisitor visitor, boolean doVMFields) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    super.iterateFields(visitor, doVMFields);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    if (doVMFields) {
12937
0032fb2caff6 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 10251
diff changeset
   237
      visitor.doOop(constants, true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
      visitor.doOop(exceptionTable, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
      visitor.doCInt(constMethodSize, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
      visitor.doByte(flags, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
      visitor.doCInt(codeSize, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
      visitor.doCInt(nameIndex, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
      visitor.doCInt(signatureIndex, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
      visitor.doCInt(genericSignatureIndex, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
      visitor.doCInt(codeSize, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  public boolean hasLineNumberTable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    return (getFlags() & HAS_LINENUMBER_TABLE) != 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  public int getLineNumberFromBCI(int bci) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
    if (!VM.getVM().isCore()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
      if (bci == DebugInformationRecorder.SYNCHRONIZATION_ENTRY_BCI) bci = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    if (isNative()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
      return -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
      Assert.that(bci == 0 || 0 <= bci && bci < getCodeSize(), "illegal bci");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
    int bestBCI  =  0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
    int bestLine = -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
    if (hasLineNumberTable()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
      // The line numbers are a short array of 2-tuples [start_pc, line_number].
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
      // Not necessarily sorted and not necessarily one-to-one.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
      CompressedLineNumberReadStream stream =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
        new CompressedLineNumberReadStream(getHandle(), (int) offsetOfCompressedLineNumberTable());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
      while (stream.readPair()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
        if (stream.bci() == bci) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
          // perfect match
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
          return stream.line();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
          // update best_bci/line
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
          if (stream.bci() < bci && stream.bci() >= bestBCI) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
            bestBCI  = stream.bci();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
            bestLine = stream.line();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
    return bestLine;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  public LineNumberTableElement[] getLineNumberTable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
      Assert.that(hasLineNumberTable(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
                  "should only be called if table is present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
    int len = getLineNumberTableLength();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    CompressedLineNumberReadStream stream =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
      new CompressedLineNumberReadStream(getHandle(), (int) offsetOfCompressedLineNumberTable());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    LineNumberTableElement[] ret = new LineNumberTableElement[len];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
    for (int idx = 0; idx < len; idx++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
      stream.readPair();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
      ret[idx] = new LineNumberTableElement(stream.bci(), stream.line());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
    return ret;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  public boolean hasLocalVariableTable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
    return (getFlags() & HAS_LOCALVARIABLE_TABLE) != 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  public Symbol getLocalVariableName(int bci, int slot) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
    return getMethod().getLocalVariableName(bci, slot);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  /** Should only be called if table is present */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  public LocalVariableTableElement[] getLocalVariableTable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
      Assert.that(hasLocalVariableTable(), "should only be called if table is present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
    LocalVariableTableElement[] ret = new LocalVariableTableElement[getLocalVariableTableLength()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
    long offset = offsetOfLocalVariableTable();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
    for (int i = 0; i < ret.length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
      ret[i] = new LocalVariableTableElement(getHandle(), offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
      offset += localVariableTableElementSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    return ret;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  public boolean hasCheckedExceptions() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
    return (getFlags() & HAS_CHECKED_EXCEPTIONS) != 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  public CheckedExceptionElement[] getCheckedExceptions() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
      Assert.that(hasCheckedExceptions(), "should only be called if table is present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    CheckedExceptionElement[] ret = new CheckedExceptionElement[getCheckedExceptionsLength()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
    long offset = offsetOfCheckedExceptions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
    for (int i = 0; i < ret.length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
      ret[i] = new CheckedExceptionElement(getHandle(), offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
      offset += checkedExceptionElementSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
    return ret;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  //---------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  // Internals only below this point
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  private boolean isNative() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    return getMethod().isNative();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  // Offset of end of code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  private long offsetOfCodeEnd() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
    return bytecodeOffset + getCodeSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  // Offset of start of compressed line number table (see methodOop.hpp)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  private long offsetOfCompressedLineNumberTable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    return offsetOfCodeEnd() + (isNative() ? 2 * VM.getVM().getAddressSize() : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  // Offset of last short in methodOop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  private long offsetOfLastU2Element() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
    return getObjectSize() - 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  private long offsetOfCheckedExceptionsLength() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
    return offsetOfLastU2Element();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  private int getCheckedExceptionsLength() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    if (hasCheckedExceptions()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
      return (int) getHandle().getCIntegerAt(offsetOfCheckedExceptionsLength(), 2, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
      return 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  // Offset of start of checked exceptions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  private long offsetOfCheckedExceptions() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    long offset = offsetOfCheckedExceptionsLength();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    long length = getCheckedExceptionsLength();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
      Assert.that(length > 0, "should only be called if table is present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    offset -= length * checkedExceptionElementSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    return offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  private int getLineNumberTableLength() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    int len = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
    if (hasLineNumberTable()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
      CompressedLineNumberReadStream stream =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
        new CompressedLineNumberReadStream(getHandle(), (int) offsetOfCompressedLineNumberTable());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
      while (stream.readPair()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
        len += 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    return len;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  private int getLocalVariableTableLength() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    if (hasLocalVariableTable()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
      return (int) getHandle().getCIntegerAt(offsetOfLocalVariableTableLength(), 2, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
      return 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  // Offset of local variable table length
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
  private long offsetOfLocalVariableTableLength() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
      Assert.that(hasLocalVariableTable(), "should only be called if table is present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    if (hasCheckedExceptions()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
      return offsetOfCheckedExceptions() - 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
      return offsetOfLastU2Element();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
  private long offsetOfLocalVariableTable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
    long offset = offsetOfLocalVariableTableLength();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
    long length = getLocalVariableTableLength();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
      Assert.that(length > 0, "should only be called if table is present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
    offset -= length * localVariableTableElementSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    return offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
}