1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Style nitpicks: space before () in function call.

This commit is contained in:
Han-Wen Nienhuys 2008-08-21 23:16:20 -03:00
parent 103dc4d4d2
commit 1f5844000e
7 changed files with 42 additions and 42 deletions

View file

@ -58,14 +58,14 @@ SCM scm_i_structs_to_free;
we do not actually free the cell. To make the numbers match up, we we do not actually free the cell. To make the numbers match up, we
do increase the FREE_COUNT. do increase the FREE_COUNT.
It would be cleaner to have a separate function sweep_value(), but It would be cleaner to have a separate function sweep_value (), but
that is too slow (functions with switch statements can't be that is too slow (functions with switch statements can't be
inlined). inlined).
NOTE: NOTE:
For many types of cells, allocation and a de-allocation involves For many types of cells, allocation and a de-allocation involves
calling malloc() and free(). This is costly for small objects (due calling malloc () and free (). This is costly for small objects (due
to malloc/free overhead.) (should measure this). to malloc/free overhead.) (should measure this).
It might also be bad for threads: if several threads are allocating It might also be bad for threads: if several threads are allocating
@ -81,7 +81,7 @@ int
scm_i_sweep_card (scm_t_cell *card, SCM *free_list, scm_t_heap_segment *seg) scm_i_sweep_card (scm_t_cell *card, SCM *free_list, scm_t_heap_segment *seg)
#define FUNC_NAME "sweep_card" #define FUNC_NAME "sweep_card"
{ {
scm_t_c_bvec_long *bitvec = SCM_GC_CARD_BVEC(card); scm_t_c_bvec_long *bitvec = SCM_GC_CARD_BVEC (card);
scm_t_cell *end = card + SCM_GC_CARD_N_CELLS; scm_t_cell *end = card + SCM_GC_CARD_N_CELLS;
scm_t_cell *p = card; scm_t_cell *p = card;
int span = seg->span; int span = seg->span;
@ -175,7 +175,7 @@ scm_i_sweep_card (scm_t_cell *card, SCM *free_list, scm_t_heap_segment *seg)
if (!(k < scm_numptob)) if (!(k < scm_numptob))
{ {
fprintf (stderr, "undefined port type"); fprintf (stderr, "undefined port type");
abort(); abort ();
} }
#endif #endif
/* Keep "revealed" ports alive. */ /* Keep "revealed" ports alive. */
@ -220,7 +220,7 @@ scm_i_sweep_card (scm_t_cell *card, SCM *free_list, scm_t_heap_segment *seg)
if (!(k < scm_numsmob)) if (!(k < scm_numsmob))
{ {
fprintf (stderr, "undefined smob type"); fprintf (stderr, "undefined smob type");
abort(); abort ();
} }
#endif #endif
if (scm_smobs[k].free) if (scm_smobs[k].free)
@ -238,7 +238,7 @@ scm_i_sweep_card (scm_t_cell *card, SCM *free_list, scm_t_heap_segment *seg)
SCM_SMOBNAME (k)); SCM_SMOBNAME (k));
scm_i_deprecated_memory_return += mm; scm_i_deprecated_memory_return += mm;
#else #else
abort(); abort ();
#endif #endif
} }
} }
@ -248,7 +248,7 @@ scm_i_sweep_card (scm_t_cell *card, SCM *free_list, scm_t_heap_segment *seg)
break; break;
default: default:
fprintf (stderr, "unknown type"); fprintf (stderr, "unknown type");
abort(); abort ();
} }
SCM_GC_SET_CELL_WORD (scmptr, 0, scm_tc_free_cell); SCM_GC_SET_CELL_WORD (scmptr, 0, scm_tc_free_cell);
@ -296,7 +296,7 @@ scm_i_init_card_freelist (scm_t_cell *card, SCM *free_list,
/* /*
Classic MIT Hack, see e.g. http://www.tekpool.com/?cat=9 Classic MIT Hack, see e.g. http://www.tekpool.com/?cat=9
*/ */
int scm_i_uint_bit_count(unsigned int u) int scm_i_uint_bit_count (unsigned int u)
{ {
unsigned int u_count = u unsigned int u_count = u
- ((u >> 1) & 033333333333) - ((u >> 1) & 033333333333)
@ -317,7 +317,7 @@ scm_i_card_marked_count (scm_t_cell *card, int span)
int count = 0; int count = 0;
while (bvec < bvec_end) { while (bvec < bvec_end) {
count += scm_i_uint_bit_count(*bvec); count += scm_i_uint_bit_count (*bvec);
bvec ++; bvec ++;
} }
return count * span; return count * span;
@ -326,7 +326,7 @@ scm_i_card_marked_count (scm_t_cell *card, int span)
void void
scm_i_card_statistics (scm_t_cell *p, SCM hashtab, scm_t_heap_segment *seg) scm_i_card_statistics (scm_t_cell *p, SCM hashtab, scm_t_heap_segment *seg)
{ {
scm_t_c_bvec_long *bitvec = SCM_GC_CARD_BVEC(p); scm_t_c_bvec_long *bitvec = SCM_GC_CARD_BVEC (p);
scm_t_cell * end = p + SCM_GC_CARD_N_CELLS; scm_t_cell * end = p + SCM_GC_CARD_N_CELLS;
int span = seg->span; int span = seg->span;
int offset = SCM_MAX (SCM_GC_CARD_N_HEADER_CELLS, span); int offset = SCM_MAX (SCM_GC_CARD_N_HEADER_CELLS, span);
@ -436,7 +436,7 @@ scm_i_tag_name (scm_t_bits tag)
case scm_tc7_smob: case scm_tc7_smob:
/* scm_tc_free_cell is smob 0, the name field in that scm_smobs[] /* scm_tc_free_cell is smob 0, the name field in that scm_smobs[]
entry should be ok for our return here */ entry should be ok for our return here */
return scm_smobs[SCM_TC2SMOBNUM(tag)].name; return scm_smobs[SCM_TC2SMOBNUM (tag)].name;
} }
return NULL; return NULL;
@ -468,7 +468,7 @@ int
scm_dbg_gc_marked_p (SCM obj) scm_dbg_gc_marked_p (SCM obj)
{ {
if (!SCM_IMP (obj)) if (!SCM_IMP (obj))
return SCM_GC_MARK_P(obj); return SCM_GC_MARK_P (obj);
else else
return 0; return 0;
} }
@ -477,7 +477,7 @@ scm_t_cell *
scm_dbg_gc_get_card (SCM obj) scm_dbg_gc_get_card (SCM obj)
{ {
if (!SCM_IMP (obj)) if (!SCM_IMP (obj))
return SCM_GC_CELL_CARD(obj); return SCM_GC_CELL_CARD (obj);
else else
return NULL; return NULL;
} }

View file

@ -129,15 +129,15 @@ scm_gc_init_freelist (void)
if (scm_i_get_new_heap_segment (&scm_i_master_freelist, if (scm_i_get_new_heap_segment (&scm_i_master_freelist,
init_heap_size_1, return_on_error) == -1) { init_heap_size_1, return_on_error) == -1) {
fprintf (stderr, error_message, init_heap_size_1, 1); fprintf (stderr, error_message, init_heap_size_1, 1);
abort(); abort ();
} }
if (scm_i_get_new_heap_segment (&scm_i_master_freelist2, if (scm_i_get_new_heap_segment (&scm_i_master_freelist2,
init_heap_size_2, return_on_error) == -1) { init_heap_size_2, return_on_error) == -1) {
fprintf (stderr, error_message, init_heap_size_2, 2); fprintf (stderr, error_message, init_heap_size_2, 2);
abort(); abort ();
} }
check_deprecated_heap_vars(); check_deprecated_heap_vars ();
} }
@ -178,9 +178,9 @@ scm_i_gc_heap_size_delta (scm_t_cell_type_statistics * freelist)
float swept = freelist->swept; float swept = freelist->swept;
float delta = ((f * swept - collected) / (1.0 - f)); float delta = ((f * swept - collected) / (1.0 - f));
assert(freelist->heap_total_cells >= freelist->collected); assert (freelist->heap_total_cells >= freelist->collected);
assert(freelist->swept == freelist->heap_total_cells); assert (freelist->swept == freelist->heap_total_cells);
assert(swept >= collected); assert (swept >= collected);
return delta; return delta;
} }

