Changeset 20d93fb737c36e2fa36fb1e9ac36734be14a77c6

Show
Ignore:
Timestamp:
06/20/10 04:33:21 (2 years ago)
Author:
redbrain <redbrain@…>
Parents:
1eb94519d291051d1a07e4c29ecb03fc82fddc59
Children:
aaca19fb68c3cfe89e2acb105d2c3e8f5e028275
git-committer:
redbrain <redbrain@crules.org> / 2010-06-20T04:33:21Z+0100
Message:

fixed return address garbage collection and a signed vs unsigned ref count issue

Files:
4 modified

Legend:

Unmodified
Added
Removed
  • include/crules/symbols.h

    r1eb9451 r20d93fb  
    2929  char *identifier; crl_opcode_t exp; 
    3030  crl_opcode_t type, op_a_t, op_b_t; 
    31   unsigned int n_ref; 
     31  signed int n_ref; 
    3232  union { 
    3333    // literal primitive semantic types! 
  • src/gg_garbage.c

    r1eb9451 r20d93fb  
    179179 
    180180                  // If no references remain 
    181                   if( o->n_ref == 0 ) 
     181                  if( o->n_ref <= 0 ) 
    182182                    { 
    183183                      crl_garbage_mark_obj( &o ); 
     
    436436          if( it ) 
    437437            { 
    438               if( it->n_ref == 0 ) 
     438              if( it->n_ref <= 0 ) 
    439439                { 
    440440                  crl_debug("marking object <%p>!\n", (void*)it ); 
     
    457457                            (void*)it, it->n_ref ); 
    458458                  crl_dd_stack_push( head->symbol_stack, it ); 
     459                  s_arr[idx] = NULL; 
    459460                } 
    460461              else 
  • src/rr_context.c

    r1eb9451 r20d93fb  
    8585  if( deref ) 
    8686    { 
     87      crl_symbol_obj *xret = ctx->return_address; 
    8788      void ** arr = ctx->symbol_stack->array; 
    8889      unsigned int idx = 0; 
     
    9394          if( o ) 
    9495            { 
    95               o->n_ref--; 
    96               crl_debug("de-referencing object <%p> to count <%i>!\n", 
    97                         (void*)o, o->n_ref ); 
     96              if( o != xret ) 
     97                { 
     98                  o->n_ref--; 
     99                  crl_debug("de-referencing object <%p> to count <%i>!\n", 
     100                            (void*)o, o->n_ref ); 
     101                } 
    98102            } 
    99103        } 
  • src/rr_runtime.c

    r1eb9451 r20d93fb  
    12691269            { 
    12701270              c->return_address= retval; 
     1271              Crl_Ctx_Head_Branch( ctx )->return_address = retval; 
    12711272              f= true; break; 
    12721273            } 
     
    13801381        break; 
    13811382    } 
    1382   crl_garbage_invoke_sweep( context ); 
    13831383 
    13841384  return rex;