Search in sources :

Example 6 with ConstantDescriptor

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());
    }
}
Also used : ConstantDescriptor(com.ibm.j9ddr.StructureReader.ConstantDescriptor)

Example 7 with ConstantDescriptor

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();
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) MemoryCacheImageInputStream(javax.imageio.stream.MemoryCacheImageInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) ImageInputStream(javax.imageio.stream.ImageInputStream) DigestInputStream(java.security.DigestInputStream) InputStream(java.io.InputStream) ConstantDescriptor(com.ibm.j9ddr.StructureReader.ConstantDescriptor) StructureReader(com.ibm.j9ddr.StructureReader) MemoryCacheImageInputStream(javax.imageio.stream.MemoryCacheImageInputStream) ImageInputStream(javax.imageio.stream.ImageInputStream) MemoryCacheImageInputStream(javax.imageio.stream.MemoryCacheImageInputStream) StructureDescriptor(com.ibm.j9ddr.StructureReader.StructureDescriptor) FieldDescriptor(com.ibm.j9ddr.StructureReader.FieldDescriptor)

Aggregations

ConstantDescriptor (com.ibm.j9ddr.StructureReader.ConstantDescriptor)7 FieldDescriptor (com.ibm.j9ddr.StructureReader.FieldDescriptor)2 StructureDescriptor (com.ibm.j9ddr.StructureReader.StructureDescriptor)2 StructureReader (com.ibm.j9ddr.StructureReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 DigestInputStream (java.security.DigestInputStream)1 ImageInputStream (javax.imageio.stream.ImageInputStream)1 MemoryCacheImageInputStream (javax.imageio.stream.MemoryCacheImageInputStream)1 ClassWriter (jdk.internal.org.objectweb.asm.ClassWriter)1 FieldVisitor (jdk.internal.org.objectweb.asm.FieldVisitor)1 MethodVisitor (jdk.internal.org.objectweb.asm.MethodVisitor)1