View file

@ -119,7 +119,7 @@ scm_realloc (void *mem, size_t size)
We don't want these sweep statistics to influence results for We don't want these sweep statistics to influence results for
cell GC, so we don't collect statistics. cell GC, so we don't collect statistics.
realloc() failed, so we're really desparate to free memory. Run a realloc () failed, so we're really desparate to free memory. Run a
full sweep. full sweep.
*/ */
scm_i_sweep_all_segments ("realloc", NULL); scm_i_sweep_all_segments ("realloc", NULL);
@ -314,7 +314,7 @@ scm_gc_malloc (size_t size, const char *what)
again in scm_gc_register_collectable_memory. We don't really again in scm_gc_register_collectable_memory. We don't really
want the second GC since it will not find new garbage. want the second GC since it will not find new garbage.
Note: this is a theoretical peeve. In reality, malloc() never Note: this is a theoretical peeve. In reality, malloc () never
returns NULL. Usually, memory is overcommitted, and when you try returns NULL. Usually, memory is overcommitted, and when you try
to write it the program is killed with signal 11. --hwn to write it the program is killed with signal 11. --hwn
*/ */
@ -342,10 +342,10 @@ scm_gc_realloc (void *mem, size_t old_size, size_t new_size, const char *what)
/* /*
scm_realloc() may invalidate the block pointed to by WHERE, eg. by scm_realloc () may invalidate the block pointed to by WHERE, eg. by
unmapping it from memory or altering the contents. Since unmapping it from memory or altering the contents. Since
increase_mtrigger() might trigger a GC that would scan increase_mtrigger () might trigger a GC that would scan
MEM, it is crucial that this call precedes realloc(). MEM, it is crucial that this call precedes realloc ().
*/ */
decrease_mtrigger (old_size, what); decrease_mtrigger (old_size, what);

View file

@ -339,10 +339,10 @@ scm_gc_mark_dependencies (SCM p)
if (!(i < scm_numptob)) if (!(i < scm_numptob))
{ {
fprintf (stderr, "undefined port type"); fprintf (stderr, "undefined port type");
abort(); abort ();
} }
#endif #endif
if (SCM_PTAB_ENTRY(ptr)) if (SCM_PTAB_ENTRY (ptr))
scm_gc_mark (SCM_FILENAME (ptr)); scm_gc_mark (SCM_FILENAME (ptr));
if (scm_ptobs[i].mark) if (scm_ptobs[i].mark)
{ {
@ -366,7 +366,7 @@ scm_gc_mark_dependencies (SCM p)
if (!(i < scm_numsmob)) if (!(i < scm_numsmob))
{ {
fprintf (stderr, "undefined smob type"); fprintf (stderr, "undefined smob type");
abort(); abort ();
} }
#endif #endif
if (scm_smobs[i].mark) if (scm_smobs[i].mark)
@ -380,7 +380,7 @@ scm_gc_mark_dependencies (SCM p)
break; break;
default: default:
fprintf (stderr, "unknown type"); fprintf (stderr, "unknown type");
abort(); abort ();
} }
/* /*
@ -411,7 +411,7 @@ scm_gc_mark_dependencies (SCM p)
if (!valid_cell) if (!valid_cell)
{ {
fprintf (stderr, "rogue pointer in heap"); fprintf (stderr, "rogue pointer in heap");
abort(); abort ();
} }
} }
@ -503,7 +503,7 @@ scm_deprecated_newcell2 (void)
void void
scm_gc_init_mark(void) scm_gc_init_mark (void)
{ {
#if SCM_ENABLE_DEPRECATED == 1 #if SCM_ENABLE_DEPRECATED == 1
scm_tc16_allocated = scm_make_smob_type ("allocated cell", 0); scm_tc16_allocated = scm_make_smob_type ("allocated cell", 0);

View file

@ -53,7 +53,7 @@ int
scm_i_insert_segment (scm_t_heap_segment *seg) scm_i_insert_segment (scm_t_heap_segment *seg)
{ {
size_t size = (scm_i_heap_segment_table_size + 1) * sizeof (scm_t_heap_segment *); size_t size = (scm_i_heap_segment_table_size + 1) * sizeof (scm_t_heap_segment *);
SCM_SYSCALL(scm_i_heap_segment_table SCM_SYSCALL (scm_i_heap_segment_table
= ((scm_t_heap_segment **) = ((scm_t_heap_segment **)
realloc ((char *)scm_i_heap_segment_table, size))); realloc ((char *)scm_i_heap_segment_table, size)));
@ -256,13 +256,13 @@ scm_i_all_segments_statistics (SCM tab)
unsigned long* unsigned long*
scm_i_segment_table_info(int* size) scm_i_segment_table_info (int* size)
{ {
*size = scm_i_heap_segment_table_size; *size = scm_i_heap_segment_table_size;
unsigned long *bounds = malloc (sizeof (unsigned long) * *size * 2); unsigned long *bounds = malloc (sizeof (unsigned long) * *size * 2);
int i; int i;
if (!bounds) if (!bounds)
abort(); abort ();
for (i = *size; i-- > 0; ) for (i = *size; i-- > 0; )
{ {
bounds[2*i] = (unsigned long)scm_i_heap_segment_table[i]->bounds[0]; bounds[2*i] = (unsigned long)scm_i_heap_segment_table[i]->bounds[0];

View file

@ -108,7 +108,7 @@ scm_i_heap_segment_marked_count (scm_t_heap_segment *seg)
int count = 0; int count = 0;
while (bvec < bvec_end) { while (bvec < bvec_end) {
count += scm_i_uint_bit_count(*bvec); count += scm_i_uint_bit_count (*bvec);
bvec ++; bvec ++;
} }
return count * seg->span; return count * seg->span;

View file

@ -387,7 +387,7 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
scm_cons (sym_cells_swept, scm_cons (sym_cells_swept,
scm_from_double (local_scm_gc_cells_swept)), scm_from_double (local_scm_gc_cells_swept)),
scm_cons (sym_malloc_yield, scm_cons (sym_malloc_yield,
scm_from_long(local_scm_gc_malloc_yield_percentage)), scm_from_long (local_scm_gc_malloc_yield_percentage)),
scm_cons (sym_cell_yield, scm_cons (sym_cell_yield,
scm_from_long (local_scm_gc_cell_yield_percentage)), scm_from_long (local_scm_gc_cell_yield_percentage)),
scm_cons (sym_protected_objects, scm_cons (sym_protected_objects,
@ -538,7 +538,7 @@ scm_t_c_hook scm_after_sweep_c_hook;
scm_t_c_hook scm_after_gc_c_hook; scm_t_c_hook scm_after_gc_c_hook;
static void static void
scm_check_deprecated_memory_return() scm_check_deprecated_memory_return ()
{ {
if (scm_mallocated < scm_i_deprecated_memory_return) if (scm_mallocated < scm_i_deprecated_memory_return)
{ {
@ -584,7 +584,7 @@ scm_i_gc (const char *what)
scm_gc_malloc_collected = 0; scm_gc_malloc_collected = 0;
/* /*
Set freelists to NULL so scm_cons() always triggers gc, causing Set freelists to NULL so scm_cons () always triggers gc, causing
the assertion above to fail. the assertion above to fail.
*/ */
*SCM_FREELIST_LOC (scm_i_freelist) = SCM_EOL; *SCM_FREELIST_LOC (scm_i_freelist) = SCM_EOL;
@ -595,7 +595,7 @@ scm_i_gc (const char *what)
garbage, and marking that would create a mess. garbage, and marking that would create a mess.
*/ */
scm_i_sweep_all_segments ("GC", &scm_i_gc_sweep_stats); scm_i_sweep_all_segments ("GC", &scm_i_gc_sweep_stats);
scm_check_deprecated_memory_return(); scm_check_deprecated_memory_return ();
/* Sanity check our numbers. */ /* Sanity check our numbers. */
@ -670,7 +670,7 @@ scm_i_gc (const char *what)
scm_i_thread_wake_up (); scm_i_thread_wake_up ();
/* /*
For debugging purposes, you could do For debugging purposes, you could do
scm_i_sweep_all_segments("debug"), but then the remains of the scm_i_sweep_all_segments ("debug"), but then the remains of the
cell aren't left to analyse. cell aren't left to analyse.
*/ */
} }
@ -774,7 +774,7 @@ scm_permanent_object (SCM obj)
*/ */
/* Implementation note: For every object X, there is a counter which /* Implementation note: For every object X, there is a counter which
scm_gc_protect_object(X) increments and scm_gc_unprotect_object(X) decrements. scm_gc_protect_object (X) increments and scm_gc_unprotect_object (X) decrements.
*/ */
@ -949,7 +949,7 @@ scm_init_storage ()
while (j) while (j)
scm_sys_protects[--j] = SCM_BOOL_F; scm_sys_protects[--j] = SCM_BOOL_F;
scm_gc_init_freelist(); scm_gc_init_freelist ();
scm_gc_init_malloc (); scm_gc_init_malloc ();
#if 0 #if 0
@ -1071,7 +1071,7 @@ void *
scm_ia64_ar_bsp (const void *ctx) scm_ia64_ar_bsp (const void *ctx)
{ {
uint64_t bsp; uint64_t bsp;
__uc_get_ar_bsp(ctx, &bsp); __uc_get_ar_bsp (ctx, &bsp);
return (void *) bsp; return (void *) bsp;
} }
# endif /* hpux */ # endif /* hpux */