harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r599482 - in /harmony/enhanced/drlvm/trunk: build/make/ build/make/components/ build/make/components/vm/ vm/gc_gen/src/common/ vm/gc_gen/src/los/ vm/gc_gen/src/mark_compact/ vm/gc_gen/src/mark_sweep/ vm/gc_gen/src/thread/ vm/vmcore/include/...
Date Thu, 29 Nov 2007 15:22:43 GMT
Author: xli
Date: Thu Nov 29 07:22:40 2007
New Revision: 599482

URL: http://svn.apache.org/viewvc?rev=599482&view=rev
Log:
HARMONY-5098 : [drlvm][gc_gen] Support for uncompressed heap references in gc

Modified:
    harmony/enhanced/drlvm/trunk/build/make/build.xml
    harmony/enhanced/drlvm/trunk/build/make/components/vm.xml
    harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml
    harmony/enhanced/drlvm/trunk/build/make/deploy.xml
    harmony/enhanced/drlvm/trunk/build/make/harmonyvm.properties
    harmony/enhanced/drlvm/trunk/build/make/selector.xsl
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/hashcode.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_fallback_mark.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_mark.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp

Modified: harmony/enhanced/drlvm/trunk/build/make/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/build.xml?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/build.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/build.xml Thu Nov 29 07:22:40 2007
@@ -349,6 +349,10 @@
 
 
     <target name="init.compressed.mode">
+        <!-- Only uncompressed mode is allowed for x86 -->
+        <condition property="refs.comp.mode" value="REFS_USE_UNCOMPRESSED">
+            <isset property="is.x86" />
+        </condition>
         <!-- refs.comp.mode from command line -->
         <condition property="refs.comp.mode.tmp" value="${COMPRESSED_MODE}">
             <isset property="COMPRESSED_MODE" />
@@ -392,6 +396,7 @@
             <param name="cxx" expression="${build.cxx}" />
             <param name="hynosig" expression="${hy.no.sig}" />
             <param name="hylocalzlib" expression="${hy.local.zlib}" />
+            <param name="refsmode" expression="${refs.comp.mode}" />
         </xslt>
 
         <xmlproperty file="${build.semi.dir}/deploy.xml" keeproot="true" collapseAttributes="true"
/>

Modified: harmony/enhanced/drlvm/trunk/build/make/components/vm.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/components/vm.xml?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/components/vm.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/components/vm.xml Thu Nov 29 07:22:40 2007
@@ -32,6 +32,7 @@
             <property  name="build.depends" value="vm.vmcore, 
                                                    vm.em, 
                                                    vm.gc_gen,
+                                                   vm.gc_gen_uncomp,
                                                    vm.gc_cc,
                                                    vm.vmi,
                                                    vm.interpreter,

Modified: harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml Thu Nov 29 07:22:40 2007
@@ -27,7 +27,14 @@
   -->
 
 <project name="vm.gc_gen">
-    <target name="init" depends="common_vm">
+    <!-- Do we need CG for compressed mode -->
+    <condition property="build.compressed.gc">
+        <not><!-- refs.comp.mode is not REFS_USE_UNCOMPRESSED for compressed and
runtime switching modes -->
+            <equals arg1="${refs.comp.mode}" arg2="REFS_USE_UNCOMPRESSED" />
+        </not>
+    </condition>
+
+    <target name="init" depends="common_vm" if="build.compressed.gc">
         <property name="build.depends" value="extra.apr,vm.vmcore,vm.hythr,vm.kernel_classes"
/>
         <property name="outtype" value="shared" />
         <property name="libname" value="gc_gen" />
@@ -65,6 +72,7 @@
             </fileset>
 
             <defineset define="BUILDING_GC" />
+            <defineset define="COMPRESS_REFERENCE" />
 
             <defineset define="_USRDLL" if="is.windows"/>
         </compiler>

Modified: harmony/enhanced/drlvm/trunk/build/make/deploy.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/deploy.xml?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/deploy.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/deploy.xml Thu Nov 29 07:22:40 2007
@@ -51,10 +51,19 @@
         </jitrino>
         </select>
 
+        <select refsmode="REFS_USE_COMPRESSED,REFS_USE_RUNTIME_SWITCH">
         <gc_gen>
             <shared>bin/default:gc_gen</shared>
             <jar>bin/default:gc_gen</jar>
         </gc_gen>
+        </select>
+
+        <select refsmode="REFS_USE_UNCOMPRESSED,REFS_USE_RUNTIME_SWITCH">
+        <gc_gen_uncomp>
+            <shared>bin/default:gc_gen_uncomp</shared>
+            <jar>bin/default:gc_gen_uncomp</jar>
+        </gc_gen_uncomp>
+        </select>
 
         <gc_cc>
             <shared>bin/default:gc_cc</shared>

