VirtualBox

Changeset 2050 in kBuild


Ignore:
Timestamp:
Nov 3, 2008 2:53:07 PM (16 years ago)
Author:
bird
Message:

kmk: converted the inlined alloccache_free() to non-inlined to avoid aliasing problems in read.c with gcc 3.2.3 (rhel3) and 3.4.3 (solaris/x86).

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/make.h

    r2041 r2050  
    574574void alloccache_print_all (void);
    575575struct alloccache_free_ent *alloccache_alloc_grow (struct alloccache *cache);
     576void alloccache_free (struct alloccache *cache, void *item);
    576577
    577578/* Allocate an item. */
     
    602603}
    603604
    604 /* Free an item. */
    605 MY_INLINE void
    606 alloccache_free (struct alloccache *cache, void *item)
    607 {
    608   struct alloccache_free_ent *f = (struct alloccache_free_ent *)item;
    609 #if 0 /*ndef NDEBUG*/
    610   struct alloccache_free_ent *c;
    611   unsigned int i = 0;
    612   for (c = cache->free_head; c != NULL; c = c->next, i++)
    613     MY_ASSERT_MSG (c != f && i < 0x10000000,
    614                    ("i=%u total_count=%u\n", i, cache->total_count));
    615 #endif
    616 #ifdef __GNUC__
    617 /* GCC 3.2.3 has been observed having aliasing issues, so, setup a
    618    barrier for it here. */
    619 # if (__GNUC__ == 3 && __GNUC_PATCHLEVEL__ <= 3) || __GNUC__ < 3
    620   __asm__ __volatile__ ("" ::: "memory");
    621 # endif
    622 #endif
    623 
    624   f->next = cache->free_head;
    625   cache->free_head = f;
    626   MAKE_STATS(cache->free_count++;);
    627 }
    628605
    629606/* the alloc caches */
  • trunk/src/kmk/misc.c

    r2035 r2050  
    11641164#ifdef CONFIG_WITH_ALLOC_CACHES
    11651165
     1166/* Free am item.
     1167   This was not inlined because of aliasing issues arrising with GCC. */
     1168void
     1169alloccache_free (struct alloccache *cache, void *item)
     1170{
     1171  struct alloccache_free_ent *f = (struct alloccache_free_ent *)item;
     1172#if 0 /*ndef NDEBUG*/
     1173  struct alloccache_free_ent *c;
     1174  unsigned int i = 0;
     1175  for (c = cache->free_head; c != NULL; c = c->next, i++)
     1176    MY_ASSERT_MSG (c != f && i < 0x10000000,
     1177                   ("i=%u total_count=%u\n", i, cache->total_count));
     1178#endif
     1179
     1180  f->next = cache->free_head;
     1181  cache->free_head = f;
     1182  MAKE_STATS(cache->free_count++;);
     1183}
     1184
    11661185/* Default allocator. */
    11671186static void *
Note: See TracChangeset for help on using the changeset viewer.

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