use of com.ibm.j9ddr.StructureReader.ConstantDescriptor in project openj9 by eclipse.
the class StructureStubGenerator method writeConstants.
private static void writeConstants(PrintWriter writer, StructureDescriptor structure) {
writer.println("\t// VM Constants");
writer.println();
writer.format("\tpublic static final long %s;%n", "SIZEOF");
Collections.sort(structure.getConstants());
for (ConstantDescriptor constant : structure.getConstants()) {
writer.format("\tpublic static final long %s;%n", constant.getName());
}
}
use of com.ibm.j9ddr.StructureReader.ConstantDescriptor in project openj9 by eclipse.
the class J9DDRStructureStore method updateSuperset.
public void updateSuperset() throws IOException {
StructureReader reader = null;
if ((structureBytes.length > 2) && (structureBytes[0] == SUPERSET_ID[0]) && (structureBytes[1] == SUPERSET_ID[1])) {
// creating a reader using an input stream treats it as a superset input i.e. text
InputStream in = new ByteArrayInputStream(structureBytes);
reader = new StructureReader(in);
} else {
// using an image input stream to the reader indicates that is in binary blob format
ImageInputStream inputStream = new MemoryCacheImageInputStream(new ByteArrayInputStream(structureBytes));
reader = new StructureReader(inputStream);
}
for (StructureDescriptor structure : reader.getStructures()) {
String structureHeader = structure.deflate();
HashSet<String> structureContents = superset.get(structureHeader);
if (structureContents == null) {
structureContents = new HashSet<String>();
superset.put(structureHeader, structureContents);
}
for (FieldDescriptor field : structure.getFields()) {
addFieldToSuperset(structureContents, field);
}
for (ConstantDescriptor constant : structure.getConstants()) {
String constantHeader = constant.deflate();
structureContents.add(constantHeader);
}
}
writeSuperset();
}
Aggregations