Modified: harmony/enhanced/drlvm/trunk/build/make/harmonyvm.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/harmonyvm.properties?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/harmonyvm.properties (original)
+++ harmony/enhanced/drlvm/trunk/build/make/harmonyvm.properties Thu Nov 29 07:22:40 2007
@@ -17,5 +17,9 @@
 bootclasspath.kernel.source.4=%LAUNCHER_HOME%/%VM_DIR%/gc_gen-src.jar
 bootclasspath.kernel.source.packageroot.4=/
 
+bootclasspath.kernel.5=%LAUNCHER_HOME%/%VM_DIR%/gc_gen_uncomp.jar
+bootclasspath.kernel.source.5=%LAUNCHER_HOME%/%VM_DIR%/gc_gen_uncomp-src.jar
+bootclasspath.kernel.source.packageroot.5=/
+
 
 # end of file

Modified: harmony/enhanced/drlvm/trunk/build/make/selector.xsl
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/selector.xsl?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/selector.xsl (original)
+++ harmony/enhanced/drlvm/trunk/build/make/selector.xsl Thu Nov 29 07:22:40 2007
@@ -33,6 +33,7 @@
     <xsl:param name="cxx" />
     <xsl:param name="hynosig" />
     <xsl:param name="hylocalzlib" />
+    <xsl:param name="refsmode" />
 
     <xsl:template match="/">
         <xsl:apply-templates />
@@ -41,7 +42,7 @@
     <!-- the  template prints the child of the select tag only if the
          select matches build configuration --> 
     <xsl:template match="select">
-        <xsl:if test="(contains(@hylocalzlib,$hylocalzlib) or not(@hylocalzlib)) and (contains(@hynosig,$hynosig)
or not(@hynosig)) and (contains(@osfamily,$osfamily) or not(@osfamily))and (contains(@os,$os)
or not(@os))and (contains(@cfg,$cfg) or not(@cfg)) and (contains(@arch,$arch) or not(@arch))
and (contains(concat(' ',@cxx), concat(' ',$cxx)) or not(@cxx))">
+        <xsl:if test="(contains(@hylocalzlib,$hylocalzlib) or not(@hylocalzlib)) and (contains(@hynosig,$hynosig)
or not(@hynosig)) and (contains(@osfamily,$osfamily) or not(@osfamily))and (contains(@os,$os)
or not(@os))and (contains(@cfg,$cfg) or not(@cfg)) and (contains(@arch,$arch) or not(@arch))
and (contains(concat(' ',@cxx), concat(' ',$cxx)) or not(@cxx)) and (contains(@refsmode,$refsmode)
or not(@refsmode))">
             <xsl:apply-templates select="*" />
         </xsl:if>
     </xsl:template>

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h Thu Nov 29 07:22:40 2007
@@ -142,17 +142,17 @@
 inline void obj_set_prefetched_next_pointer(Partial_Reveal_Object* obj, Partial_Reveal_Object*
raw_prefetched_next){
   /*Fixme: em64t: This may be not necessary!*/
   if(raw_prefetched_next == 0){
-    *((REF*)obj + 1) = 0;
+    *((POINTER_SIZE_INT*)obj + 1) = 0;
     return;
   }
   REF ref = obj_ptr_to_ref(raw_prefetched_next);
-  *((REF*)obj + 1) = ref;
+  *( (REF*)((POINTER_SIZE_INT*)obj + 1) ) = ref;
 }
 
 inline  Partial_Reveal_Object* obj_get_prefetched_next_pointer(Partial_Reveal_Object* obj){
   /*Fixme: em64t: This may be not necessary!*/
   assert(obj);  
-  return read_slot( (REF*)obj + 1);
+  return read_slot( (REF*)((POINTER_SIZE_INT*)obj + 1) );
 }
 
 inline Partial_Reveal_Object *next_marked_obj_in_block(Partial_Reveal_Object *cur_obj, Partial_Reveal_Object
*block_end)
@@ -354,6 +354,7 @@
 #endif
 
 #endif //#ifndef _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?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- 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 Thu Nov 29 07:22:40 2007
@@ -137,21 +137,19 @@
   GC_CAUSE_RUNTIME_FORCE_GC
 };
 
-/*Fixme: There is only compressed mode under em64t currently.*/
-#ifdef POINTER64
-  #define COMPRESS_REFERENCE
-#endif
 
 extern POINTER_SIZE_INT HEAP_NULL;
 
