private static byte[] generateBinaries(PseudoBytecode bhead,int bsize){
  byte[] codes=new byte[bsize];
  PseudoBytecode bcode=bhead.next;
  int pos=0;
  while (bcode != null) {
    int size=bcode.getSize();
    if (bcode instanceof LoadRetAddrConst) {
      LoadRetAddrConst laddr=(LoadRetAddrConst)bcode;
      laddr.patch(laddr.getOffset() + bsize);
    }
    if (VM.TraceOnStackReplacement)     VM.sysWriteln(pos + " : " + bcode.toString());
    System.arraycopy(bcode.getBytes(),0,codes,pos,size);
    pos+=size;
    bcode=bcode.next;
  }
  return codes;
}

private static byte [ ] generateBinaries ( PseudoBytecode bhead , int bsize ) { byte [ ] codes = new byte [ bsize ] ; PseudoBytecode bcode = bhead . next ; int pos = 0 ; while ( bcode != null ) { int size = bcode . getSize ( ) ; if ( bcode instanceof LoadRetAddrConst ) { LoadRetAddrConst laddr = ( LoadRetAddrConst ) bcode ; laddr . patch ( laddr . getOffset ( ) + bsize ) ; } if ( VM . TraceOnStackReplacement ) VM . sysWriteln ( pos + " : " + bcode . toString ( ) ) ; System . arraycopy ( bcode . getBytes ( ) , 0 , codes , pos , size ) ; pos += size ; bcode = bcode . next ; } return codes ; }
generating binary code from pseudo code , the size and the code list are padded and well calculated .
