Changeset 12939 in project for chicken


Ignore:
Timestamp:
01/06/09 09:47:34 (12 years ago)
Author:
felix winkelmann
Message:

added finalizable GC roots, as suggested by Alejandro

Location:
chicken/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/NEWS

    r12920 r12939  
    55- removed `-extension' option
    66- removed `-static-extensions' csc option and added `-static-extension NAME'
     7- `regex' unit: removed `regexp*' and `regex-optimize'
     8- added `CHICKEN_new_finalizable_gc_root()'
    79
    8104.0.0x3
  • chicken/trunk/TODO

    r12938 r12939  
    11TODO for trunk                                                          -*- Outline -*-
    22
     3
     4* bugs
    35
    46** compiler
     
    3032    exists.
    3133
    32 ** build
    33 *** fix mingw build, quickly
    34 
    3534** libraries/build
    36 *** check use of paths with windows builds: proper handling of quoting and
    37     slashes on all shell configurations?
    38 *** utility function for converting slashes to backslashes
    39     (or some other "canonicalization" operation)
     35*** path-handling for process invocation
     36**** try Lars Nilsson's suggestion
     37**** append ".exe" on windows
    4038
    4139
     
    4644
    4745** expander
    48 *** at some stage disable debug-output in expand.scm
     46*** at some stage remove debug-output in expand.scm
    4947
    5048** module issues
     
    7169** setup/install
    7270*** setup-download
    73 **** use HTTP_PROXY env. var
     71**** use "HTTP_PROXY"/"http_proxy" env. var
    7472**** handle redirects in http-fetch
    7573*** automatically update db after extension installation?
     
    9694*** document qs, normalize-pathname
    9795
    98 ** "weak" gc roots (as suggested by Alejo)
    9996
    10097* tests
  • chicken/trunk/chicken.h

    r12937 r12939  
    550550  C_word value;
    551551  struct C_gc_root_struct *next, *prev;
     552  int finalizable;
    552553} C_GC_ROOT;
    553554
     
    11621163C_fctexport C_word CHICKEN_continue(C_word k);
    11631164C_fctexport void *CHICKEN_new_gc_root();
     1165C_fctexport void *CHICKEN_new_finalizable_gc_root();
     1166C_fctexport void *CHICKEN_new_gc_root_2(int finalizable);
    11641167C_fctexport void CHICKEN_delete_gc_root(void *root);
    11651168C_fctexport void *CHICKEN_global_lookup(char *name);
  • chicken/trunk/manual/Embedding

    r5945 r12939  
    280280
    281281
     282=== CHICKEN_new_finalizable_gc_root
     283
     284 [C function] void* CHICKEN_new_finalizable_gc_root ()
     285
     286Similar to {{CHICKEN_new_gc_root}}, but allows the stored value to
     287be finalized: if this gc root holds reference to an otherwise
     288unreferenced data object that has a finalizer, the finalizer is still
     289invoked.
     290
     291
    282292=== CHICKEN_delete_gc_root
    283293
  • chicken/trunk/runtime.c

    r12937 r12939  
    808808
    809809
    810 void *CHICKEN_new_gc_root()
     810void *CHICKEN_new_gc_root_2(int finalizable)
    811811{
    812812  C_GC_ROOT *r = (C_GC_ROOT *)C_malloc(sizeof(C_GC_ROOT));
     
    818818  r->next = gc_root_list;
    819819  r->prev = NULL;
     820  r->finalizable = finalizable;
    820821
    821822  if(gc_root_list != NULL) gc_root_list->prev = r;
     
    823824  gc_root_list = r;
    824825  return (void *)r;
     826}
     827
     828
     829void *CHICKEN_new_gc_root()
     830{
     831  return CHICKEN_new_gc_root_2(0);
     832}
     833
     834
     835void *CHICKEN_new_finalizable_gc_root()
     836{
     837  return CHICKEN_new_gc_root_2(1);
    825838}
    826839
     
    27032716      if(*msp != NULL) mark(*msp);
    27042717
    2705     /* mark GC roots: */
    2706     for(gcrp = gc_root_list; gcrp != NULL; gcrp = gcrp->next)
    2707       mark(&gcrp->value);
     2718    /* mark normal GC roots: */
     2719    for(gcrp = gc_root_list; gcrp != NULL; gcrp = gcrp->next) {
     2720      if(!gcrp->finalizable) mark(&gcrp->value);
     2721    }
    27082722
    27092723    /* mark finalizer procedures: */
     
    27782792        }
    27792793
     2794        /* mark finalizable GC roots: */
     2795        for(gcrp = gc_root_list; gcrp != NULL; gcrp = gcrp->next) {
     2796          if(gcrp->finalizable) mark(&gcrp->value);
     2797        }
     2798
    27802799        if(gc_report_flag && fcount > 0)
    27812800          C_printf(C_text("[GC] %d finalizer value(s) marked\n"), fcount);
     
    27912810
    27922811          mark(&flist->item);
     2812        }
     2813
     2814        /* mark finalizable GC roots: */
     2815        for(gcrp = gc_root_list; gcrp != NULL; gcrp = gcrp->next) {
     2816          if(gcrp->finalizable) mark(&gcrp->value);
    27932817        }
    27942818      }
  • chicken/trunk/tests/runtests.sh

    r12920 r12939  
    9797$interpret -s test-finalizers.scm
    9898
     99echo "======================================== finalizer tests (2) ..."
     100$compile test-finalizers-2.scm && ./a.out
     101
    99102echo "======================================== locative stress test ..."
    100103$compile locative-stress-test.scm && ./a.out
Note: See TracChangeset for help on using the changeset viewer.