47 super(addr);
48 }
49
50 public static long alignSize(long size) {
51 // natural word size.
52 return VM.getVM().alignUp(size, VM.getVM().getBytesPerWord());
53 }
54
55 private static VirtualBaseConstructor<Metadata> metadataConstructor;
56
57 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
58 metadataConstructor = new VirtualBaseConstructor<>(db, db.lookupType("Metadata"), null, null);
59 // Define an explicit mapping since the C++ and Java type names don't match.
60 metadataConstructor.addMapping("Metadata", Metadata.class);
61 metadataConstructor.addMapping("Klass", Klass.class);
62 metadataConstructor.addMapping("InstanceKlass", InstanceKlass.class);
63 metadataConstructor.addMapping("InstanceMirrorKlass", InstanceMirrorKlass.class);
64 metadataConstructor.addMapping("InstanceRefKlass", InstanceRefKlass.class);
65 metadataConstructor.addMapping("InstanceClassLoaderKlass", InstanceClassLoaderKlass.class);
66 metadataConstructor.addMapping("InstanceStackChunkKlass", InstanceStackChunkKlass.class);
67 metadataConstructor.addMapping("TypeArrayKlass", TypeArrayKlass.class);
68 metadataConstructor.addMapping("ObjArrayKlass", ObjArrayKlass.class);
69 metadataConstructor.addMapping("Method", Method.class);
70 metadataConstructor.addMapping("MethodData", MethodData.class);
71 metadataConstructor.addMapping("ConstMethod", ConstMethod.class);
72 metadataConstructor.addMapping("ConstantPool", ConstantPool.class);
73 metadataConstructor.addMapping("ConstantPoolCache", ConstantPoolCache.class);
74 metadataConstructor.addMapping("Annotations", Annotations.class);
75 }
76
77 public static Metadata instantiateWrapperFor(Address addr) {
78 return metadataConstructor.instantiateWrapperFor(addr);
79 }
80
81 public void iterate(MetadataVisitor visitor) {
82 visitor.setObj(this);
83 visitor.prologue();
84 iterateFields(visitor);
85 visitor.epilogue();
86 }
87
88 void iterateFields(MetadataVisitor visitor) {
|
47 super(addr);
48 }
49
50 public static long alignSize(long size) {
51 // natural word size.
52 return VM.getVM().alignUp(size, VM.getVM().getBytesPerWord());
53 }
54
55 private static VirtualBaseConstructor<Metadata> metadataConstructor;
56
57 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
58 metadataConstructor = new VirtualBaseConstructor<>(db, db.lookupType("Metadata"), null, null);
59 // Define an explicit mapping since the C++ and Java type names don't match.
60 metadataConstructor.addMapping("Metadata", Metadata.class);
61 metadataConstructor.addMapping("Klass", Klass.class);
62 metadataConstructor.addMapping("InstanceKlass", InstanceKlass.class);
63 metadataConstructor.addMapping("InstanceMirrorKlass", InstanceMirrorKlass.class);
64 metadataConstructor.addMapping("InstanceRefKlass", InstanceRefKlass.class);
65 metadataConstructor.addMapping("InstanceClassLoaderKlass", InstanceClassLoaderKlass.class);
66 metadataConstructor.addMapping("InstanceStackChunkKlass", InstanceStackChunkKlass.class);
67 metadataConstructor.addMapping("InlineKlass", InlineKlass.class);
68 metadataConstructor.addMapping("TypeArrayKlass", TypeArrayKlass.class);
69 metadataConstructor.addMapping("ObjArrayKlass", ObjArrayKlass.class);
70 metadataConstructor.addMapping("FlatArrayKlass", FlatArrayKlass.class);
71 metadataConstructor.addMapping("Method", Method.class);
72 metadataConstructor.addMapping("MethodData", MethodData.class);
73 metadataConstructor.addMapping("ConstMethod", ConstMethod.class);
74 metadataConstructor.addMapping("ConstantPool", ConstantPool.class);
75 metadataConstructor.addMapping("ConstantPoolCache", ConstantPoolCache.class);
76 metadataConstructor.addMapping("Annotations", Annotations.class);
77 }
78
79 public static Metadata instantiateWrapperFor(Address addr) {
80 return metadataConstructor.instantiateWrapperFor(addr);
81 }
82
83 public void iterate(MetadataVisitor visitor) {
84 visitor.setObj(this);
85 visitor.prologue();
86 iterateFields(visitor);
87 visitor.epilogue();
88 }
89
90 void iterateFields(MetadataVisitor visitor) {
|