/[guile]/guile/guile-core/libguile/inline.h
ViewVC logotype

Diff of /guile/guile-core/libguile/inline.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by mvo, Sun Nov 3 22:05:09 2002 UTC revision 1.13 by mdj, Mon Dec 9 13:42:58 2002 UTC
# Line 57  Line 57 
57    
58  #include "libguile/pairs.h"  #include "libguile/pairs.h"
59  #include "libguile/gc.h"  #include "libguile/gc.h"
60    #include "libguile/threads.h"
61    
62    
63  SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr);  SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr);
# Line 79  SCM Line 80  SCM
80  scm_cell (scm_t_bits car, scm_t_bits cdr)  scm_cell (scm_t_bits car, scm_t_bits cdr)
81  {  {
82    SCM z;    SCM z;
83      /* We retrieve the SCM pointer only once since the call to
84         SCM_FREELIST_LOC will be slightly expensive when we support
85         preemptive multithreading.  SCM_FREELIST_DOC will then retrieve
86         the thread specific freelist.
87      
88         Until then, SCM_FREELIST_DOC expands to (&scm_i_freelist) and the
89         following code will compile to the same as if we had worked
90         directly on the scm_i_freelist variable.
91       */
92      SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist);
93    
94    if (SCM_NULLP (scm_i_freelist))    if (SCM_NULLP (*freelist))
95      {      z = scm_gc_for_newcell (&scm_i_master_freelist, freelist);
       z = scm_gc_for_newcell (&scm_i_master_freelist, &scm_i_freelist);  
     }  
96    else    else
97      {      {
98        z = scm_i_freelist;        z = *freelist;
99        scm_i_freelist = SCM_FREE_CELL_CDR (scm_i_freelist);        *freelist = SCM_FREE_CELL_CDR (*freelist);
100      }      }
101    
102    /*    /*
# Line 136  scm_cell (scm_t_bits car, scm_t_bits cdr Line 145  scm_cell (scm_t_bits car, scm_t_bits cdr
145    SCM_GC_SET_CELL_WORD (z, 1, cdr);    SCM_GC_SET_CELL_WORD (z, 1, cdr);
146    SCM_GC_SET_CELL_WORD (z, 0, car);    SCM_GC_SET_CELL_WORD (z, 0, car);
147    
148    #if 0 /*fixme* Hmm... let's consider this later. */
149  #if !defined(USE_COOP_THREADS) && !defined(USE_NULL_THREADS) && !defined(USE_COPT_THREADS)  #if !defined(USE_COOP_THREADS) && !defined(USE_NULL_THREADS) && !defined(USE_COPT_THREADS)
150    /* When we are using preemtive threads, we might need to make    /* When we are using preemtive threads, we might need to make
151       sure that the initial values for the slots are protected until       sure that the initial values for the slots are protected until
# Line 144  scm_cell (scm_t_bits car, scm_t_bits cdr Line 154  scm_cell (scm_t_bits car, scm_t_bits cdr
154  #error review me  #error review me
155    scm_remember_upto_here_1 (SCM_PACK (cdr));    scm_remember_upto_here_1 (SCM_PACK (cdr));
156  #endif  #endif
157    #endif
158    
159  #if (SCM_DEBUG_CELL_ACCESSES == 1)  #if (SCM_DEBUG_CELL_ACCESSES == 1)
160    if (scm_expensive_debug_cell_accesses_p )    if (scm_expensive_debug_cell_accesses_p )
# Line 160  scm_double_cell (scm_t_bits car, scm_t_b Line 170  scm_double_cell (scm_t_bits car, scm_t_b
170                   scm_t_bits ccr, scm_t_bits cdr)                   scm_t_bits ccr, scm_t_bits cdr)
171  {  {
172    SCM z;    SCM z;
173      SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist2);
174    
175      if (SCM_NULLP (*freelist))
176    if (SCM_NULLP (scm_i_freelist2))      z = scm_gc_for_newcell (&scm_i_master_freelist2, freelist);
     {  
       z = scm_gc_for_newcell (&scm_i_master_freelist2, &scm_i_freelist2);  
     }  
177    else    else
178      {      {
179        z = scm_i_freelist2;        z = *freelist;
180        scm_i_freelist2 = SCM_FREE_CELL_CDR (scm_i_freelist2);        *freelist = SCM_FREE_CELL_CDR (*freelist);
181      }      }
182    
183    scm_cells_allocated += 2;    scm_cells_allocated += 2;
# Line 185  scm_double_cell (scm_t_bits car, scm_t_b Line 193  scm_double_cell (scm_t_bits car, scm_t_b
193    SCM_GC_SET_CELL_WORD (z, 3, cdr);    SCM_GC_SET_CELL_WORD (z, 3, cdr);
194    SCM_GC_SET_CELL_WORD (z, 0, car);    SCM_GC_SET_CELL_WORD (z, 0, car);
195    
196    #if 0 /*fixme* Hmm... let's consider this later. */
197  #if !defined(USE_COOP_THREADS) && !defined(USE_NULL_THREADS) && !defined(USE_COPT_THREADS)  #if !defined(USE_COOP_THREADS) && !defined(USE_NULL_THREADS) && !defined(USE_COPT_THREADS)
198    /* When we are using non-cooperating threads, we might need to make    /* When we are using non-cooperating threads, we might need to make
199       sure that the initial values for the slots are protected until       sure that the initial values for the slots are protected until
# Line 193  scm_double_cell (scm_t_bits car, scm_t_b Line 202  scm_double_cell (scm_t_bits car, scm_t_b
202  #error review me  #error review me
203    scm_remember_upto_here_3 (SCM_PACK (cbr), SCM_PACK (ccr), SCM_PACK (cdr));    scm_remember_upto_here_3 (SCM_PACK (cbr), SCM_PACK (ccr), SCM_PACK (cdr));
204  #endif  #endif
205    #endif
206    
207    
208  #if (SCM_DEBUG_CELL_ACCESSES == 1)  #if (SCM_DEBUG_CELL_ACCESSES == 1)

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26