equal
deleted
inserted
replaced
511 } |
511 } |
512 |
512 |
513 void iterateStaticFieldsInternal(OopVisitor visitor) { |
513 void iterateStaticFieldsInternal(OopVisitor visitor) { |
514 TypeArray fields = getFields(); |
514 TypeArray fields = getFields(); |
515 int length = getJavaFieldsCount(); |
515 int length = getJavaFieldsCount(); |
516 for (int index = 0; index < length; index += FIELD_SLOTS) { |
516 for (int index = 0; index < length; index++) { |
517 short accessFlags = fields.getShortAt(index + ACCESS_FLAGS_OFFSET); |
517 short accessFlags = getFieldAccessFlags(index); |
518 short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET); |
518 FieldType type = new FieldType(getFieldSignature(index)); |
519 FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex)); |
|
520 AccessFlags access = new AccessFlags(accessFlags); |
519 AccessFlags access = new AccessFlags(accessFlags); |
521 if (access.isStatic()) { |
520 if (access.isStatic()) { |
522 visitField(visitor, type, index); |
521 visitField(visitor, type, index); |
523 } |
522 } |
524 } |
523 } |
543 ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj); |
542 ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj); |
544 } |
543 } |
545 TypeArray fields = getFields(); |
544 TypeArray fields = getFields(); |
546 |
545 |
547 int length = getJavaFieldsCount(); |
546 int length = getJavaFieldsCount(); |
548 for (int index = 0; index < length; index += FIELD_SLOTS) { |
547 for (int index = 0; index < length; index++) { |
549 short accessFlags = fields.getShortAt(index + ACCESS_FLAGS_OFFSET); |
548 short accessFlags = getFieldAccessFlags(index); |
550 short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET); |
549 FieldType type = new FieldType(getFieldSignature(index)); |
551 |
|
552 FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex)); |
|
553 AccessFlags access = new AccessFlags(accessFlags); |
550 AccessFlags access = new AccessFlags(accessFlags); |
554 if (!access.isStatic()) { |
551 if (!access.isStatic()) { |
555 visitField(visitor, type, index); |
552 visitField(visitor, type, index); |
556 } |
553 } |
557 } |
554 } |
560 /** Field access by name. */ |
557 /** Field access by name. */ |
561 public Field findLocalField(Symbol name, Symbol sig) { |
558 public Field findLocalField(Symbol name, Symbol sig) { |
562 TypeArray fields = getFields(); |
559 TypeArray fields = getFields(); |
563 int length = (int) fields.getLength(); |
560 int length = (int) fields.getLength(); |
564 ConstantPool cp = getConstants(); |
561 ConstantPool cp = getConstants(); |
565 for (int i = 0; i < length; i += FIELD_SLOTS) { |
562 for (int i = 0; i < length; i++) { |
566 int nameIndex = fields.getShortAt(i + NAME_INDEX_OFFSET); |
563 Symbol f_name = getFieldName(i); |
567 int sigIndex = fields.getShortAt(i + SIGNATURE_INDEX_OFFSET); |
564 Symbol f_sig = getFieldSignature(i); |
568 Symbol f_name = cp.getSymbolAt(nameIndex); |
|
569 Symbol f_sig = cp.getSymbolAt(sigIndex); |
|
570 if (name.equals(f_name) && sig.equals(f_sig)) { |
565 if (name.equals(f_name) && sig.equals(f_sig)) { |
571 return newField(i); |
566 return newField(i); |
572 } |
567 } |
573 } |
568 } |
574 |
569 |
639 return findField(name, sig); |
634 return findField(name, sig); |
640 } |
635 } |
641 |
636 |
642 /** Get field by its index in the fields array. Only designed for |
637 /** Get field by its index in the fields array. Only designed for |
643 use in a debugging system. */ |
638 use in a debugging system. */ |
644 public Field getFieldByIndex(int fieldArrayIndex) { |
639 public Field getFieldByIndex(int fieldIndex) { |
645 return newField(fieldArrayIndex); |
640 return newField(fieldIndex); |
646 } |
641 } |
647 |
642 |
648 |
643 |
649 /** Return a List of SA Fields for the fields declared in this class. |
644 /** Return a List of SA Fields for the fields declared in this class. |
650 Inherited fields are not included. |
645 Inherited fields are not included. |
655 // not including inherited fields. |
650 // not including inherited fields. |
656 TypeArray fields = getFields(); |
651 TypeArray fields = getFields(); |
657 |
652 |
658 int length = getJavaFieldsCount(); |
653 int length = getJavaFieldsCount(); |
659 List immediateFields = new ArrayList(length); |
654 List immediateFields = new ArrayList(length); |
660 for (int index = 0; index < length; index += FIELD_SLOTS) { |
655 for (int index = 0; index < length; index++) { |
661 immediateFields.add(getFieldByIndex(index)); |
656 immediateFields.add(getFieldByIndex(index)); |
662 } |
657 } |
663 |
658 |
664 return immediateFields; |
659 return immediateFields; |
665 } |
660 } |
843 } |
838 } |
844 |
839 |
845 // Creates new field from index in fields TypeArray |
840 // Creates new field from index in fields TypeArray |
846 private Field newField(int index) { |
841 private Field newField(int index) { |
847 TypeArray fields = getFields(); |
842 TypeArray fields = getFields(); |
848 short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET); |
843 FieldType type = new FieldType(getFieldSignature(index)); |
849 FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex)); |
|
850 if (type.isOop()) { |
844 if (type.isOop()) { |
851 if (VM.getVM().isCompressedOopsEnabled()) { |
845 if (VM.getVM().isCompressedOopsEnabled()) { |
852 return new NarrowOopField(this, index); |
846 return new NarrowOopField(this, index); |
853 } else { |
847 } else { |
854 return new OopField(this, index); |
848 return new OopField(this, index); |