Exemple #1
0
  void
outputObjectFile()
{
	void	outputPartition();
	void	outputReferenceInfo();
	void	outputSymbolTableInfo();
	void	outputAbsoluteCode();
	void	outputRelocatableCode();
	void	outputReservations();
	void	outputExpressions();
	void	outputFunctions();
	void	dumpSymbolTable();
	void	enumerateAndCountSymbols();

	if (debug || emitPrint)
		printCodeBuffers();
	outputPartition();
	outputAbsoluteCode();
	if (produceLinkableObject) {
		outputPartition();
		outputRelocatableCode();
		outputPartition();
		outputReservations();
		outputPartition();
		enumerateAndCountSymbols();
		outputReferenceInfo();
		outputSymbolTableInfo();
		outputExpressions();
		outputFunctions();
	}
	if (symbolTableDumpOn)
		dumpSymbolTable();
	fclose(objectFileOutput);
}
Exemple #2
0
void
partitionBySegment(char *prefix, uint64 numSegments, char *filename) {
  seqCache     *F = new seqCache(filename);
  uint32        n = F->getNumberOfSequences();
  partition_s  *p = new partition_s [n];
  uint32        numSeqPerPart = (uint32)ceil(n / (double)numSegments);

  for (uint32 i=0; i<n; i++) {
    p[i].length    = F->getSequenceLength(i);
    p[i].index     = i;
    p[i].partition = i / numSeqPerPart + 1;
  }

  outputPartition(F, prefix, p, numSegments, n);

  delete [] p;
  delete    F;
}
Exemple #3
0
void
partitionBySize(char *prefix, uint64 partitionSize, char *filename) {
  seqCache     *F = new seqCache(filename);
  uint32        n = F->getNumberOfSequences();
  partition_s  *p = loadPartition(F);

  uint32  openP = 1;  //  Currently open partition
  uint32  sizeP = 0;  //  Size of open partition
  uint32  seqsP = n;  //  Number of sequences to partition

  //  For any sequences larger than partitionSize, create
  //  partitions containing just one sequence
  //
  for (uint32 i=0; i<n; i++) {
    if (p[i].length > partitionSize) {
      p[i].partition = openP++;
      seqsP--;
    }
  }

  //  For the remaining, iterate through the list,
  //  greedily placing the longest sequence that fits
  //  into the open partition
  //
  while (seqsP > 0) {
    for (uint32 i=0; i<n; i++) {
      if ((p[i].partition == 0) &&
          (p[i].length + sizeP < partitionSize)) {
        p[i].partition = openP;
        sizeP += p[i].length;
        seqsP--;
      }
    }

    openP++;
    sizeP = 0;
  }

  outputPartition(F, prefix, p, openP-1, n);

  delete [] p;
  delete    F;
}
Exemple #4
0
void
partitionByBucket(char *prefix, uint64 partitionSize, char *filename) {
  seqCache     *F = new seqCache(filename);
  uint32        n = F->getNumberOfSequences();
  partition_s  *p = loadPartition(F);

  if (partitionSize > n)
    partitionSize = n;

  //  The size, in bases, of each partition
  //
  uint32       *s = new uint32 [partitionSize];
  for (uint32 i=0; i<partitionSize; i++)
    s[i] = 0;

  //  For each sequence
  //
  for (uint32 nextS=0; nextS<n; nextS++) {

    //  find the smallest partition
    //
    uint32 openP = 0;
    for (uint32 i=0; i<partitionSize; i++)
      if (s[i] < s[openP])
        openP = i;

    //  add the next largest sequence to the open partition
    //
    s[openP] += p[nextS].length;
    p[nextS].partition = openP+1;
  }

  outputPartition(F, prefix, p, (uint32)partitionSize, n);

  delete [] p;
  delete    F;
}