harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r439311 - /incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/
Date Fri, 01 Sep 2006 13:18:07 GMT
Author: wjwashburn
Date: Fri Sep  1 06:18:07 2006
New Revision: 439311

URL: http://svn.apache.org/viewvc?rev=439311&view=rev
Log:
mmtk GenMS mods

Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ActivePlan.java
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Memory.java
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ObjectModel.java
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Scanning.java
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedCollectorContext.java
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedMutatorContext.java
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedPlan.java

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ActivePlan.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ActivePlan.java?rev=439311&r1=439310&r2=439311&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ActivePlan.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ActivePlan.java
Fri Sep  1 06:18:07 2006
@@ -39,6 +39,7 @@
 
   /** @return The active Plan instance. */
   public final Plan global() throws InlinePragma {
+      //System.out.println("ActivePlan.global(), SelectedPlan.get() = " + SelectedPlan.get()
);
     return SelectedPlan.get();
   } 
   

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Memory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Memory.java?rev=439311&r1=439310&r2=439311&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Memory.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Memory.java
Fri Sep  1 06:18:07 2006
@@ -27,7 +27,7 @@
 public class Memory extends org.mmtk.vm.Memory
   implements Constants, Uninterruptible {
 
-    static protected int PHONY_JAVA_HEAP_SIZE = 1024 * 1024 * 350;
+    static protected int PHONY_JAVA_HEAP_SIZE = 1024 * 1024 * 450;
     static protected byte [] immortalPinnedScratchObject;  //wjw -- ugly hack, make it static
so that it is always enumerated
     static protected int dangerousPointerToStartOfScratchArea;
     static protected int dangerousPointerToEndOfScratchArea;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ObjectModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ObjectModel.java?rev=439311&r1=439310&r2=439311&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ObjectModel.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/ObjectModel.java
Fri Sep  1 06:18:07 2006
@@ -25,6 +25,7 @@
 import org.mmtk.plan.MutatorContext;
 import org.mmtk.utility.alloc.Allocator;
 import org.mmtk.plan.Plan;
+import org.mmtk.plan.CollectorContext;
 
 public final class ObjectModel extends org.mmtk.vm.ObjectModel implements Constants, Uninterruptible
{
   /**
@@ -40,28 +41,68 @@
    */
   public ObjectReference copy(ObjectReference from, int allocator)
     throws InlinePragma {
-
-/*
-wjw --- need to call native method to do something like the below to get the object size
-unsigned int
-get_object_size_bytes(Partial_Reveal_Object *p_obj)
-{
-    bool arrayp = is_array (p_obj);
-    unsigned int sz;
-    if (arrayp) {
-        sz = vm_vector_size(p_obj->vt()->get_gcvt()->gc_clss, vector_get_length((Vector_Handle)p_obj));
-        return sz; 
-    } else {
-            return p_obj->vt()->get_gcvt()->gc_allocated_size;
-    }
-}
-
- */
-
-
-      //System.out.println("wjw org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.copy was called");
-      VM.assertions._assert(false);
-      return from;  //wjw -- keep the compiler happy for now
+      int objSize = 0;     
+      Class clsObj = from.getClass();
+      boolean isArr = clsObj.isArray();
+      if (isArr) 
+      {
+          String clsName = clsObj.toString();
+          VM.assertions._assert(clsName.charAt(6) == '[');
+          int elementSize = 0;
+          if (clsName.charAt(7) == 'B') elementSize = 1;
+          if (clsName.charAt(7) == 'C') elementSize = 1;
+          if (clsName.charAt(7) == 'D') elementSize = 8;
+          if (clsName.charAt(7) == 'F') elementSize = 4;
+          if (clsName.charAt(7) == 'I') elementSize = 4;
+          if (clsName.charAt(7) == 'J') elementSize = 8;
+          if (clsName.charAt(7) == 'L') elementSize = 4;
+          if (clsName.charAt(7) == 'S') elementSize = 2;
+          if (clsName.charAt(7) == 'Z') elementSize = 1;
+          if (clsName.charAt(7) == '[') elementSize = 4;
+          VM.assertions._assert(elementSize != 0);
+          VM.assertions._assert( (clsName.charAt(7) == 'I') || (clsName.charAt(7) == 'L')
); //need to align the byte array properly
+          Address addrObj = from.toAddress();
+          int arrayLenOffset = 8;
+          Address lenAddr = addrObj.plus(arrayLenOffset);
+          int len = lenAddr.loadInt();
+          int sizeOfArrayHeader = 12;  //4 bytes for vtablePtr, 4 for lock bits, 4 for array
length
+          objSize = sizeOfArrayHeader + len * elementSize;      
+      }
+      else 
+      {
+          Address addrFrom = from.toAddress();
+          int vtblPtr = addrFrom.loadInt();
+          Address addrVPtr = Address.fromInt(vtblPtr);
+          int vPtr = addrVPtr.loadInt();
+          Address addrVPtr_0 = Address.fromInt(vPtr);
+          int slot_0 = addrVPtr_0.loadInt();
+          int slot_24 = addrVPtr_0.plus(24).loadInt();
+          //System.out.println("slot_24 = " + Integer.toHexString(slot_24) );
+          objSize = slot_24;
+      }
+      //System.out.println("ObjectModel.copy(), allocator = " + allocator);
+      //VM.assertions._assert(allocator == 0);
+      CollectorContext cc = SelectedPlan.ap.collector();
+      Address addrTo = cc.allocCopy(from, objSize,
+          0, /*int align,*/  0, /*int offset,*/ allocator) ;
+      Address addrFrom = from.toAddress();
+      //System.out.println("ObjectModel.copy(), objSize = " + objSize + " addrFrom = " +
+      //    Integer.toHexString(addrFrom.toInt()) + " addrTo = " + Integer.toHexString(addrTo.toInt())
);
+      Address addrCursor = addrTo;
+      for (int xx = 0; xx < objSize; xx++) 
+      {
+            byte bb = addrFrom.loadByte();
+            addrCursor.store(bb);
+            addrCursor = addrCursor.plus(1);
+            addrFrom = addrFrom.plus(1);
+      }
+      // mask off the GC bits (both forwarding and mark bits)
+      Address addrGCBits = addrTo.plus(4);
+      int yy = addrGCBits.loadInt();
+      // the following does not work because of "private" token -- Word ww = org.mmtk.policy.CopySpace.GC_FORWARDED;
+      yy = yy & 0xffFFffFc;  //ugly! but where is MMTk #defines for these bits?
+      addrGCBits.store(yy);
+      return addrTo.toObjectReference();
   }
 
    
@@ -250,9 +291,9 @@
    */
   public boolean attemptAvailableBits(ObjectReference object,
                                              Word oldVal, Word newVal) {
-    //System.out.print("wjw org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.attemptAvailableBits()
");
-    //System.out.println("object = " + Integer.toHexString(object.toAddress().toInt()) +
-    //    " oldVal = " + Integer.toHexString(oldVal.toInt() ) + " newVal = " + Integer.toHexString(newVal.toInt()
) );
+     //System.out.print("wjw org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.attemptAvailableBits()
");
+     //System.out.println("object = " + Integer.toHexString(object.toAddress().toInt()) +
+     //   " oldVal = " + Integer.toHexString(oldVal.toInt() ) + " newVal = " + Integer.toHexString(newVal.toInt()
) );
     
       Address addr = object.toAddress();
       addr = addr.plus(4);  // wjw -- 