-#ifdef POINTER64
-  #ifdef COMPRESS_REFERENCE
+//#define COMPRESS_REFERENCE // Now passed from outside 
+
+#if !defined(POINTER64) && defined(COMPRESS_REFERENCE)
+#error "32-bit architecture does not support references compression"
+#endif
+
+#ifdef COMPRESS_REFERENCE
     #define REF uint32
-  #else
+#else
     #define REF Partial_Reveal_Object*
-  #endif
-#else/*ifdef POINTER64*/
-  #define REF Partial_Reveal_Object*
 #endif
 
 /////////////////////////////////////////////
@@ -161,17 +159,17 @@
 {
 #ifdef COMPRESS_REFERENCE
   if(!p_obj){
-	  /*Fixme: em64t: vm performs a simple compress/uncompress machenism
-	   i.e. just add or minus HEAP_NULL to p_obj
-	   But in gc we distinguish zero from other p_obj
-	   Now only in prefetch next live object we can hit this point. */
+          /*Fixme: em64t: vm performs a simple compress/uncompress machenism
+           i.e. just add or minus HEAP_NULL to p_obj
+           But in gc we distinguish zero from other p_obj
+           Now only in prefetch next live object we can hit this point. */
     return (REF)0;
   }
   else
     return (REF) ((POINTER_SIZE_INT) p_obj - HEAP_NULL);
 #else
 
-	return (REF)p_obj;
+        return (REF)p_obj;
 
 #endif
 
@@ -187,7 +185,7 @@
 
 #else
 
-	return (Partial_Reveal_Object *)ref;
+        return (Partial_Reveal_Object *)ref;
 
 #endif
 
@@ -227,35 +225,35 @@
 /****************************************/
 
 inline Boolean obj_is_marked_in_vt(Partial_Reveal_Object *obj) 
-{  return (Boolean)((POINTER_SIZE_INT)obj_get_vt_raw(obj) & CONST_MARK_BIT); }
+{  return (((VT_SIZE_INT)obj_get_vt_raw(obj) & CONST_MARK_BIT) != 0); }
 
 inline Boolean obj_mark_in_vt(Partial_Reveal_Object *obj) 
 {  
   VT vt = obj_get_vt_raw(obj);
-  if((POINTER_SIZE_INT)vt & CONST_MARK_BIT) return FALSE;
-  obj_set_vt(obj,  (VT)( (POINTER_SIZE_INT)vt | CONST_MARK_BIT ) );
+  if((VT_SIZE_INT)vt & CONST_MARK_BIT) return FALSE;
+  obj_set_vt(obj,  (VT)( (VT_SIZE_INT)vt | CONST_MARK_BIT ) );
   return TRUE;
 }
 
 inline void obj_unmark_in_vt(Partial_Reveal_Object *obj) 
 { 
   VT vt = obj_get_vt_raw(obj);
-  obj_set_vt(obj, (VT)((POINTER_SIZE_INT)vt & ~CONST_MARK_BIT));
+  obj_set_vt(obj, (VT)((VT_SIZE_INT)vt & ~CONST_MARK_BIT));
 }
 
 inline void obj_clear_dual_bits_in_vt(Partial_Reveal_Object* p_obj){
   VT vt = obj_get_vt_raw(p_obj);
-  obj_set_vt(p_obj,(VT)((POINTER_SIZE_INT)vt & DUAL_MARKBITS_MASK));
+  obj_set_vt(p_obj,(VT)((VT_SIZE_INT)vt & DUAL_MARKBITS_MASK));
 }
 
 inline Boolean obj_is_marked_or_fw_in_oi(Partial_Reveal_Object *obj)
-{ return get_obj_info_raw(obj) & DUAL_MARKBITS; }
+{ return ((get_obj_info_raw(obj) & DUAL_MARKBITS) != 0); }
 
 
 inline void obj_clear_dual_bits_in_oi(Partial_Reveal_Object *obj)
 {  
   Obj_Info_Type info = get_obj_info_raw(obj);
-  set_obj_info(obj, (unsigned int)info & DUAL_MARKBITS_MASK);
+  set_obj_info(obj, info & DUAL_MARKBITS_MASK);
 }
 
 /****************************************/
@@ -279,7 +277,7 @@
 
 
 inline Boolean obj_is_marked_in_oi(Partial_Reveal_Object *obj) 
-{  return ( get_obj_info_raw(obj) & CONST_MARK_BIT ); }
+{  return ((get_obj_info_raw(obj) & CONST_MARK_BIT) != 0); }
 
 FORCE_INLINE Boolean obj_mark_in_oi(Partial_Reveal_Object *obj) 
 {  
@@ -295,7 +293,6 @@
   Obj_Info_Type info = get_obj_info_raw(obj);
   info = info & ~CONST_MARK_BIT;
   set_obj_info(obj, info);
-  return;
 }
 
 /* **********************************  */
@@ -314,7 +311,7 @@
 }
 
 inline Boolean obj_is_fw_in_oi(Partial_Reveal_Object *obj) 
