Ejemplo n.º 1
0
 protected Stm makeHeader(TreeFactory tf, Info info, boolean exported) {
   List<Stm> stmlist = new ArrayList<Stm>(4);
   // align to word boundary.
   stmlist.add(new ALIGN(tf, null, 4));
   // label:
   stmlist.add(new LABEL(tf, null, info.label(), exported));
   // claz pointer
   stmlist.add(_DATUM(tf, runtime.getNameMap().label(info.type())));
   // hash code.
   // this is of pointer size, and must have the low bit set.  we *could*
   // emit a symbolic reference to info.label()+1 or some such, but
   // this would complicate the pattern-matching instruction selector.
   // so instead we'll just select a random number of the right length
   // and set the low bit.
   stmlist.add(
       makeDatum(
           tf,
           pointersAreLong
               ? (Number) new Long(1 | rnd.nextLong())
               : (Number) new Integer(1 | rnd.nextInt())));
   // okay, done with header.
   return Stm.toStm(stmlist);
 }