Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): reduce memory allocation for toBeMade



details:   https://anonhg.NetBSD.org/src/rev/a1e8f8d4e118
branches:  trunk
changeset: 946486:a1e8f8d4e118
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 28 23:50:58 2020 +0000

description:
make(1): reduce memory allocation for toBeMade

diffstat:

 usr.bin/make/make.c |  26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diffs (109 lines):

diff -r de8b86c1966d -r a1e8f8d4e118 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sat Nov 28 23:48:36 2020 +0000
+++ b/usr.bin/make/make.c       Sat Nov 28 23:50:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.225 2020/11/28 23:48:36 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.226 2020/11/28 23:50:58 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -102,7 +102,7 @@
 #include "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.225 2020/11/28 23:48:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.226 2020/11/28 23:50:58 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -110,7 +110,7 @@
 /* The current fringe of the graph.
  * These are nodes which await examination by MakeOODate.
  * It is added to by Make_Update and subtracted from by MakeStartJobs */
-static GNodeList *toBeMade;
+static GNodeList toBeMade = LST_INIT;
 
 
 void
@@ -129,7 +129,7 @@
 
        debug_printf("make_abort from line %d\n", line);
        Targ_PrintNode(gn, 2);
-       Targ_PrintNodes(toBeMade, 2);
+       Targ_PrintNodes(&toBeMade, 2);
        Targ_PrintGraph(3);
        abort();
 }
@@ -585,7 +585,7 @@
 static void
 ScheduleOrderSuccessors(GNode *gn)
 {
-       GNodeListNode *toBeMadeNext = toBeMade->first;
+       GNodeListNode *toBeMadeNext = toBeMade.first;
        GNodeListNode *ln;
 
        for (ln = gn->order_succ.first; ln != NULL; ln = ln->next)
@@ -740,7 +740,7 @@
        }
        /* Ok, we can schedule the parent again */
        pgn->made = REQUESTED;
-       Lst_Enqueue(toBeMade, pgn);
+       Lst_Enqueue(&toBeMade, pgn);
     }
 
     UpdateImplicitParentsVars(cgn, cname);
@@ -883,9 +883,9 @@
 
        cn->made = REQUESTED;
        if (toBeMadeNext == NULL)
-               Lst_Append(toBeMade, cn);
+               Lst_Append(&toBeMade, cn);
        else
-               Lst_InsertBefore(toBeMade, toBeMadeNext, cn);
+               Lst_InsertBefore(&toBeMade, toBeMadeNext, cn);
 
        if (cn->unmade_cohorts != 0) {
                ListNode *ln;
@@ -929,13 +929,13 @@
     GNode *gn;
     Boolean have_token = FALSE;
 
-    while (!Lst_IsEmpty(toBeMade)) {
+    while (!Lst_IsEmpty(&toBeMade)) {
        /* Get token now to avoid cycling job-list when we only have 1 token */
        if (!have_token && !Job_TokenWithdraw())
            break;
        have_token = TRUE;
 
-       gn = Lst_Dequeue(toBeMade);
+       gn = Lst_Dequeue(&toBeMade);
        DEBUG2(MAKE, "Examining %s%s...\n", gn->name, gn->cohort_num);
 
        if (gn->made != REQUESTED) {
@@ -961,7 +961,7 @@
            gn->made = DEFERRED;
 
            {
-               GNodeListNode *toBeMadeNext = toBeMade->first;
+               GNodeListNode *toBeMadeNext = toBeMade.first;
                GNodeListNode *ln;
 
                for (ln = gn->children.first; ln != NULL; ln = ln->next)
@@ -1319,7 +1319,7 @@
     int errors;                        /* Number of errors the Job module reports */
 
     /* Start trying to make the current targets... */
-    toBeMade = Lst_New();
+    Lst_Init(&toBeMade);
 
     Make_ExpandUse(targs);
     Make_ProcessWait(targs);
@@ -1356,7 +1356,7 @@
      * Note that the Job module will exit if there were any errors unless the
      * keepgoing flag was given.
      */
-    while (!Lst_IsEmpty(toBeMade) || jobTokensRunning > 0) {
+    while (!Lst_IsEmpty(&toBeMade) || jobTokensRunning > 0) {
        Job_CatchOutput();
        (void)MakeStartJobs();
     }



Home | Main Index | Thread Index | Old Index