public Stm buildObject(TreeFactory tf, ObjectInfo info, boolean exported) {
   FieldMap cfm = ((TreeBuilder) runtime.getTreeBuilder()).cfm;
   assert !info.type().isArray();
   assert !info.type().isPrimitive();
   List<Stm> stmlist = new ArrayList<Stm>();
   // header
   stmlist.add(makeHeader(tf, info, exported));
   int startOffset = headerFinalOffset(info);
   // fields, in field order
   List<HField> l = cfm.fieldList(info.type());
   int endOffset =
       (l.size() == 0)
           ? startOffset
           : cfm.fieldOffset(l.get(l.size() - 1)) + cfm.fieldSize(l.get(l.size() - 1));
   Stm s = makeFields(tf, info, l, startOffset, endOffset);
   if (s != null) stmlist.add(s);
   // done -- ta da!
   return Stm.toStm(stmlist);
 }
 public Stm buildArray(TreeFactory tf, ArrayInfo info, boolean exported) {
   FieldMap cfm = ((TreeBuilder) runtime.getTreeBuilder()).cfm;
   assert info.type().isArray();
   HClass cType = info.type().getComponentType();
   List<Stm> stmlist = new ArrayList<Stm>(info.length() + 2);
   // header
   stmlist.add(makeHeader(tf, info, exported));
   int startOffset = headerFinalOffset(info);
   // fields of the object, including the length field. in order.
   List<HField> l = cfm.fieldList(info.type());
   assert l.size() > 0; // always at least the length field!
   int endOffset = cfm.fieldOffset(l.get(l.size() - 1)) + cfm.fieldSize(l.get(l.size() - 1));
   Stm s = makeFields(tf, info, l, startOffset, endOffset);
   assert s != null; // always the length!
   stmlist.add(s);
   // data
   for (int i = 0; i < info.length(); i++) stmlist.add(makeDatum(tf, info.get(i)));
   // done -- ta da!
   return Stm.toStm(stmlist);
 }
 protected Stm makeFields(
     TreeFactory tf, Info info, List<HField> fields, int startOffset, int endOffset) {
   assert endOffset >= startOffset;
   FieldMap cfm = ((TreeBuilder) runtime.getTreeBuilder()).cfm;
   List<Stm> stmlist = new ArrayList<Stm>(2 * fields.size());
   int offset = startOffset;
   for (Iterator<HField> it = fields.iterator(); it.hasNext(); ) {
     HField hf = it.next();
     int thisOffset = cfm.fieldOffset(hf);
     if (thisOffset < startOffset) continue; // ignore
     if (thisOffset > endOffset) break; // done.
     assert thisOffset >= offset : "fields in order";
     if (thisOffset > offset) // handle padding
     stmlist.add(makePadding(tf, thisOffset - offset));
     stmlist.add(makeDatum(tf, lookup(info, hf)));
     offset = thisOffset + cfm.fieldSize(hf);
   }
   // final padding, if needed.
   if (endOffset > offset) stmlist.add(makePadding(tf, endOffset - offset));
   // done -- ta da!
   return Stm.toStm(stmlist); // MAY RETURN NULL.
 }