Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java @ 3962:cb315dc80374
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
Reviewed-by: kvn
author | never |
---|---|
date | Thu, 29 Sep 2011 09:53:56 -0700 |
parents | e6b1331a51d2 |
children | 8150fa46d2ed |
comparison
equal
deleted
inserted
replaced
3961:a92cdbac8b9e | 3962:cb315dc80374 |
---|---|
377 if (DEBUG) debugMessage("\t" + index); | 377 if (DEBUG) debugMessage("\t" + index); |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 protected void writeFields() throws IOException { | 381 protected void writeFields() throws IOException { |
382 TypeArray fields = klass.getFields(); | |
383 final int length = klass.getJavaFieldsCount(); | 382 final int length = klass.getJavaFieldsCount(); |
384 | 383 |
385 // write number of fields | 384 // write number of fields |
386 dos.writeShort((short) (length / InstanceKlass.FIELD_SLOTS) ); | 385 dos.writeShort((short) length); |
387 | 386 |
388 if (DEBUG) debugMessage("number of fields = " | 387 if (DEBUG) debugMessage("number of fields = " + length); |
389 + length/InstanceKlass.FIELD_SLOTS); | 388 |
390 | 389 for (int index = 0; index < length; index++) { |
391 for (int index = 0; index < length; index += InstanceKlass.FIELD_SLOTS) { | 390 short accessFlags = klass.getFieldAccessFlags(index); |
392 short accessFlags = fields.getShortAt(index + InstanceKlass.ACCESS_FLAGS_OFFSET); | |
393 dos.writeShort(accessFlags & (short) JVM_RECOGNIZED_FIELD_MODIFIERS); | 391 dos.writeShort(accessFlags & (short) JVM_RECOGNIZED_FIELD_MODIFIERS); |
394 | 392 |
395 short nameIndex = fields.getShortAt(index + InstanceKlass.NAME_INDEX_OFFSET); | 393 short nameIndex = klass.getFieldNameIndex(index); |
396 dos.writeShort(nameIndex); | 394 dos.writeShort(nameIndex); |
397 | 395 |
398 short signatureIndex = fields.getShortAt(index + InstanceKlass.SIGNATURE_INDEX_OFFSET); | 396 short signatureIndex = klass.getFieldSignatureIndex(index); |
399 dos.writeShort(signatureIndex); | 397 dos.writeShort(signatureIndex); |
400 if (DEBUG) debugMessage("\tfield name = " + nameIndex + ", signature = " + signatureIndex); | 398 if (DEBUG) debugMessage("\tfield name = " + nameIndex + ", signature = " + signatureIndex); |
401 | 399 |
402 short fieldAttributeCount = 0; | 400 short fieldAttributeCount = 0; |
403 boolean hasSyn = hasSyntheticAttribute(accessFlags); | 401 boolean hasSyn = hasSyntheticAttribute(accessFlags); |
404 if (hasSyn) | 402 if (hasSyn) |
405 fieldAttributeCount++; | 403 fieldAttributeCount++; |
406 | 404 |
407 short initvalIndex = fields.getShortAt(index + InstanceKlass.INITVAL_INDEX_OFFSET); | 405 short initvalIndex = klass.getFieldInitialValueIndex(index); |
408 if (initvalIndex != 0) | 406 if (initvalIndex != 0) |
409 fieldAttributeCount++; | 407 fieldAttributeCount++; |
410 | 408 |
411 short genSigIndex = fields.getShortAt(index + InstanceKlass.GENERIC_SIGNATURE_INDEX_OFFSET); | 409 short genSigIndex = klass.getFieldGenericSignatureIndex(index); |
412 if (genSigIndex != 0) | 410 if (genSigIndex != 0) |
413 fieldAttributeCount++; | 411 fieldAttributeCount++; |
414 | 412 |
415 dos.writeShort(fieldAttributeCount); | 413 dos.writeShort(fieldAttributeCount); |
416 | 414 |