harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r567700 - in /harmony/enhanced/drlvm/trunk/vm: gc_gen/src/common/weak_roots.cpp gc_gen/src/los/lspace_alloc_collect.cpp vmcore/src/init/finalizer_thread.cpp
Date Mon, 20 Aug 2007 13:39:52 GMT
Author: xli
Date: Mon Aug 20 06:39:51 2007
New Revision: 567700

URL: http://svn.apache.org/viewvc?rev=567700&view=rev
Log:
added a missed new file, and fix two issues in last commit.

Added:
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/weak_roots.cpp   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp

Added: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/weak_roots.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/weak_roots.cpp?rev=567700&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/weak_roots.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/weak_roots.cpp Mon Aug 20 06:39:51 2007
@@ -0,0 +1,79 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#include "gc_common.h"
+#include "gc_metadata.h"
+#include "../gen/gen.h"
+
+void identify_dead_weak_roots(GC *gc, Pool *pool)
+{
+  pool_iterator_init(pool);
+  while(Vector_Block *block = pool_iterator_next(pool)){
+    POINTER_SIZE_INT *iter = vector_block_iterator_init(block);
+    for(; !vector_block_iterator_end(block, iter); iter = vector_block_iterator_advance(block,
iter)){
+      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object**)*iter;
+      Partial_Reveal_Object *p_obj = *p_ref;
+      if(!p_obj){  // reference has been cleared
+        continue;
+      }
+      if(IS_FALLBACK_COMPACTION) {
+          if(obj_belongs_to_nos(p_obj) && obj_is_fw_in_oi(p_obj)){
+             //this is unreachable for VTable->jlc(p_obj), but needed by general weak
roots
+             assert(!obj_is_marked_in_vt(p_obj));
+             assert(obj_get_vt(p_obj) == obj_get_vt(obj_get_fw_in_oi(p_obj)));
+             p_obj = obj_get_fw_in_oi(p_obj);
+             assert(p_obj);
+             *p_ref = p_obj;
+          }
+      }
+      if(gc_obj_is_dead(gc, p_obj))
+        *p_ref = 0; 
+    }
+  }
+}
+
+extern Boolean IS_MOVE_COMPACT;
+
+/* parameter pointer_addr_in_pool means it is p_ref or p_obj in pool */
+void gc_update_weak_roots_pool(GC *gc)
+{
+  GC_Metadata* metadata = gc->metadata;
+  Pool *pool = metadata->weak_roots_pool;
+  Partial_Reveal_Object** p_ref;
+  Partial_Reveal_Object *p_obj;
+  
+  pool_iterator_init(pool);
+  while(Vector_Block *repset = pool_iterator_next(pool)){
+    POINTER_SIZE_INT *iter = vector_block_iterator_init(repset);
+    for(; !vector_block_iterator_end(repset,iter); iter = vector_block_iterator_advance(repset,iter)){
+      p_ref = (Partial_Reveal_Object**)*iter;
+      p_obj = *p_ref;
+      if(!p_obj){  // reference has been cleared
+        continue;
+      }
+
+      if(obj_need_move(gc, p_obj))  {
+        if(!IS_MOVE_COMPACT){
+          assert((POINTER_SIZE_INT)obj_get_fw_in_oi(p_obj) > DUAL_MARKBITS);
+          *p_ref = obj_get_fw_in_oi(p_obj);
+        } else {
+          assert(space_of_addr(gc, (void*)p_obj)->move_object);
+          *p_ref = ref_to_obj_ptr(obj_get_fw_in_table(p_obj));
+        }
+      }
+    }
+  }
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/weak_roots.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp?rev=567700&r1=567699&r2=567700&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp Mon Aug 20 06:39:51
2007
@@ -353,7 +353,6 @@
         /*LOS_Shrink: We don't have to scan lspace to build free pool when slide compact
LOS*/
         assert((POINTER_SIZE_INT)lspace->scompact_fa_end > (POINTER_SIZE_INT)lspace->scompact_fa_start
+ tuner->tuning_size);
         new_fa_size = (POINTER_SIZE_INT)lspace->scompact_fa_end - (POINTER_SIZE_INT)lspace->scompact_fa_start
- tuner->tuning_size;
-        if(new_fa_size == 0) break;
         Free_Area* fa = free_area_new(lspace->scompact_fa_start,  new_fa_size);
         if(new_fa_size >= GC_OBJ_SIZE_THRESHOLD) free_pool_add_area(lspace->free_pool,
fa);
         break;
@@ -363,6 +362,7 @@
         assert(tuner->kind == TRANS_NOTHING);
         assert(!tuner->tuning_size);
         new_fa_size = (POINTER_SIZE_INT)lspace->scompact_fa_end - (POINTER_SIZE_INT)lspace->scompact_fa_start;
+        if(new_fa_size == 0) break;
         Free_Area* fa = free_area_new(lspace->scompact_fa_start,  new_fa_size);
         if(new_fa_size >= GC_OBJ_SIZE_THRESHOLD) free_pool_add_area(lspace->free_pool,
fa);
         break;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp?rev=567700&r1=567699&r2=567700&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp Mon Aug 20 06:39:51
2007
@@ -160,7 +160,7 @@
     hymutex_lock(&fin_thread_info->end_mutex);
     unsigned int fin_obj_num = vm_get_finalizable_objects_quantity();
     while(fin_thread_info->working_thread_num || fin_obj_num){
-        unsigned int wait_time = restrict_wait_time(fin_obj_num + 100, FIN_MAX_WAIT_TIME
<< 7);
+        unsigned int wait_time = restrict_wait_time((fin_obj_num + 100)<<1, FIN_MAX_WAIT_TIME
<< 7);
         atomic_inc32(&fin_thread_info->end_waiting_num);
         IDATA status = hycond_wait_timed(&fin_thread_info->end_cond, &fin_thread_info->end_mutex,
(I_64)wait_time, 0);
         atomic_dec32(&fin_thread_info->end_waiting_num);



Mime
View raw message