1 /*
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
110 }
111 return objectInitializerName;
112 }
113 private static Symbol classInitializerName() {
114 if (classInitializerName == null) {
115 classInitializerName = VM.getVM().getSymbolTable().probe("<clinit>");
116 }
117 return classInitializerName;
118 }
119
120
121 /*
122 private static AddressCField interpreterEntry;
123 private static AddressCField fromCompiledCodeEntryPoint;
124 */
125
126 // Accessors for declared fields
127 public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); }
128 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
129 public MethodData getMethodData() { return (MethodData) methodData.getValue(this); }
130 public TypeArray getExceptionTable() { return getConstMethod().getExceptionTable(); }
131 /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
132 public long getMethodSize() { return methodSize.getValue(this); }
133 public long getMaxStack() { return maxStack.getValue(this); }
134 public long getMaxLocals() { return maxLocals.getValue(this); }
135 public long getSizeOfParameters() { return sizeOfParameters.getValue(this); }
136 public long getNameIndex() { return getConstMethod().getNameIndex(); }
137 public long getSignatureIndex() { return getConstMethod().getSignatureIndex(); }
138 public long getGenericSignatureIndex() { return getConstMethod().getGenericSignatureIndex(); }
139 public long getAccessFlags() { return accessFlags.getValue(this); }
140 public long getCodeSize() { return getConstMethod().getCodeSize(); }
141 public long getVtableIndex() { return vtableIndex.getValue(this); }
142 public long getInvocationCounter() {
143 if (Assert.ASSERTS_ENABLED) {
144 Assert.that(!VM.getVM().isCore(), "must not be used in core build");
145 }
146 return invocationCounter.getValue(this);
147 }
148 public long getBackedgeCounter() {
149 if (Assert.ASSERTS_ENABLED) {
150 Assert.that(!VM.getVM().isCore(), "must not be used in core build");
312 }
313
314 public Symbol getLocalVariableName(int bci, int slot) {
315 if (! hasLocalVariableTable()) {
316 return null;
317 }
318
319 LocalVariableTableElement[] locals = getLocalVariableTable();
320 for (int l = 0; l < locals.length; l++) {
321 LocalVariableTableElement local = locals[l];
322 if ((bci >= local.getStartBCI()) &&
323 (bci < (local.getStartBCI() + local.getLength())) &&
324 slot == local.getSlot()) {
325 return getConstants().getSymbolAt(local.getNameCPIndex());
326 }
327 }
328
329 return null;
330 }
331
332 public boolean hasCheckedExceptions() {
333 return getConstMethod().hasCheckedExceptions();
334 }
335
336 /** Should only be called if table is present */
337 public CheckedExceptionElement[] getCheckedExceptions() {
338 return getConstMethod().getCheckedExceptions();
339 }
340
341 /** Returns name and signature in external form for debugging
342 purposes */
343 public String externalNameAndSignature() {
344 final StringBuffer buf = new StringBuffer();
345 buf.append(getMethodHolder().getName().asString());
346 buf.append(".");
347 buf.append(getName().asString());
348 buf.append("(");
349 new SignatureConverter(getSignature(), buf).iterateParameters();
350 buf.append(")");
351 return buf.toString().replace('/', '.');
|
1 /*
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
110 }
111 return objectInitializerName;
112 }
113 private static Symbol classInitializerName() {
114 if (classInitializerName == null) {
115 classInitializerName = VM.getVM().getSymbolTable().probe("<clinit>");
116 }
117 return classInitializerName;
118 }
119
120
121 /*
122 private static AddressCField interpreterEntry;
123 private static AddressCField fromCompiledCodeEntryPoint;
124 */
125
126 // Accessors for declared fields
127 public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); }
128 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
129 public MethodData getMethodData() { return (MethodData) methodData.getValue(this); }
130 /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
131 public long getMethodSize() { return methodSize.getValue(this); }
132 public long getMaxStack() { return maxStack.getValue(this); }
133 public long getMaxLocals() { return maxLocals.getValue(this); }
134 public long getSizeOfParameters() { return sizeOfParameters.getValue(this); }
135 public long getNameIndex() { return getConstMethod().getNameIndex(); }
136 public long getSignatureIndex() { return getConstMethod().getSignatureIndex(); }
137 public long getGenericSignatureIndex() { return getConstMethod().getGenericSignatureIndex(); }
138 public long getAccessFlags() { return accessFlags.getValue(this); }
139 public long getCodeSize() { return getConstMethod().getCodeSize(); }
140 public long getVtableIndex() { return vtableIndex.getValue(this); }
141 public long getInvocationCounter() {
142 if (Assert.ASSERTS_ENABLED) {
143 Assert.that(!VM.getVM().isCore(), "must not be used in core build");
144 }
145 return invocationCounter.getValue(this);
146 }
147 public long getBackedgeCounter() {
148 if (Assert.ASSERTS_ENABLED) {
149 Assert.that(!VM.getVM().isCore(), "must not be used in core build");
311 }
312
313 public Symbol getLocalVariableName(int bci, int slot) {
314 if (! hasLocalVariableTable()) {
315 return null;
316 }
317
318 LocalVariableTableElement[] locals = getLocalVariableTable();
319 for (int l = 0; l < locals.length; l++) {
320 LocalVariableTableElement local = locals[l];
321 if ((bci >= local.getStartBCI()) &&
322 (bci < (local.getStartBCI() + local.getLength())) &&
323 slot == local.getSlot()) {
324 return getConstants().getSymbolAt(local.getNameCPIndex());
325 }
326 }
327
328 return null;
329 }
330
331 public boolean hasExceptionTable() {
332 return getConstMethod().hasExceptionTable();
333 }
334
335 public ExceptionTableElement[] getExceptionTable() {
336 return getConstMethod().getExceptionTable();
337 }
338
339 public boolean hasCheckedExceptions() {
340 return getConstMethod().hasCheckedExceptions();
341 }
342
343 /** Should only be called if table is present */
344 public CheckedExceptionElement[] getCheckedExceptions() {
345 return getConstMethod().getCheckedExceptions();
346 }
347
348 /** Returns name and signature in external form for debugging
349 purposes */
350 public String externalNameAndSignature() {
351 final StringBuffer buf = new StringBuffer();
352 buf.append(getMethodHolder().getName().asString());
353 buf.append(".");
354 buf.append(getName().asString());
355 buf.append("(");
356 new SignatureConverter(getSignature(), buf).iterateParameters();
357 buf.append(")");
358 return buf.toString().replace('/', '.');
|