@@ -271,13 +312,13 @@
    * @return the value of the bits
    */
   public Word prepareAvailableBits(ObjectReference object) {
-    //System.out.println("wjw org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.prepareAvailableBits()
was called " +
-        //Integer.toHexString(object.toAddress().toInt()) );
+    //System.out.print("org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.prepareAvailableBits(),
object = " +
+    //    Integer.toHexString(object.toAddress().toInt()) );
 
     Address addr = object.toAddress();
     addr = addr.plus(4);  // wjw -- 
     int xx = addr.loadInt();
-      //System.out.println("prepareAvailableBits() returning = " + Integer.toHexString(xx)
);
+     // System.out.println(" return val = " + Integer.toHexString(xx) );
     //VM.assertions._assert(false);
     return Word.fromInt(xx);
   }
@@ -289,8 +330,12 @@
    * @param val the new value of the bits
    */
   public void writeAvailableBitsWord(ObjectReference object, Word val) {
-    //System.out.println("wjw org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.attemptAvailableBits()
was called");
-    VM.assertions._assert(false);
+    //System.out.println("org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.attemptAvailableBits(),
object ="
+    //    + Integer.toHexString(object.toAddress().toInt()) +
+    //    " val = " + Integer.toHexString(val.toInt())   );
+    Address addrRefPtr = object.toAddress();
+    addrRefPtr = addrRefPtr.plus(4);  // wjw --
+    addrRefPtr.store(val.toInt() );
     return;
   }
 
