tiles: Make TiFree() easier to inline for compiler
Removal of unnecessary function call indirection into TileStoreFree() since TiFree() is has multiple implementation already and we can customize TiFree() directly as required. Move the function definitions into the tile.h to they are visible to compiler during code generation to consider inline potential. This has made global 'Tile *TileStoreFreeList' more visible.
This commit is contained in:
parent
db8e790aea
commit
f8ef715608
39
tiles/tile.c
39
tiles/tile.c
|
|
@ -61,7 +61,7 @@ global const Rect TiPlaneRect = { {MINFINITY+2, MINFINITY+2}, {INFINITY-2, INFIN
|
|||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
|
||||
static Tile *TileStoreFreeList = NULL;
|
||||
Tile *TileStoreFreeList = NULL;
|
||||
|
||||
/* The new Tile Allocation scheme (Magic 8.0) */
|
||||
|
||||
|
|
@ -788,21 +788,6 @@ TiAlloc(void)
|
|||
return newtile;
|
||||
}
|
||||
|
||||
static void
|
||||
TileStoreFree(
|
||||
Tile *ptr)
|
||||
{
|
||||
ptr->ti_client = PTR2CD(TileStoreFreeList);
|
||||
TileStoreFreeList = ptr;
|
||||
}
|
||||
|
||||
void
|
||||
TiFree(
|
||||
Tile *tp)
|
||||
{
|
||||
TileStoreFree(tp);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
|
|
@ -826,31 +811,11 @@ TiAlloc(void)
|
|||
TiSetBody(newtile, 0);
|
||||
return newtile;
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* TiFree ---
|
||||
*
|
||||
* Release memory allocation for tiles
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
TiFree(
|
||||
Tile *tp)
|
||||
{
|
||||
freeMagic((char *)tp);
|
||||
}
|
||||
|
||||
#endif /* !HAVE_SYS_MMAN_H */
|
||||
|
||||
#ifdef __GNUC_STDC_INLINE__
|
||||
/* Use of 'extern inline' force an emit of inline code at a symbol */
|
||||
extern inline void TiFree(Tile *tile);
|
||||
extern inline void TiFreeIf(Tile *tile);
|
||||
extern inline void TiFree1(Tile **delay1, Tile *tile);
|
||||
extern inline void TiJoinX1(Tile **delay1, Tile *tile1, Tile *tile2, Plane *plane);
|
||||
|
|
|
|||
34
tiles/tile.h
34
tiles/tile.h
|
|
@ -247,10 +247,41 @@ extern Tile *TiSrPoint(Tile *hint, Plane *plane, const Point *point);
|
|||
#define TiSetClientPTR(tp,cd) ((tp)->ti_client = PTR2CD((cd)))
|
||||
|
||||
extern Tile *TiAlloc(void);
|
||||
extern void TiFree(Tile *tile);
|
||||
|
||||
#ifdef __GNUC_STDC_INLINE__
|
||||
|
||||
/* Provide compiler visibility of STDC 'inline' semantics */
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
extern Tile *TileStoreFreeList;
|
||||
|
||||
inline void
|
||||
TiFree(Tile *tile)
|
||||
{
|
||||
tile->ti_client = PTR2CD(TileStoreFreeList);
|
||||
TileStoreFreeList = tile;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* TiFree ---
|
||||
*
|
||||
* Release memory allocation for tiles
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
inline void
|
||||
TiFree(Tile *tile)
|
||||
{
|
||||
freeMagic((char *)tile);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void
|
||||
TiFreeIf(Tile *tile)
|
||||
{
|
||||
|
|
@ -280,6 +311,7 @@ TiJoinY1(Tile **delay1, Tile *tile1, Tile *tile2, Plane *plane)
|
|||
}
|
||||
#else
|
||||
/* To support older compilers (that don't auto emit based on -O level) */
|
||||
extern void TiFree(Tile *tile);
|
||||
extern void TiFreeIf(Tile *tile);
|
||||
extern void TiFree1(Tile **delay1, Tile *tile);
|
||||
extern void TiJoinX1(Tile **delay1, Tile *tile1, Tile *tile2, Plane *plane);
|
||||
|
|
|
|||
Loading…
Reference in New Issue