VirtualBox

Changeset 1874 in kBuild for trunk


Ignore:
Timestamp:
Oct 17, 2008 12:41:33 AM (16 years ago)
Author:
bird
Message:

incdep: The variable names should live in a different string cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/incdep.c

    r1873 r1874  
    217217static struct alloccache incdep_dep_caches[INCDEP_MAX_THREADS];
    218218static struct strcache2 incdep_dep_strcaches[INCDEP_MAX_THREADS];
     219static struct strcache2 incdep_var_strcaches[INCDEP_MAX_THREADS];
    219220static unsigned incdep_num_threads;
    220221
     
    316317incdep_free_rec (struct incdep *cur, void *rec)
    317318{
    318   alloccache_free (&incdep_rec_caches[cur->worker_tid], rec);
     319  /*alloccache_free (&incdep_rec_caches[cur->worker_tid], rec); - doesn't work of course. */
    319320}
    320321
     
    506507
    507508  incdep_xfree (cur, cur->file_base);
     509  cur->next = NULL;
    508510  free (cur);
    509511}
     
    677679                     0);            /* thread safe */
    678680
     681      strcache2_init(&incdep_var_strcaches[i],
     682                     "incdep var",  /* name */
     683                     32768,         /* hash size */
     684                     0,             /* default segment size*/
     685                     0,             /* case insensitive */
     686                     0);            /* thread safe */
     687
    679688      /* create the thread. */
    680689#ifdef HAVE_PTHREAD
     
    742751      alloccache_join (&dep_cache, &incdep_dep_caches[i]);
    743752      strcache2_term (&incdep_dep_strcaches[i]);
     753      strcache2_term (&incdep_var_strcaches[i]);
    744754    }
    745755  incdep_num_threads = 0;
     
    869879}
    870880
    871 /* Record / execute a strcache add. */
     881/* Dependency or file strcache allocation / recording. */
    872882static const char *
    873 incdep_record_strcache (struct incdep *cur, const char *str, int len)
     883incdep_dep_strcache (struct incdep *cur, const char *str, int len)
    874884{
    875885  const char *ret;
     
    889899      ret = strcache2_add (&incdep_dep_strcaches[cur->worker_tid], str, len);
    890900      ret = (const char *)strcache2_get_entry(&incdep_dep_strcaches[cur->worker_tid], ret);
     901    }
     902  return ret;
     903}
     904
     905/* Variable name allocation / recording. */
     906static const char *
     907incdep_var_strcache (struct incdep *cur, const char *str, int len)
     908{
     909  const char *ret;
     910  if (cur->worker_tid == -1)
     911    {
     912      /* XXX: we're leaking this memory now! This will be fixed later. */
     913      ret = xmalloc (len + 1);
     914      memcpy ((char *)ret, str, len);
     915      ((char *)ret)[len] = '\0';
     916    }
     917  else
     918    {
     919      /* Add it out the strcache of the thread. */
     920      ret = strcache2_add (&incdep_var_strcaches[cur->worker_tid], str, len);
     921      ret = (const char *)strcache2_get_entry(&incdep_var_strcaches[cur->worker_tid], ret);
    891922    }
    892923  return ret;
     
    11121143              break;
    11131144          }
    1114           var = incdep_record_strcache (curdep, cur, var_len);
     1145          var = incdep_var_strcache (curdep, cur, var_len);
    11151146
    11161147          /* find the end of the variable. */
     
    12701301                  break;
    12711302                }
    1272               var = incdep_record_strcache (curdep, cur, var_len);
     1303              var = incdep_var_strcache (curdep, cur, var_len);
    12731304
    12741305              /* find the start of the value. */
     
    13861417                  break;
    13871418                }
    1388               filename = incdep_record_strcache (curdep, cur, endp - cur);
     1419              filename = incdep_dep_strcache (curdep, cur, endp - cur);
    13891420
    13901421              /* parse any dependencies. */
     
    14251456                  /* add it to the list. */
    14261457                  *nextdep = dep = incdep_alloc_dep (curdep);
    1427                   dep->name = incdep_record_strcache (curdep, cur, endp - cur);
     1458                  dep->name = incdep_dep_strcache (curdep, cur, endp - cur);
    14281459                  dep->includedep = 1;
    14291460                  nextdep = &dep->next;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette