chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] remove obsolete heap-allocation functions


From: Felix
Subject: [Chicken-hackers] [PATCH] remove obsolete heap-allocation functions
Date: Tue, 25 Oct 2011 12:56:15 +0200 (CEST)

The attached patch removes some unused functions from runtime.c, which
where kindly pointed out by Joerg.


cheers,
felix
>From f7ba66b5fb75a8594972974bf93b0775c8742f6f Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Tue, 25 Oct 2011 12:55:13 +0200
Subject: [PATCH] remove obsolete C_h_... allocation functions (pointed out by 
Joerg Wittenberger)

---
 chicken.h |    4 --
 runtime.c |   93 -------------------------------------------------------------
 2 files changed, 0 insertions(+), 97 deletions(-)

diff --git a/chicken.h b/chicken.h
index 5524bc4..af17015 100644
--- a/chicken.h
+++ b/chicken.h
@@ -1575,7 +1575,6 @@ C_fctexport void C_no_closure_error(C_word x) C_noret;
 C_fctexport void C_div_by_zero_error(char *loc) C_noret;
 C_fctexport C_word C_closure(C_word **ptr, int cells, C_word proc, ...);
 C_fctexport C_word C_fcall C_pair(C_word **ptr, C_word car, C_word cdr) 
C_regparm;
-C_fctexport C_word C_fcall C_h_pair(C_word car, C_word cdr) C_regparm;
 C_fctexport C_word C_fcall C_number(C_word **ptr, double n) C_regparm;
 C_fctexport C_word C_fcall C_mpointer(C_word **ptr, void *mp) C_regparm;
 C_fctexport C_word C_fcall C_mpointer_or_false(C_word **ptr, void *mp) 
C_regparm;
@@ -1585,9 +1584,7 @@ C_fctexport C_word C_fcall C_taggedmpointer(C_word **ptr, 
C_word tag, void *mp)
 C_fctexport C_word C_fcall C_taggedmpointer_or_false(C_word **ptr, C_word tag, 
void *mp) C_regparm;
 C_fctexport C_word C_fcall C_swigmpointer(C_word **ptr, void *mp, void *sdata) 
C_regparm;
 C_fctexport C_word C_vector(C_word **ptr, int n, ...);
-C_fctexport C_word C_h_vector(int n, ...);
 C_fctexport C_word C_structure(C_word **ptr, int n, ...);
-C_fctexport C_word C_h_structure(int n, ...);
 C_fctexport C_word C_fcall C_mutate(C_word *slot, C_word val) C_regparm;
 C_fctexport void C_fcall C_reclaim(void *trampoline, void *proc) C_regparm 
C_noret;
 C_fctexport void C_save_and_reclaim(void *trampoline, void *proc, int n, ...) 
C_noret;
@@ -1707,7 +1704,6 @@ C_fctexport C_word *C_a_i(C_word **a, int n);
 
 C_fctexport time_t C_fcall C_seconds(long *ms) C_regparm;
 C_fctexport C_word C_a_i_list(C_word **a, int c, ...);
-C_fctexport C_word C_h_list(int c, ...);
 C_fctexport C_word C_a_i_string(C_word **a, int c, ...);
 C_fctexport C_word C_a_i_record(C_word **a, int c, ...);
 C_fctexport C_word C_a_i_port(C_word **a, int c);
diff --git a/runtime.c b/runtime.c
index 05bf39c..0dcd427 100644
--- a/runtime.c
+++ b/runtime.c
@@ -2400,25 +2400,6 @@ C_regparm C_word C_fcall C_pair(C_word **ptr, C_word 
car, C_word cdr)
 }
 
 
-C_regparm C_word C_fcall C_h_pair(C_word car, C_word cdr)
-{
-  /* Allocate on heap and check for non-heap slots: */
-  C_word *p = (C_word *)C_fromspace_top,
-         *p0 = p;
- 
-  *(p++) = C_PAIR_TYPE | (C_SIZEOF_PAIR - 1);
-
-  if(C_in_stackp(car)) C_mutate(p++, car);
-  else *(p++) = car;
-
-  if(C_in_stackp(cdr)) C_mutate(p++, cdr);
-  else *(p++) = cdr;
-
-  C_fromspace_top = (C_byte *)p;
-  return (C_word)p0;
-}
-
-
 C_regparm C_word C_fcall C_number(C_word **ptr, double n)
 {
   C_word 
@@ -2555,54 +2536,6 @@ C_word C_structure(C_word **ptr, int n, ...)
 }
 
 
-C_word C_h_vector(int n, ...)
-{
-  /* As C_vector(), but remember slots containing nursery pointers: */
-  va_list v;
-  C_word *p = (C_word *)C_fromspace_top,
-         *p0 = p,
-         x; 
-
-  *(p++) = C_VECTOR_TYPE | n;
-  va_start(v, n);
-
-  while(n--) {
-    x = va_arg(v, C_word);
-
-    if(C_in_stackp(x)) C_mutate(p++, x);
-    else *(p++) = x;
-  }
-
-  C_fromspace_top = (C_byte *)p;
-  va_end(v);
-  return (C_word)p0;
-}
-
-
-C_word C_h_structure(int n, ...)
-{
-  /* As C_structure(), but remember slots containing nursery pointers: */
-  va_list v;
-  C_word *p = (C_word *)C_fromspace_top,
-         *p0 = p,
-         x; 
-
-  *(p++) = C_STRUCTURE_TYPE | n;
-  va_start(v, n);
-
-  while(n--) {
-    x = va_arg(v, C_word);
-
-    if(C_in_stackp(x)) C_mutate(p++, x);
-    else *(p++) = x;
-  }
-
-  C_fromspace_top = (C_byte *)p;
-  va_end(v);
-  return (C_word)p0;
-}
-
-
 C_regparm C_word C_fcall C_mutate(C_word *slot, C_word val)
 {
   int mssize;
@@ -4441,32 +4374,6 @@ C_word C_a_i_list(C_word **a, int c, ...)
 }
 
 
-C_word C_h_list(int c, ...)
-{
-  /* Similar to C_a_i_list(), but put slots with nursery data into mutation 
stack: */
-  va_list v;
-  C_word x, last, current,
-         first = C_SCHEME_END_OF_LIST;
-
-  va_start(v, c);
-
-  for(last = C_SCHEME_UNDEFINED; c--; last = current) {
-    x = va_arg(v, C_word);
-    current = C_a_pair(C_heaptop, x, C_SCHEME_END_OF_LIST);
-
-    if(C_in_stackp(x)) 
-      C_mutate(&C_u_i_car(current), x);
-
-    if(last != C_SCHEME_UNDEFINED)
-      C_set_block_item(last, 1, current);
-    else first = current;
-  }
-
-  va_end(v);
-  return first;
-}
-
-
 C_word C_a_i_string(C_word **a, int c, ...)
 {
   va_list v;
-- 
1.6.0.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]