[BACK]Return to mallocx.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / gc

Diff for /OpenXM_contrib2/asir2000/gc/mallocx.c between version 1.4 and 1.5

version 1.4, 2002/07/24 07:46:19 version 1.5, 2002/07/24 08:00:10
Line 177  register int k;
Line 177  register int k;
     lw = ROUNDED_UP_WORDS(lb);      lw = ROUNDED_UP_WORDS(lb);
     n_blocks = OBJ_SZ_TO_BLOCKS(lw);      n_blocks = OBJ_SZ_TO_BLOCKS(lw);
     init = GC_obj_kinds[k].ok_init;      init = GC_obj_kinds[k].ok_init;
       if (GC_debugging_started) GC_print_all_smashed();
     GC_INVOKE_FINALIZERS();      GC_INVOKE_FINALIZERS();
     DISABLE_SIGNALS();      DISABLE_SIGNALS();
     LOCK();      LOCK();
Line 286  register struct obj_kind * kind = GC_obj_kinds + k;
Line 287  register struct obj_kind * kind = GC_obj_kinds + k;
 register ptr_t op;  register ptr_t op;
 DCL_LOCK_STATE;  DCL_LOCK_STATE;
   
       if (GC_debugging_started) GC_print_all_smashed();
     GC_INVOKE_FINALIZERS();      GC_INVOKE_FINALIZERS();
     DISABLE_SIGNALS();      DISABLE_SIGNALS();
     LOCK();      LOCK();
Line 323  extern ptr_t GC_reclaim_generic();
Line 325  extern ptr_t GC_reclaim_generic();
 /* GC_malloc_many or friends to replenish it.  (We do not round up      */  /* GC_malloc_many or friends to replenish it.  (We do not round up      */
 /* object sizes, since a call indicates the intention to consume many   */  /* object sizes, since a call indicates the intention to consume many   */
 /* objects of exactly this size.)                                       */  /* objects of exactly this size.)                                       */
   /* We return the free-list by assigning it to *result, since it is      */
   /* not safe to return, e.g. a linked list of pointer-free objects,      */
   /* since the collector would not retain the entire list if it were      */
   /* invoked just as we were returning.                                   */
 /* Note that the client should usually clear the link field.            */  /* Note that the client should usually clear the link field.            */
 ptr_t GC_generic_malloc_many(lb, k)  void GC_generic_malloc_many(lb, k, result)
 register word lb;  register word lb;
 register int k;  register int k;
   ptr_t *result;
 {  {
 ptr_t op;  ptr_t op;
 ptr_t p;  ptr_t p;
Line 345  DCL_LOCK_STATE;
Line 352  DCL_LOCK_STATE;
     if (!SMALL_OBJ(lb)) {      if (!SMALL_OBJ(lb)) {
         op = GC_generic_malloc(lb, k);          op = GC_generic_malloc(lb, k);
         if(0 != op) obj_link(op) = 0;          if(0 != op) obj_link(op) = 0;
         return(op);          *result = op;
           return;
     }      }
     lw = ALIGNED_WORDS(lb);      lw = ALIGNED_WORDS(lb);
       if (GC_debugging_started) GC_print_all_smashed();
     GC_INVOKE_FINALIZERS();      GC_INVOKE_FINALIZERS();
     DISABLE_SIGNALS();      DISABLE_SIGNALS();
     LOCK();      LOCK();
     if (!GC_is_initialized) GC_init_inner();      if (!GC_is_initialized) GC_init_inner();
       /* Do our share of marking work */
         if (GC_incremental && !GC_dont_gc) {
           ENTER_GC();
           GC_collect_a_little_inner(1);
           EXIT_GC();
         }
     /* First see if we can reclaim a page of objects waiting to be */      /* First see if we can reclaim a page of objects waiting to be */
     /* reclaimed.                                                  */      /* reclaimed.                                                  */
     {      {
Line 363  DCL_LOCK_STATE;
Line 378  DCL_LOCK_STATE;
         while ((hbp = *rlh) != 0) {          while ((hbp = *rlh) != 0) {
             hhdr = HDR(hbp);              hhdr = HDR(hbp);
             *rlh = hhdr -> hb_next;              *rlh = hhdr -> hb_next;
               hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no;
 #           ifdef PARALLEL_MARK  #           ifdef PARALLEL_MARK
                 {                  {
                   signed_word my_words_allocd_tmp = GC_words_allocd_tmp;                    signed_word my_words_allocd_tmp = GC_words_allocd_tmp;
Line 403  DCL_LOCK_STATE;
Line 419  DCL_LOCK_STATE;
                 GC_mem_found += my_words_allocd;                  GC_mem_found += my_words_allocd;
 #             endif  #             endif
 #             ifdef PARALLEL_MARK  #             ifdef PARALLEL_MARK
                   *result = op;
                 (void)GC_atomic_add(                  (void)GC_atomic_add(
                                 (volatile GC_word *)(&GC_words_allocd_tmp),                                  (volatile GC_word *)(&GC_words_allocd_tmp),
                                 (GC_word)(my_words_allocd));                                  (GC_word)(my_words_allocd));
Line 410  DCL_LOCK_STATE;
Line 427  DCL_LOCK_STATE;
                 -- GC_fl_builder_count;                  -- GC_fl_builder_count;
                 if (GC_fl_builder_count == 0) GC_notify_all_builder();                  if (GC_fl_builder_count == 0) GC_notify_all_builder();
                 GC_release_mark_lock();                  GC_release_mark_lock();
                 return GC_clear_stack(op);                  (void) GC_clear_stack(0);
                   return;
 #             else  #             else
                 GC_words_allocd += my_words_allocd;                  GC_words_allocd += my_words_allocd;
                 goto out;                  goto out;
Line 464  DCL_LOCK_STATE;
Line 482  DCL_LOCK_STATE;
   
           op = GC_build_fl(h, lw, ok -> ok_init, 0);            op = GC_build_fl(h, lw, ok -> ok_init, 0);
 #         ifdef PARALLEL_MARK  #         ifdef PARALLEL_MARK
               *result = op;
             GC_acquire_mark_lock();              GC_acquire_mark_lock();
             -- GC_fl_builder_count;              -- GC_fl_builder_count;
             if (GC_fl_builder_count == 0) GC_notify_all_builder();              if (GC_fl_builder_count == 0) GC_notify_all_builder();
             GC_release_mark_lock();              GC_release_mark_lock();
             return GC_clear_stack(op);              (void) GC_clear_stack(0);
               return;
 #         else  #         else
             goto out;              goto out;
 #         endif  #         endif
Line 481  DCL_LOCK_STATE;
Line 501  DCL_LOCK_STATE;
       if (0 != op) obj_link(op) = 0;        if (0 != op) obj_link(op) = 0;
   
   out:    out:
       *result = op;
     UNLOCK();      UNLOCK();
     ENABLE_SIGNALS();      ENABLE_SIGNALS();
     return(GC_clear_stack(op));      (void) GC_clear_stack(0);
 }  }
   
 GC_PTR GC_malloc_many(size_t lb)  GC_PTR GC_malloc_many(size_t lb)
 {  {
     return(GC_generic_malloc_many(lb, NORMAL));      ptr_t result;
       GC_generic_malloc_many(lb, NORMAL, &result);
       return result;
 }  }
   
 /* Note that the "atomic" version of this would be unsafe, since the    */  /* Note that the "atomic" version of this would be unsafe, since the    */

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>