224 if (isLinked()) { 225 result |= JVMDIClassStatus.VERIFIED | JVMDIClassStatus.PREPARED; 226 } 227 228 if (isInitialized()) { 229 if (Assert.ASSERTS_ENABLED) { 230 Assert.that(isLinked(), "Class status is not consistent"); 231 } 232 result |= JVMDIClassStatus.INITIALIZED; 233 } 234 235 if (isInErrorState()) { 236 result |= JVMDIClassStatus.ERROR; 237 } 238 return result; 239 } 240 241 // Byteside of the header 242 private static long headerSize; 243 244 public static long getHeaderSize() { return headerSize; } 245 246 // Accessors for declared fields 247 public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); } 248 public ObjArray getMethods() { return (ObjArray) methods.getValue(this); } 249 public TypeArray getMethodOrdering() { return (TypeArray) methodOrdering.getValue(this); } 250 public ObjArray getLocalInterfaces() { return (ObjArray) localInterfaces.getValue(this); } 251 public ObjArray getTransitiveInterfaces() { return (ObjArray) transitiveInterfaces.getValue(this); } 252 public long nofImplementors() { return nofImplementors.getValue(this); } 253 public Klass getImplementor() { return (Klass) implementors[0].getValue(this); } 254 public Klass getImplementor(int i) { return (Klass) implementors[i].getValue(this); } 255 public TypeArray getFields() { return (TypeArray) fields.getValue(this); } 256 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } 257 public Oop getClassLoader() { return classLoader.getValue(this); } 258 public Oop getProtectionDomain() { return protectionDomain.getValue(this); } 259 public ObjArray getSigners() { return (ObjArray) signers.getValue(this); } 260 public Symbol getSourceFileName() { return getSymbol(sourceFileName); } 261 public Symbol getSourceDebugExtension(){ return getSymbol(sourceDebugExtension); } 262 public TypeArray getInnerClasses() { return (TypeArray) innerClasses.getValue(this); } 263 public long getNonstaticFieldSize() { return nonstaticFieldSize.getValue(this); } 442 visitor.doOop(localInterfaces, true); 443 visitor.doOop(transitiveInterfaces, true); 444 visitor.doCInt(nofImplementors, true); 445 for (int i = 0; i < IMPLEMENTORS_LIMIT; i++) 446 visitor.doOop(implementors[i], true); 447 visitor.doOop(fields, true); 448 visitor.doOop(constants, true); 449 visitor.doOop(classLoader, true); 450 visitor.doOop(protectionDomain, true); 451 visitor.doOop(signers, true); 452 visitor.doOop(innerClasses, true); 453 visitor.doCInt(nonstaticFieldSize, true); 454 visitor.doCInt(staticFieldSize, true); 455 visitor.doCInt(staticOopFieldCount, true); 456 visitor.doCInt(nonstaticOopMapSize, true); 457 visitor.doCInt(isMarkedDependent, true); 458 visitor.doCInt(initState, true); 459 visitor.doCInt(vtableLen, true); 460 visitor.doCInt(itableLen, true); 461 } 462 463 TypeArray fields = getFields(); 464 int length = (int) fields.getLength(); 465 for (int index = 0; index < length; index += NEXT_OFFSET) { 466 short accessFlags = fields.getShortAt(index + ACCESS_FLAGS_OFFSET); 467 short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET); 468 FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex)); 469 AccessFlags access = new AccessFlags(accessFlags); 470 if (access.isStatic()) { 471 visitField(visitor, type, index); 472 } 473 } 474 } 475 476 public Klass getJavaSuper() { 477 return getSuper(); 478 } 479 480 public void iterateNonStaticFields(OopVisitor visitor) { 481 if (getSuper() != null) { 482 ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor); 483 } 484 TypeArray fields = getFields(); 485 486 int length = (int) fields.getLength(); 487 for (int index = 0; index < length; index += NEXT_OFFSET) { 488 short accessFlags = fields.getShortAt(index + ACCESS_FLAGS_OFFSET); 489 short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET); 490 491 FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex)); 492 AccessFlags access = new AccessFlags(accessFlags); 493 if (!access.isStatic()) { 494 visitField(visitor, type, index); 495 } 496 } 497 } 498 499 /** Field access by name. */ 500 public Field findLocalField(Symbol name, Symbol sig) { 501 TypeArray fields = getFields(); 502 int n = (int) fields.getLength(); | 224 if (isLinked()) { 225 result |= JVMDIClassStatus.VERIFIED | JVMDIClassStatus.PREPARED; 226 } 227 228 if (isInitialized()) { 229 if (Assert.ASSERTS_ENABLED) { 230 Assert.that(isLinked(), "Class status is not consistent"); 231 } 232 result |= JVMDIClassStatus.INITIALIZED; 233 } 234 235 if (isInErrorState()) { 236 result |= JVMDIClassStatus.ERROR; 237 } 238 return result; 239 } 240 241 // Byteside of the header 242 private static long headerSize; 243 244 public long getObjectSize(Oop object) { 245 return getSizeHelper() * VM.getVM().getAddressSize(); 246 } 247 248 public static long getHeaderSize() { return headerSize; } 249 250 // Accessors for declared fields 251 public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); } 252 public ObjArray getMethods() { return (ObjArray) methods.getValue(this); } 253 public TypeArray getMethodOrdering() { return (TypeArray) methodOrdering.getValue(this); } 254 public ObjArray getLocalInterfaces() { return (ObjArray) localInterfaces.getValue(this); } 255 public ObjArray getTransitiveInterfaces() { return (ObjArray) transitiveInterfaces.getValue(this); } 256 public long nofImplementors() { return nofImplementors.getValue(this); } 257 public Klass getImplementor() { return (Klass) implementors[0].getValue(this); } 258 public Klass getImplementor(int i) { return (Klass) implementors[i].getValue(this); } 259 public TypeArray getFields() { return (TypeArray) fields.getValue(this); } 260 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } 261 public Oop getClassLoader() { return classLoader.getValue(this); } 262 public Oop getProtectionDomain() { return protectionDomain.getValue(this); } 263 public ObjArray getSigners() { return (ObjArray) signers.getValue(this); } 264 public Symbol getSourceFileName() { return getSymbol(sourceFileName); } 265 public Symbol getSourceDebugExtension(){ return getSymbol(sourceDebugExtension); } 266 public TypeArray getInnerClasses() { return (TypeArray) innerClasses.getValue(this); } 267 public long getNonstaticFieldSize() { return nonstaticFieldSize.getValue(this); } 446 visitor.doOop(localInterfaces, true); 447 visitor.doOop(transitiveInterfaces, true); 448 visitor.doCInt(nofImplementors, true); 449 for (int i = 0; i < IMPLEMENTORS_LIMIT; i++) 450 visitor.doOop(implementors[i], true); 451 visitor.doOop(fields, true); 452 visitor.doOop(constants, true); 453 visitor.doOop(classLoader, true); 454 visitor.doOop(protectionDomain, true); 455 visitor.doOop(signers, true); 456 visitor.doOop(innerClasses, true); 457 visitor.doCInt(nonstaticFieldSize, true); 458 visitor.doCInt(staticFieldSize, true); 459 visitor.doCInt(staticOopFieldCount, true); 460 visitor.doCInt(nonstaticOopMapSize, true); 461 visitor.doCInt(isMarkedDependent, true); 462 visitor.doCInt(initState, true); 463 visitor.doCInt(vtableLen, true); 464 visitor.doCInt(itableLen, true); 465 } 466 } 467 468 /* 469 * Visit the static fields of this InstanceKlass with the obj of 470 * the visitor set to the oop holding the fields, which is 471 * currently the java mirror. 472 */ 473 public void iterateStaticFields(OopVisitor visitor) { 474 visitor.setObj(getJavaMirror()); 475 visitor.prologue(); 476 iterateStaticFieldsInternal(visitor); 477 visitor.epilogue(); 478 479 } 480 481 void iterateStaticFieldsInternal(OopVisitor visitor) { 482 TypeArray fields = getFields(); 483 int length = (int) fields.getLength(); 484 for (int index = 0; index < length; index += NEXT_OFFSET) { 485 short accessFlags = fields.getShortAt(index + ACCESS_FLAGS_OFFSET); 486 short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET); 487 FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex)); 488 AccessFlags access = new AccessFlags(accessFlags); 489 if (access.isStatic()) { 490 visitField(visitor, type, index); 491 } 492 } 493 } 494 495 public Klass getJavaSuper() { 496 return getSuper(); 497 } 498 499 public void iterateNonStaticFields(OopVisitor visitor, Oop obj) { 500 if (getSuper() != null) { 501 ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj); 502 } 503 TypeArray fields = getFields(); 504 505 int length = (int) fields.getLength(); 506 for (int index = 0; index < length; index += NEXT_OFFSET) { 507 short accessFlags = fields.getShortAt(index + ACCESS_FLAGS_OFFSET); 508 short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET); 509 510 FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex)); 511 AccessFlags access = new AccessFlags(accessFlags); 512 if (!access.isStatic()) { 513 visitField(visitor, type, index); 514 } 515 } 516 } 517 518 /** Field access by name. */ 519 public Field findLocalField(Symbol name, Symbol sig) { 520 TypeArray fields = getFields(); 521 int n = (int) fields.getLength(); |