-{  return (get_obj_info_raw(obj) & FLIP_FORWARD_BIT); }
+{  return ((get_obj_info_raw(obj) & FLIP_FORWARD_BIT) != 0); }
 
 inline void obj_set_fw_in_oi(Partial_Reveal_Object *obj, void *dest)
 { 
@@ -353,7 +350,7 @@
 inline Boolean obj_is_marked_in_oi(Partial_Reveal_Object* p_obj)
 {
   Obj_Info_Type info = get_obj_info_raw(p_obj);
-  return (info & FLIP_MARK_BIT);
+  return ((info & FLIP_MARK_BIT) != 0);
 }
 
 #endif /* MARK_BIT_FLIPPING */
@@ -361,7 +358,7 @@
 inline Boolean obj_is_dirty_in_oi(Partial_Reveal_Object* p_obj)
 {
   Obj_Info_Type info = get_obj_info_raw(p_obj);
-  return (Boolean)(info & OBJ_DIRTY_BIT);
+  return ((info & OBJ_DIRTY_BIT) != 0);
 }
 
 inline Boolean obj_dirty_in_oi(Partial_Reveal_Object* p_obj)
@@ -370,7 +367,7 @@
   if( info & OBJ_DIRTY_BIT ) return FALSE;
   
   Obj_Info_Type new_info = info | OBJ_DIRTY_BIT;
-  while(info != atomic_cas32((volatile unsigned int *)get_obj_info_addr(p_obj),new_info,
info)){
+  while(info != atomic_casptrsz((volatile POINTER_SIZE_INT*)get_obj_info_addr(p_obj), new_info,
info)){
     info = get_obj_info_raw(p_obj);
     if( info & OBJ_DIRTY_BIT ) return FALSE;
     new_info =  info |OBJ_DIRTY_BIT;
@@ -493,11 +490,11 @@
   //#define NOS_BOUNDARY ((void*)0x2ea20000)  //this is for 512M
   #define NOS_BOUNDARY ((void*)0x40000000) //this is for 256M
 
-	#define nos_boundary NOS_BOUNDARY
+        #define nos_boundary NOS_BOUNDARY
 
 #else /* STATIC_NOS_MAPPING */
 
-	extern void* nos_boundary;
+        extern void* nos_boundary;
 
 #endif /* STATIC_NOS_MAPPING */
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h Thu Nov 29 07:22:40 2007
@@ -70,19 +70,19 @@
 
 #define OBJ_DIRTY_BIT 0x20
 
-/*emt64 related!*/
-#define COMPRESS_VTABLE
+#ifdef POINTER64 // Like in VM
+  #define COMPRESS_VTABLE
+#endif
 
-#ifdef POINTER64
-  #ifdef COMPRESS_VTABLE
+#ifdef COMPRESS_VTABLE
     #define VT uint32
-  #else
+    #define VT_SIZE_INT uint32
+#else
     #define VT Partial_Reveal_VTable*
-  #endif
-#else/*ifdef POINTER64*/
-  #define VT Partial_Reveal_VTable*
+    #define VT_SIZE_INT POINTER_SIZE_INT
 #endif
 
+
 typedef void *Thread_Handle; 
 
 #define GC_CLASS_FLAG_FINALIZER 1
@@ -95,7 +95,7 @@
 #define GCVT_ALIGNMENT 8
 #define GCVT_ALIGN_MASK (GCVT_ALIGNMENT-1)
 
-typedef uint32 Obj_Info_Type;
+typedef POINTER_SIZE_INT Obj_Info_Type;
 
 typedef struct GC_VTable_Info {
 
@@ -130,19 +130,24 @@
 
 struct Partial_Reveal_Object;
 typedef struct Partial_Reveal_VTable {
-  //--Fixme: emt64
   GC_VTable_Info *gcvt;
   Partial_Reveal_Object* jlC;
   unsigned int vtmark;           
 } Partial_Reveal_VTable;
 
 typedef struct Partial_Reveal_Object {
+  union {
   VT vt_raw;
+  POINTER_SIZE_INT padding;
+  };
   Obj_Info_Type obj_info;
 } Partial_Reveal_Object;
 
 typedef struct Partial_Reveal_Array {
+  union {
   VT vt_raw;
+  POINTER_SIZE_INT padding;
+  };
   Obj_Info_Type obj_info;
   unsigned int array_len;
 } Partial_Reveal_Array;
@@ -201,14 +206,12 @@
 FORCE_INLINE VT *obj_get_vt_addr(Partial_Reveal_Object *obj) 
 {  assert(obj && obj->vt_raw); return &obj->vt_raw; }
 
-/*Fixme: emt64*/
 FORCE_INLINE VT obj_get_vt(Partial_Reveal_Object *obj) 
-{  assert(obj && obj->vt_raw); return (VT)((POINTER_SIZE_INT)obj->vt_raw &
~CLEAR_VT_MARK); }
+{  assert(obj && obj->vt_raw); return (VT)((VT_SIZE_INT)obj->vt_raw & ~CLEAR_VT_MARK);
}
 
 FORCE_INLINE void obj_set_vt(Partial_Reveal_Object *obj, VT ah) 
 {  assert(obj && ah); obj->vt_raw = ah; }
 
-/*Fixme: emt64, we should check whether gcvt is compressed first!*/
 FORCE_INLINE GC_VTable_Info *vtable_get_gcvt_raw(Partial_Reveal_VTable* vt) 
 {  assert(vt && vt->gcvt); return vt->gcvt; }
 
@@ -219,7 +222,6 @@
 }
 
 FORCE_INLINE void vtable_set_gcvt(Partial_Reveal_VTable *vt, GC_VTable_Info *new_gcvt) 
-/*Fixme: emt64*/
 {  assert(vt && new_gcvt); vt->gcvt = new_gcvt; }
 
 FORCE_INLINE GC_VTable_Info *obj_get_gcvt_raw(Partial_Reveal_Object *obj) 
@@ -311,6 +313,7 @@
 }
 
 #endif //#ifndef _GC_TYPES_H_
+
 
 
 

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?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- 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 Thu Nov 29 07:22:40 2007
@@ -56,7 +56,11 @@
 
 static void init_gc_helpers()
 {
+#ifdef COMPRESS_REFERENCE
     set_property("vm.component.classpath.gc_gen", "gc_gen.jar", VM_PROPERTIES);
+#else
+    set_property("vm.component.classpath.gc_gen_uncomp", "gc_gen_uncomp.jar", VM_PROPERTIES);
+#endif
     vm_helper_register_magic_helper(VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE, "org/apache/harmony/drlvm/gc_gen/GCHelper",
"alloc");
     vm_helper_register_magic_helper(VM_RT_NEW_VECTOR_USING_VTABLE,  "org/apache/harmony/drlvm/gc_gen/GCHelper",
"allocArray");
     vm_helper_register_magic_helper(VM_RT_GC_HEAP_WRITE_REF,  "org/apache/harmony/drlvm/gc_gen/GCHelper",
"write_barrier_slot_rem");
@@ -81,10 +85,12 @@
 
   gc_parse_options(gc);
 
-  if(vm_vtable_pointers_are_compressed()) {
+// iberezhniuk: compile-time switching is now used in both VM and GC
+#ifdef COMPRESS_VTABLE
+  assert(vm_vtable_pointers_are_compressed());
     // ppervov: reference compression and vtable compression are orthogonal
-    vtable_base = vm_get_vtable_base();
-  }
+  vtable_base = vm_get_vtable_base();
+#endif
 
   gc_tls_init();
   
@@ -150,12 +156,14 @@
   INFO2("gc.process", "GC: end of GC wrapup\n");
 }
 
-#ifdef COMPRESS_REFERENCE
 Boolean gc_supports_compressed_references()
 {
+#ifdef COMPRESS_REFERENCE
   return TRUE;
-}
+#else
+  return FALSE;
 #endif
+}
 
 /* this interface need reconsidering. is_pinned is unused. */
 void gc_add_root_set_entry(Managed_Object_Handle *ref, Boolean is_pinned) 
@@ -317,16 +325,17 @@
    if(!obj) return 0;
    assert(address_belongs_to_gc_heap(obj, p_global_gc));
    Obj_Info_Type info = get_obj_info_raw(obj);
-   int hash = info & GCGEN_HASH_MASK;
+   int hash = (int)(info & GCGEN_HASH_MASK);
    if (!hash) {
        hash = (int)((((POINTER_SIZE_INT)obj) >> 3) & GCGEN_HASH_MASK);
        if(!hash)  hash = (0x173 & GCGEN_HASH_MASK);
-       unsigned int new_info = (unsigned int)(info | hash);
+       POINTER_SIZE_INT new_info = info | hash;
        while (true) {
-         unsigned int temp = atomic_cas32((volatile unsigned int*)(&obj->obj_info),
new_info, info);
+         Obj_Info_Type temp =
+           atomic_casptrsz((volatile POINTER_SIZE_INT*)(&obj->obj_info), new_info,
info);
          if (temp == info) break;
          info = get_obj_info_raw(obj);
-         new_info = (unsigned int)(info | hash);
+         new_info = info | hash;
        }
    }
    return hash;
@@ -342,7 +351,7 @@
   if(!p_obj) return 0;
   assert(address_belongs_to_gc_heap(p_obj, p_global_gc));
   Obj_Info_Type info = get_obj_info_raw(p_obj);
-  unsigned int new_info = 0;
+  Obj_Info_Type new_info = 0;
   int hash;
   
   switch(info & HASHCODE_MASK){
@@ -356,12 +365,13 @@
       hash = hashcode_lookup(p_obj,info);
       break;
     case HASHCODE_UNSET:
-      new_info = (unsigned int)(info | HASHCODE_SET_BIT);
+      new_info = info | HASHCODE_SET_BIT;
       while (true) {
-        unsigned int temp = atomic_cas32((volatile unsigned int*)(&p_obj->obj_info),
new_info, info);
+        Obj_Info_Type temp =
+          atomic_casptrsz((volatile POINTER_SIZE_INT*)(&p_obj->obj_info), new_info,
info);
         if (temp == info) break;
         info = get_obj_info_raw(p_obj);
-        new_info =  (unsigned int)(info | HASHCODE_SET_BIT);
+        new_info = info | HASHCODE_SET_BIT;
       }
       hash = hashcode_gen((void*)p_obj);
       break;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h Thu Nov 29 07:22:40 2007
@@ -122,14 +122,10 @@
 {  return apr_atomic_casptr(mem, with, cmp); }
 
 inline POINTER_SIZE_INT atomic_casptrsz(volatile POINTER_SIZE_INT* mem,
-                                                                                  POINTER_SIZE_INT
swap, 
-                                                                                  POINTER_SIZE_INT
cmp)
+                                        POINTER_SIZE_INT swap, 
+                                        POINTER_SIZE_INT cmp)
 {
-#ifdef POINTER64
-  return port_atomic_cas64(mem, swap, cmp);
-#else
-  return apr_atomic_cas32(mem, swap, cmp);
-#endif
+  return (POINTER_SIZE_INT)apr_atomic_casptr((volatile void **)mem, (void*)swap, (void*)cmp);
 }
 
 inline uint32 atomic_cas32(volatile apr_uint32_t *mem,

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/hashcode.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/hashcode.h?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/hashcode.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/hashcode.h Thu Nov 29 07:22:40 2007
@@ -38,30 +38,30 @@
 };
 
 inline Boolean obj_is_sethash_in_vt(Partial_Reveal_Object* p_obj){
-  return (Boolean)((POINTER_SIZE_INT)obj_get_vt_raw(p_obj) & HASHCODE_EXTENDED_VT_BIT);
+  return (((VT_SIZE_INT)obj_get_vt_raw(p_obj) & HASHCODE_EXTENDED_VT_BIT) != 0);
 }
 
 inline void obj_sethash_in_vt(Partial_Reveal_Object* p_obj){
   VT vt = obj_get_vt_raw(p_obj);
-  obj_set_vt(p_obj,(VT)((POINTER_SIZE_INT)vt | HASHCODE_EXTENDED_VT_BIT));
+  obj_set_vt(p_obj,(VT)((VT_SIZE_INT)vt | HASHCODE_EXTENDED_VT_BIT));
 }
 
 inline Boolean hashcode_is_set(Partial_Reveal_Object* p_obj)
 { 
   Obj_Info_Type obj_info = get_obj_info_raw(p_obj);
-  return obj_info & HASHCODE_SET_BIT;
+  return ((obj_info & HASHCODE_SET_BIT) != 0);
 }
 
 inline Boolean hashcode_is_attached(Partial_Reveal_Object* p_obj)
 { 
   Obj_Info_Type obj_info = get_obj_info_raw(p_obj);
-  return obj_info & HASHCODE_ATTACHED_BIT; 
+  return ((obj_info & HASHCODE_ATTACHED_BIT) != 0);
 }
 
 inline Boolean hashcode_is_buffered(Partial_Reveal_Object* p_obj)
 {
   Obj_Info_Type obj_info = get_obj_info_raw(p_obj);
-  return obj_info & HASHCODE_BUFFERED_BIT; 
+  return ((obj_info & HASHCODE_BUFFERED_BIT) != 0);
 }
 
 inline int hashcode_gen(void* addr)
@@ -294,7 +294,7 @@
                                                 Hashcode_Buf* old_buf, Hashcode_Buf* new_buf)
 {
   Obj_Info_Type obj_info = get_obj_info(p_obj);
-  POINTER_SIZE_INT hashcode;
+  POINTER_SIZE_INT hashcode = 0;
 
   switch(obj_info & HASHCODE_MASK){
     case HASHCODE_SET_UNALLOCATED:

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=599482&r1=599481&r2=599482&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 Thu Nov 29 07:22:40
2007
@@ -273,7 +273,7 @@
 
     if( obj_info != 0 ) {
       collector_remset_add_entry(collector, (Partial_Reveal_Object **)dest_addr);
-      collector_remset_add_entry(collector, (Partial_Reveal_Object **)(POINTER_SIZE_INT)obj_info);
+      collector_remset_add_entry(collector, (Partial_Reveal_Object **)obj_info);
     }
       
     obj_set_fw_in_oi(p_obj, dest_addr);
@@ -480,4 +480,5 @@
   TRACE2("gc.process", "GC: end of lspace sweep algo ...\n");
   return;
 }
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp Thu Nov
29 07:22:40 2007
@@ -116,7 +116,7 @@
 
       if( obj_info != 0 ) {
         collector_remset_add_entry(collector, (Partial_Reveal_Object **)dest_addr);
-        collector_remset_add_entry(collector, (Partial_Reveal_Object **)(POINTER_SIZE_INT)obj_info);
+        collector_remset_add_entry(collector, (Partial_Reveal_Object **)obj_info);
       }
       
       obj_set_fw_in_oi(p_obj, dest_addr);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_fallback_mark.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_fallback_mark.cpp?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_fallback_mark.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_fallback_mark.cpp Thu Nov
29 07:22:40 2007
@@ -34,7 +34,7 @@
       Obj_Info_Type oi = obj->obj_info;
       Obj_Info_Type new_oi = oi & DUAL_MARKBITS_MASK;
       while(new_oi != oi){
-        Obj_Info_Type temp = (Obj_Info_Type)atomic_cas32((volatile Obj_Info_Type*)get_obj_info_addr(obj),
new_oi, oi);
+        Obj_Info_Type temp = atomic_casptrsz((volatile Obj_Info_Type*)get_obj_info_addr(obj),
new_oi, oi);
         if(temp == oi) break;
         oi = obj->obj_info;
         new_oi = oi & DUAL_MARKBITS_MASK;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_mark.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_mark.cpp?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_mark.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/sspace_mark.cpp Thu Nov 29 07:22:40
2007
@@ -40,7 +40,7 @@
       Obj_Info_Type oi = obj->obj_info;
       Obj_Info_Type new_oi = oi & DUAL_MARKBITS_MASK;
       while(new_oi != oi){
-        Obj_Info_Type temp = (Obj_Info_Type)atomic_cas32((volatile Obj_Info_Type*)get_obj_info_addr(obj),
new_oi, oi);
+        Obj_Info_Type temp = atomic_casptrsz((volatile Obj_Info_Type*)get_obj_info_addr(obj),
new_oi, oi);
         if(temp == oi) break;
         oi = obj->obj_info;
         new_oi = oi & DUAL_MARKBITS_MASK;

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?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- 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 Thu Nov 29 07:22:40
2007
@@ -65,8 +65,8 @@
     
   /* else, take the obj by setting the forwarding flag atomically 
      we don't put a simple bit in vt because we need compute obj size later. */
-  REF target = obj_ptr_to_ref(p_targ_obj);
-  if (oi != (Obj_Info_Type)atomic_cas32((volatile unsigned int*)get_obj_info_addr(p_obj),
( ( (unsigned int)target |FORWARD_BIT)), oi)) {
+  Obj_Info_Type target_oi = (Obj_Info_Type)obj_ptr_to_ref(p_targ_obj);
+  if (oi != atomic_casptrsz((volatile POINTER_SIZE_INT*)get_obj_info_addr(p_obj), (target_oi
|FORWARD_BIT), oi)) {
     /* forwarded by other, we need unalloc the allocated obj. We may waste some space if
the allocation switched
        block. The remaining part of the switched block cannot be revivied for next allocation
of 
        object that has smaller size than this one. */

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h Thu Nov 29 07:22:40 2007
@@ -220,14 +220,17 @@
 
 typedef struct ManagedObject {
 #if defined USE_COMPRESSED_VTABLE_POINTERS
+    union {
     uint32 vt_offset;
-    uint32 obj_info;
+    POINTER_SIZE_INT padding;
+    };
+    POINTER_SIZE_INT obj_info;
     VTable *vt_unsafe() { return (VTable*)(vt_offset + vm_get_vtable_base()); }
     VTable *vt() { assert(vt_offset); return vt_unsafe(); }
     static VTable *allocation_handle_to_vtable(Allocation_Handle ah) {
         return (VTable *) ((POINTER_SIZE_INT)ah + vm_get_vtable_base());
     }
-    static unsigned header_offset() { return sizeof(uint32); }
+    static unsigned header_offset() { return sizeof(POINTER_SIZE_INT); }
     static bool are_vtable_pointers_compressed() { return true; }
 #else // USE_COMPRESSED_VTABLE_POINTERS
     VTable *vt_raw;
@@ -247,9 +250,11 @@
         return get_constant_header_size() + (_tag_pointer ? sizeof(void*) : 0); 
     }
 
-    uint32 get_obj_info() { return (uint32)obj_info; }
-    void set_obj_info(uint32 value) { obj_info = value; }
-    uint32 *get_obj_info_addr() { return (uint32 *)((char *)this + header_offset()); }
+    POINTER_SIZE_INT get_obj_info() { return obj_info; }
+    void set_obj_info(POINTER_SIZE_INT value) { obj_info = value; }
+    POINTER_SIZE_INT* get_obj_info_addr() {
+        return (POINTER_SIZE_INT*)((char*)this + header_offset());
+    }
 
     /**
      * returns address of a tag pointer field in a _non-array_ object.
@@ -319,4 +324,5 @@
 #endif
 
 #endif // _OBJECT_LAYOUT_H_
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Thu Nov 29 07:22:40 2007
@@ -120,6 +120,19 @@
     }
 } //create_instance_for_class
 
+
+#define GC_DLL_COMP   PORT_DSO_NAME("gc_gen")
+#define GC_DLL_UNCOMP PORT_DSO_NAME("gc_gen_uncomp")
+
+#if defined(REFS_USE_COMPRESSED)
+#define GC_DLL GC_DLL_COMP
+#elif defined(REFS_USE_UNCOMPRESSED)
+#define GC_DLL GC_DLL_UNCOMP
+#else // for REFS_USE_RUNTIME_SWITCH
+#define GC_DLL (vm_env->compress_references ? GC_DLL_COMP : GC_DLL_UNCOMP)
+#endif
+
+
 /**
  * Loads DLLs.
  */
@@ -154,12 +167,14 @@
 
     /*
      * Preload <GC>.dll which is specified by 'gc.dll' property.
-     *
-     * According to current design (r552465) 'gc.dll' property
-     * is always set: in configuration file (by default), or it can
-     * be reset from command line...
+     * 'gc.dll' property is set when specified in command line.
+     * When undefined, set default gc
      */
 #ifndef USE_GC_STATIC
+    if (!vm_env->VmProperties()->is_set("gc.dll")) {
+        vm_env->VmProperties()->set_new("gc.dll", GC_DLL);
+    }
+
     char* gc_dll = vm_env->VmProperties()->get("gc.dll");
 
     if (!gc_dll) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp Thu Nov 29 07:22:40
2007
@@ -65,8 +65,6 @@
     "hyarchive"
 };
 
-#define GC_DLL "gc_gen"
-
 /**
  *  Compose a string of file names each of them beginning with path,
  *  names separated by PORT_PATH_SEPARATOR.  If patch is NULL, no path
@@ -302,7 +300,6 @@
         properties.set_new("vm.jvmti.enabled", "false");
         properties.set_new("vm.jvmti.compiled_method_load.inlined", "false");
         properties.set_new("vm.bootclasspath.appendclasspath", "false");
-        properties.set_new("gc.dll", PORT_DSO_NAME(GC_DLL));
         properties.set_new("thread.soft_unreservation", "false");
 
 #ifdef REFS_USE_RUNTIME_SWITCH

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp?rev=599482&r1=599481&r2=599482&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp Thu Nov 29 07:22:40
2007
@@ -144,11 +144,11 @@
 }
 
 static uint32 vm_monitor_try_enter_default(ManagedObject *p_obj) {
-    return (uint32)hythread_thin_monitor_try_enter((hythread_thin_monitor_t *)((char *)p_obj+4));
+    return (uint32)hythread_thin_monitor_try_enter((hythread_thin_monitor_t *)p_obj->get_obj_info_addr());
 }
 
 static uint32 vm_monitor_try_exit_default(ManagedObject *p_obj) {
-    return (uint32)hythread_thin_monitor_exit((hythread_thin_monitor_t *)((char *)p_obj+4));
+    return (uint32)hythread_thin_monitor_exit((hythread_thin_monitor_t *)p_obj->get_obj_info_addr());
 }
 
 



Mime
View raw message