/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* The Original Code is HAT. The Initial Developer of the
* Original Code is Bill Foote, with contributions from others
*/
/**
* An array of values, that is, an array of ints, boolean, floats or the like.
*
* @author Bill Foote
*/
/*imports*/ implements ArrayTypeCodes {
switch (sig) {
case 'B':
return "byte[]";
case 'Z':
return "boolean[]";
case 'C':
return "char[]";
case 'S':
return "short[]";
case 'I':
return "int[]";
case 'F':
return "float[]";
case 'J':
return "long[]";
case 'D':
return "double[]";
default:
}
}
switch (type) {
case T_BYTE:
case T_BOOLEAN:
return 1;
case T_CHAR:
case T_SHORT:
return 2;
case T_INT:
case T_FLOAT:
return 4;
case T_LONG:
case T_DOUBLE:
return 8;
default:
}
}
/*
* Java primitive array record (HPROF_GC_PRIM_ARRAY_DUMP) looks
* as below:
*
* object ID
* stack trace serial number (int)
* length of the instance data (int)
* element type (byte)
* array data
*/
// length of the array
// typecode of array element type
}
// length of the array
// typecode of array element type
if (length == 0) {
return Snapshot.EMPTY_BYTE_ARRAY;
} else {
return res;
}
}
// JavaClass set only after resolve.
// This field contains elementSignature byte and
// divider to be used to calculate length. Note that
// length of content byte[] is not same as array length.
// Actual array length is (byte[].length / divider)
private int data;
// First 8 bits of data is used for element signature
// Next 8 bits of data is used for length divider
// Number of bits to shift to get length divider
super(offset);
}
return clazz;
}
super.visitReferencedObjects(v);
}
return;
}
byte elementSig = getElementType();
}
getClazz().addInstance(this);
}
public int getLength() {
if (divider == 0) {
byte elementSignature = getElementType();
switch (elementSignature) {
case 'B':
case 'Z':
divider = 1;
break;
case 'C':
case 'S':
divider = 2;
break;
case 'I':
case 'F':
divider = 4;
break;
case 'J':
case 'D':
divider = 8;
break;
default:
throw new RuntimeException("unknown primitive type: " +
}
}
return (getValueLength() / divider);
}
final byte et = getElementType();
int index = 0;
switch (et) {
case 'Z': {
for (int i = 0; i < len; i++) {
index++;
}
return res;
}
case 'B': {
for (int i = 0; i < len; i++) {
index++;
}
return res;
}
case 'C': {
for (int i = 0; i < len; i++) {
index += 2;
}
return res;
}
case 'S': {
for (int i = 0; i < len; i++) {
index += 2;
}
return res;
}
case 'I': {
for (int i = 0; i < len; i++) {
index += 4;
}
return res;
}
case 'J': {
for (int i = 0; i < len; i++) {
index += 8;
}
return res;
}
case 'F': {
for (int i = 0; i < len; i++) {
index += 4;
}
return res;
}
case 'D': {
for (int i = 0; i < len; i++) {
index += 8;
}
return res;
}
default: {
throw new RuntimeException("unknown primitive type?");
}
}
}
public byte getElementType() {
return (byte) (data & SIGNATURE_MASK);
}
throw new ArrayIndexOutOfBoundsException(index);
}
}
if (getElementType() != type) {
}
}
requireType('Z');
}
requireType('B');
}
requireType('C');
}
requireType('S');
}
requireType('I');
}
requireType('J');
}
requireType('F');
}
requireType('D');
}
return valueString(true);
}
// Char arrays deserve special treatment
byte elementSignature = getElementType();
if (elementSignature == 'C') {
result = new StringBuffer();
i += 2;
}
} else {
int limit = 8;
if (bigLimit) {
limit = 1000;
}
int num = 0;
if (num > 0) {
}
break;
}
num++;
switch (elementSignature) {
case 'Z': {
if (val) {
} else {
}
i++;
break;
}
case 'B': {
i++;
break;
}
case 'S': {
i += 2;
break;
}
case 'I': {
i += 4;
break;
}
case 'J': { // long
i += 8;
break;
}
case 'F': {
i += 4;
break;
}
case 'D': { // double
i += 8;
break;
}
default: {
throw new RuntimeException("unknown primitive type?");
}
}
}
}
}
}