Changeset 218 for trunk/src


Ignore:
Timestamp:
Feb 8, 2005, 10:19:09 AM (20 years ago)
Author:
bird
Message:

2nd try on .NOTPARALLEL.

Location:
trunk/src/gmake
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/debug.h

    r53 r218  
    2525#define DB_IMPLICIT     (0x008)
    2626#define DB_MAKEFILES    (0x100)
     27#define DB_KMK          (0x800)
    2728
    2829#define DB_ALL          (0xfff)
  • trunk/src/gmake/file.c

    r217 r218  
    527527    {
    528528      if (f->deps == 0)
    529         not_parallel = 1;
     529        {
     530          DB (DB_KMK, (_("not_parallel -1\n")));
     531          not_parallel = -1;
     532        }
    530533      else
    531534        for (d = f->deps; d != 0; d = d->next)
  • trunk/src/gmake/job.c

    r217 r218  
    812812        lastc->next = c->next;
    813813
    814       /* update not_parallel if the file was flagged for that. */
    815       if ((c->file->command_flags & COMMANDS_NOTPARALLEL) && not_parallel >= 1)
    816         --not_parallel;
    817 
    818814      free_child (c);
    819815
     
    14051401    {
    14061402      /* Put this child on the chain of children waiting for the load average
    1407          to go down. */
     1403         to go down. if not paralell, put it last. */
    14081404      set_command_state (f, cs_running);
    14091405      c->next = waiting_jobs;
    1410       waiting_jobs = c;
     1406      if (c->next && (c->file->command_flags & COMMANDS_NOTPARALLEL))
     1407        {
     1408          struct child *prev = waiting_jobs;
     1409          while (prev->next)
     1410            prev = prev->next;
     1411          c->next = 0;
     1412          prev->next = c;
     1413        }
     1414      else
     1415        waiting_jobs = c;
    14111416      return 0;
    14121417    }
    14131418
    14141419  if (c->file->command_flags & COMMANDS_NOTPARALLEL)
    1415     ++not_parallel;
     1420    {
     1421      assert(not_parallel == 0);
     1422      DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s')\n"), not_parallel, not_parallel + 1, c->file, c->file->name));
     1423      ++not_parallel;
     1424    }
     1425
    14161426
    14171427  /* Start the first command; reap_children will run later command lines.  */
     
    14381448    case cs_finished:
    14391449      notice_finished_file (f);
    1440       if ((c->file->command_flags & COMMANDS_NOTPARALLEL) && not_parallel >= 1)
    1441         --not_parallel;
    14421450      free_child (c);
    14431451      break;
     
    16871695  (void) start_waiting_job (c);
    16881696
    1689   if (job_slots == 1 || not_parallel)
     1697  if (job_slots == 1 || not_parallel < 0)
    16901698    /* Since there is only one job slot, make things run linearly.
    16911699       Wait for the child to die, setting the state to `cs_finished'.  */
     
    19341942    if (job_slots_used > 0)
    19351943      --job_slots_used;
    1936 
    1937     /* update not_parallel if the file was flagged for that. */
    1938     if ((c->file->command_flags & COMMANDS_NOTPARALLEL) && not_parallel >= 1)
    1939       --not_parallel;
    19401944
    19411945    /* If the job failed, and the -k flag was not given, die.  */
  • trunk/src/gmake/main.c

    r217 r218  
    458458int posix_pedantic;
    459459
    460 /* Nonzero if we have seen the `.NOTPARALLEL' target with empty dependency list.
    461    Incremented while executing targets `.NOTPARALLEL' is depending on.
    462    This temporarily or permanently turns off parallel builds. */
     460/* Negative if we have seen the `.NOTPARALLEL' target with empty dependency list.
     461   Zero if no `.NOTPARALLEL' or no file in the dependency list is being executed.
     462   Positive when a file in `.NOTPARALLEL' is being made.
     463   Nonzero values have the effect of disabeling parallel building. */
    463464
    464465int not_parallel;
     
    592593            case 'v':
    593594              db_level |= DB_BASIC | DB_VERBOSE;
     595              break;
     596            case 'k':
     597              db_level |= DB_KMK;
    594598              break;
    595599            default:
  • trunk/src/gmake/remake.c

    r154 r218  
    726726  int ran = file->command_state == cs_running;
    727727  int touched = 0;
    728 
     728DB (DB_JOBS, (_("notice_finished_file - entering: file=%p `%s' update_status=%d command_state=%d\n"), file, file->name, file->update_status, file->command_state));
    729729  file->command_state = cs_finished;
    730730  file->updated = 1;
     731 
     732  /* update not_parallel if the file was flagged for that. */
     733  if (ran && (file->command_flags & COMMANDS_NOTPARALLEL))
     734    {
     735      assert(not_parallel == 1);
     736      DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s')\n"), not_parallel, not_parallel - 1, file, file->name));
     737      --not_parallel;
     738    }
    731739
    732740  if (touch_flag
     
    826834       So mark it now as "succeeded".  */
    827835    file->update_status = 0;
     836
     837DB (DB_JOBS, (_("notice_finished_file - leaving: file=%p `%s' update_status=%d command_state=%d\n"), file, file->name, file->update_status, file->command_state));
    828838}
    829839
Note: See TracChangeset for help on using the changeset viewer.