harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r542374 - in /harmony/enhanced/drlvm/trunk/vm/gc_gen/src: common/gc_common.h common/gc_for_vm.cpp finalizer_weakref/finalizer_weakref_metadata.cpp mark_compact/mspace_alloc.cpp thread/collector_alloc.h utils/sync_stack.h utils/vector_block.h
Date Tue, 29 May 2007 01:31:55 GMT
Author: xli
Date: Mon May 28 18:31:54 2007
New Revision: 542374

URL: http://svn.apache.org/viewvc?view=rev&rev=542374
Log:
HARMONY-3973, HARMONY-3974, HARMONY-3975, HARMONY-3976, HARMONY-3977, HARMONY-3978 : mark
the unsafe region so that the thread checker doesn't report false alarms.

Modified:
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_alloc.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h?view=diff&rev=542374&r1=542373&r2=542374
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h Mon May 28 18:31:54 2007
@@ -22,6 +22,7 @@
 #define _GC_COMMON_H_
 
 #include "port_vmem.h"
+#include "port_threadunsafe.h" /* to mark unsafe region (race but correct) */
 
 #include "platform_lowlevel.h"
 
@@ -172,7 +173,11 @@
 {  return ref_to_obj_ptr(*p_slot); }
 
 FORCE_INLINE void write_slot(REF *p_slot, Partial_Reveal_Object *p_obj)
-{  *p_slot = obj_ptr_to_ref(p_obj); }
+{ 
+  UNSAFE_REGION_START
+  *p_slot = obj_ptr_to_ref(p_obj); 
+  UNSAFE_REGION_END
+}
 
 
 inline POINTER_SIZE_INT round_up_to_size(POINTER_SIZE_INT size, int block_size) 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp?view=diff&rev=542374&r1=542373&r2=542374
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp Mon May 28 18:31:54 2007
@@ -296,7 +296,9 @@
 
 Boolean gc_clear_mutator_block_flag()
 {
+  UNSAFE_REGION_START
   Boolean old_flag = mutator_need_block;
   mutator_need_block = FALSE;
+  UNSAFE_REGION_END
   return old_flag;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp?view=diff&rev=542374&r1=542373&r2=542374
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp
Mon May 28 18:31:54 2007
@@ -203,9 +203,11 @@
   assert(collector->softref_set == NULL);
   assert(collector->weakref_set == NULL);
   assert(collector->phanref_set == NULL);
+  UNSAFE_REGION_START
   collector->softref_set = finref_get_free_block(gc);
   collector->weakref_set = finref_get_free_block(gc);
   collector->phanref_set= finref_get_free_block(gc);
+  UNSAFE_REGION_END
 }
 
 /* put back last weak references block of each collector */
@@ -217,12 +219,14 @@
   for(unsigned int i = 0; i < num_active_collectors; i++)
   {
     Collector* collector = gc->collectors[i];
+    UNSAFE_REGION_START
     pool_put_entry(metadata->softref_pool, collector->softref_set);
     pool_put_entry(metadata->weakref_pool, collector->weakref_set);
     pool_put_entry(metadata->phanref_pool, collector->phanref_set);
     collector->softref_set = NULL;
     collector->weakref_set= NULL;
     collector->phanref_set= NULL;
+    UNSAFE_REGION_END
   }
   return;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_alloc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_alloc.cpp?view=diff&rev=542374&r1=542373&r2=542374
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_alloc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_alloc.cpp Mon May 28 18:31:54
2007
@@ -36,7 +36,9 @@
     }
     /* ok, got one */
     Block_Header* alloc_block = (Block_Header*)&(mspace->blocks[allocated_idx - mspace->first_block_idx]);
+    UNSAFE_REGION_START
     mspace->alloced_size += GC_BLOCK_SIZE_BYTES;
+    UNSAFE_REGION_END
 
     allocator_init_free_block(allocator, alloc_block);
     
