Exemple #1
0
  //
  // clear back pointers to dead ast instances
  //
  forv_Vec(TypeSymbol, ts, gTypeSymbols) {
    for (int i = 0; i < ts->type->methods.n; i++) {
      FnSymbol* method = ts->type->methods.v[i];

      if (method && !isAliveQuick(method)) {
        ts->type->methods.v[i] = NULL;
      }

      if (AggregateType* ct = toAggregateType(ts->type)) {
        if (ct->defaultInitializer               != NULL &&
            isAliveQuick(ct->defaultInitializer) == false) {
          ct->defaultInitializer = NULL;
        }

        if (ct->hasDestructor()                  == true &&
            isAliveQuick(ct->getDestructor())    == false) {
          ct->setDestructor(NULL);
        }
      }
    }

    if (AggregateType* at = toAggregateType(ts->type)) {
      for (int i = 0; i < at->dispatchChildren.n; i++) {
        if (AggregateType* type = at->dispatchChildren.v[i]) {
          if (isAlive(type) == false) {
            at->dispatchChildren.v[i] = NULL;
          }
        }
      }
    }
  }
Exemple #2
0
 //
 // clear back pointers to dead ast instances
 //
 forv_Vec(TypeSymbol, ts, gTypeSymbols) {
   for(int i = 0; i < ts->type->methods.n; i++) {
     FnSymbol* method = ts->type->methods.v[i];
     if (method && !isAliveQuick(method))
       ts->type->methods.v[i] = NULL;
     if (AggregateType* ct = toAggregateType(ts->type)) {
       if (ct->defaultInitializer && !isAliveQuick(ct->defaultInitializer))
         ct->defaultInitializer = NULL;
       if (ct->destructor && !isAliveQuick(ct->destructor))
         ct->destructor = NULL;
     }
   }
   for(int i = 0; i < ts->type->dispatchChildren.n; i++) {
     Type* type = ts->type->dispatchChildren.v[i];
     if (type && !isAlive(type))
       ts->type->dispatchChildren.v[i] = NULL;
   }
 }
Exemple #3
0
void cleanAst() {
  cleanModuleList();
  //
  // clear back pointers to dead ast instances
  //
  forv_Vec(TypeSymbol, ts, gTypeSymbols) {
    for(int i = 0; i < ts->type->methods.n; i++) {
      FnSymbol* method = ts->type->methods.v[i];
      if (method && !isAliveQuick(method))
        ts->type->methods.v[i] = NULL;
      if (AggregateType* ct = toAggregateType(ts->type)) {
        if (ct->defaultInitializer && !isAliveQuick(ct->defaultInitializer))
          ct->defaultInitializer = NULL;
        if (ct->destructor && !isAliveQuick(ct->destructor))
          ct->destructor = NULL;
      }
    }
    for(int i = 0; i < ts->type->dispatchChildren.n; i++) {
      Type* type = ts->type->dispatchChildren.v[i];
      if (type && !isAlive(type))
        ts->type->dispatchChildren.v[i] = NULL;
    }
  }

  // check iterator-resume-label/goto data before nodes are free'd
  verifyNcleanRemovedIterResumeGotos();
  verifyNcleanCopiedIterResumeGotos();

  // clean the other module vectors, without deleting the ast instances (they
  // will be deleted with the clean_gvec call for ModuleSymbols.) 
  clean_modvec(allModules);
  clean_modvec(userModules);
  clean_modvec(mainModules);
 
  //
  // clean global vectors and delete dead ast instances
  //
  foreach_ast(clean_gvec);
}