@@ -301,9 +346,13 @@
    * @return the value of the bits
    */
   public Word readAvailableBitsWord(ObjectReference object) {
-      //System.out.println("wjw org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.readAvailableBitsWord()
was called");
-      VM.assertions._assert(false);
-      return Word.fromInt(0);
+      //System.out.println("org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.readAvailableBitsWord(),
object ="
+        //  + Integer.toHexString(object.toAddress().toInt()) );
+      Address addrRefPtr = object.toAddress();
+      addrRefPtr = addrRefPtr.plus(4);  // wjw --
+      Word wor = addrRefPtr.loadWord();
+      //System.out.println("org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.readAvailableBitsWord(),
wor =" + Integer.toHexString(wor.toInt()) );
+      return wor;
   }
 
   /**
@@ -396,7 +445,7 @@
         VM.assertions._assert(mmtArray[xx] == null);
         clsArray[xx] = clsObj;
         mmtArray[xx] = mmt;
-        System.out.println("getObjTypeCacheInsert(), inserting  " + clsObj);
+        //System.out.println("getObjTypeCacheInsert(), inserting  " + clsObj);
     }
   /**
    * Return the type object for a give object

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Scanning.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Scanning.java?rev=439311&r1=439310&r2=439311&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Scanning.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Scanning.java
Fri Sep  1 06:18:07 2006
@@ -98,8 +98,8 @@
    */
   public final void preCopyGCInstances(TraceLocal trace) 
   throws NoInlinePragma {
-        System.out.println("org.apache.HarmonyDRLVM.mm.mmtk.Scanning.preCopyGCInstances()
was called");
-        VM.assertions._assert(false);
+        //System.out.println("org.apache.HarmonyDRLVM.mm.mmtk.Scanning.preCopyGCInstances()
was called");
+        //VM.assertions._assert(false);
   }
   
  

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedCollectorContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedCollectorContext.java?rev=439311&r1=439310&r2=439311&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedCollectorContext.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedCollectorContext.java
Fri Sep  1 06:18:07 2006
@@ -18,15 +18,20 @@
 
 import org.mmtk.plan.nogc.*;
 import org.mmtk.plan.marksweep.*;
+import org.mmtk.plan.semispace.*;
 import org.vmmagic.pragma.*;
 import org.mmtk.plan.CollectorContext;
+import org.mmtk.plan.copyms.CopyMSCollector;
+import org.mmtk.plan.generational.marksweep.GenMSCollector;
 
-public final class SelectedCollectorContext implements 
+public final class SelectedCollectorContext extends GenMSCollector implements 
   Uninterruptible {
 
   //public static final CollectorContext singleton = new NoGCCollector();
-  public static final CollectorContext singleton = new  MSCollector();
-  
+  //public static final CollectorContext singleton = new  MSCollector();
+  //public static final CollectorContext singleton = new SSCollector();
+    public static final CollectorContext singleton = new SelectedCollectorContext();
+
   /**
    * Return the instance of the SelectedPlan
    */

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedMutatorContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedMutatorContext.java?rev=439311&r1=439310&r2=439311&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedMutatorContext.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedMutatorContext.java
Fri Sep  1 06:18:07 2006
@@ -18,15 +18,21 @@
 
 import org.mmtk.plan.nogc.*;
 import org.mmtk.plan.marksweep.*;
+import org.mmtk.plan.semispace.*;
 import org.vmmagic.pragma.*;
 import org.mmtk.plan.MutatorContext;
+import org.mmtk.plan.copyms.CopyMSMutator;
+import org.mmtk.plan.generational.marksweep.GenMSMutator;
 
 public final class SelectedMutatorContext 
   implements Uninterruptible {
 
   //public static final MutatorContext singleton = new NoGCMutator();
-  public static final MutatorContext singleton = new MSMutator();
-  
+  //public static final MutatorContext singleton = new MSMutator();
+  //public static final MutatorContext singleton = new SSMutator();
+  //public static final MutatorContext singleton = new CopyMSMutator();
+  public static final MutatorContext singleton = new GenMSMutator();
+
   /**
    * Return the instance of the SelectedPlan
    */

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedPlan.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedPlan.java?rev=439311&r1=439310&r2=439311&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedPlan.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/SelectedPlan.java
Fri Sep  1 06:18:07 2006
@@ -16,19 +16,35 @@
 
 package org.apache.HarmonyDRLVM.mm.mmtk;
 
+import org.mmtk.plan.marksweep.MS;
 import org.mmtk.plan.nogc.*;
-import org.mmtk.plan.marksweep.*;
+import org.mmtk.plan.semispace.SS;
 import org.vmmagic.pragma.*;
 import org.mmtk.plan.Plan;
+import org.mmtk.plan.copyms.*;
+import org.mmtk.plan.generational.marksweep.GenMS;
+
 
 public final class SelectedPlan implements Uninterruptible 
 {
     //public static final Plan singleton = new NoGC();
-    public static final MS singleton = new MS();
+    //public static final MS singleton = new MS();
+    //private static MS singleton;  // work around a DRLVM bug
+    //private static SS singleton;
+    //private static CopyMS singleton;
+    private static GenMS singleton;
+
     public static org.apache.HarmonyDRLVM.mm.mmtk.ActivePlan ap = new org.apache.HarmonyDRLVM.mm.mmtk.ActivePlan();
 
     public static final Plan get() throws InlinePragma 
     {
+        if (SelectedPlan.singleton == null) 
+        {
+            //SelectedPlan.singleton = new MS();
+            //SelectedPlan.singleton = new SS();
+            //SelectedPlan.singleton = new CopyMS();
+            SelectedPlan.singleton = new GenMS();
+        }
         return singleton;
     }
 }



Mime
View raw message