@@ -74,4 +76,5 @@
     
   return p_return;
 }
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h?view=diff&rev=542374&r1=542373&r2=542374
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h Mon May 28 18:31:54
2007
@@ -22,6 +22,8 @@
 #define _COLLECTOR_ALLOC_H_
 
 #include "gc_thread.h"
+#include "port_threadunsafe.h"
+
 #ifdef USE_32BITS_HASHCODE
 #include "../common/hashcode.h"
 #endif
@@ -70,10 +72,14 @@
 
 #ifdef USE_32BITS_HASHCODE
   if(obj_is_set_hashcode){
+    UNSAFE_REGION_START
     memcpy(p_targ_obj, p_obj, size-GC_OBJECT_ALIGNMENT);
+    UNSAFE_REGION_END
     oi = trace_forward_process_hashcode(p_targ_obj, p_obj ,oi, size);
   }else{
+    UNSAFE_REGION_START
     memcpy(p_targ_obj, p_obj, size);    
+    UNSAFE_REGION_END
   }
 #else
   memcpy(p_targ_obj, p_obj, size);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h?view=diff&rev=542374&r1=542373&r2=542374
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h Mon May 28 18:31:54 2007
@@ -18,6 +18,7 @@
  * @author Xiao-Feng Li, 2006/10/25
  */
  
+#include "port_threadunsafe.h"
 #ifndef _SYNC_STACK_H_
 #define _SYNC_STACK_H_
 
@@ -108,7 +109,9 @@
     POINTER_SIZE_INT temp = stack_top_contruct(top_entry->next, version);
     temp = (POINTER_SIZE_INT)atomic_casptr((volatile void**)&stack->top, (void*)temp,
(void*)cur_top);
     if(temp == *(POINTER_SIZE_INT*)&cur_top){ // got it  
+      UNSAFE_REGION_START
       top_entry->next = NULL;
+      UNSAFE_REGION_END
       return top_entry;
     }
     cur_top = stack->top;
@@ -121,7 +124,9 @@
 inline Boolean sync_stack_push(Sync_Stack* stack, Node* node)
 {
   Stack_Top cur_top = stack->top;
+  UNSAFE_REGION_START
   node->next = stack_top_get_entry(cur_top);
+  UNSAFE_REGION_END
   POINTER_SIZE_INT new_version = stack_top_get_next_version(cur_top);
   POINTER_SIZE_INT temp = stack_top_contruct(node, new_version);
  

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h?view=diff&rev=542374&r1=542373&r2=542374
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h Mon May 28 18:31:54 2007
@@ -20,6 +20,7 @@
  
 #ifndef _VECTOR_BLOCK_H_
 #define _VECTOR_BLOCK_H_
+#include "port_threadunsafe.h"
 
 typedef struct Vector_Block{
   void* next; /* point to next block */
@@ -99,16 +100,20 @@
 /* Below is to use Vector_Block as stack (for trace-forwarding DFS order ) */
 inline void vector_stack_init(Vector_Block* block)
 { 
+  UNSAFE_REGION_START
   block->tail = block->heap_end;
-  block->head = block->heap_end;  
+  block->head = block->heap_end;
+  UNSAFE_REGION_END
 }
 
 inline void vector_stack_clear(Vector_Block* block)
 {
+  UNSAFE_REGION_START
   vector_stack_init(block);
 #ifdef _DEBUG
   memset(block->entries, 0, (POINTER_SIZE_INT)block->heap_end - (POINTER_SIZE_INT)block->entries);
 #endif
+  UNSAFE_REGION_END
 }
 
 inline Boolean vector_stack_is_empty(Vector_Block* block)
@@ -124,11 +129,13 @@
 
 inline void vector_stack_push(Vector_Block* block, POINTER_SIZE_INT value)
 { 
+  UNSAFE_REGION_START
   block->head--;
 #ifdef _DEBUG
   assert(value && !*(block->head));
 #endif
   *(block->head) = value;
+  UNSAFE_REGION_END
 }
 
 inline POINTER_SIZE_INT vector_stack_pop(Vector_Block* block)



Mime
View raw message