harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r434523 - /incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/test.java
Date Thu, 24 Aug 2006 20:59:22 GMT
Author: wjwashburn
Date: Thu Aug 24 13:59:21 2006
New Revision: 434523

URL: http://svn.apache.org/viewvc?rev=434523&view=rev
Log:
mods that demo marksweep

Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/test.java

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/test.java?rev=434523&r1=434522&r2=434523&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/test.java (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/MMTk/test.java Thu Aug 24 13:59:21 2006
@@ -20,47 +20,104 @@
  * @version $Revision$
  */
 import org.vmmagic.unboxed.*;
-import org.apache.HarmonyDRLVM.mm.mmtk.*;
+import org.apache.HarmonyDRLVM.mm.mmtk.*;  ///org.apache.HarmonyDRLVM.mm.mmtk
 import org.mmtk.vm.*;
 import org.mmtk.plan.nogc.*;
+import org.mmtk.plan.Plan;
+import org.mmtk.plan.CollectorContext;
+import org.mmtk.utility.heap.LazyMmapper;
+import org.mmtk.plan.MutatorContext;
+import org.mmtk.plan.marksweep.MS;
+import org.mmtk.utility.options.*;
+import org.mmtk.utility.Log;
+import org.mmtk.utility.heap.*;
 
-public class test {
+public class test 
+{
 	public static void main(String[] args) {
         VM vm_init = new VM();
-        NoGC nogc = new NoGC();
+        MS pl2 = (MS)SelectedPlan.get();
+        // toss -- moved to SelectedPlan org.apache.HarmonyDRLVM.mm.mmtk.ActivePlan ap =
new org.apache.HarmonyDRLVM.mm.mmtk.ActivePlan();
+        Plan pl = SelectedPlan.ap.global();
+
+        pl2.boot();
+        pl.fullyBooted();
+        org.apache.HarmonyDRLVM.mm.mmtk.SynchronizedCounter.boot();
+        LazyMmapper.boot(Address.zero(), 0 );
+        HeapGrowthManager.boot(Extent.fromInt(1024*1024*1), Extent.fromInt(1024*1024*1) );
//see Memory.java
+
+        MutatorContext mc = SelectedPlan.ap.mutator();
+        CollectorContext cc = SelectedPlan.ap.collector();
+
+        Address addr = null;
+        //Address addr = mc.alloc(64, 0, 0, 0, 0);
+        //System.out.println("addr = " + Integer.toHexString(addr.toInt() ) );
+        
+        //NoGC nogc = new NoGC();
         //NoGCMutator mc = (NoGCMutator)VM.activePlan.mutator(0);    //getNextMutator();
         //System.out.println("test NoGC, mc = " + mc);
-        NoGCMutator nm = new NoGCMutator();
+        //NoGCMutator nm = new NoGCMutator();
 
-        Address addr;
-        for (int kk = 0; kk < 10; kk++) 
+        System.out.println("top of test wjw------");
+        test0();
+        test1();
+        test2();
+        testWB();
+        //System.out.println("verbose = " + org.mmtk.utility.options.Options.verbose.getValue()
);
+
+        int [] ia = new int[10];
+        ObjectReference or = ObjectReference.fromObject(ia);
+        Address addr2 = or.toAddress();
+        int vtblPtr = addr2.loadInt();
+        Address addr3 = addr2.plus(8);
+        int length = addr3.loadInt();
+        if (length != 10) System.out.println("test.java -- bad length -------------------"
+ length);
+        
+        for (int kk = 0;  kk < 10; kk++)
         {
-            addr = nm.alloc(64, 8, 0, NoGC.ALLOC_DEFAULT, 0);
-
-            Object obj = new Object();
-            ObjectReference or = ObjectReference.fromObject(obj);
-            Address addr2 = or.toAddress();
-            int vtblPtr = addr2.loadInt();
+            addr = mc.alloc(52, 0, 0, Plan.ALLOC_DEFAULT, 0);
+            //addr = mc.alloc(1024, 0, 0, Plan.ALLOC_LOS, 0);
 
             addr.store(vtblPtr);
+            Address addrLen = addr.plus(8);
+            addrLen.store(length);
             ObjectReference or2 = addr.toObjectReference();
 
             Object obj2 = or2.toObject();
 
-            System.out.println("obj2 = " + obj2);
+            //System.out.println(obj2 + " " + obj2.hashCode() );
         }
+        Address addrElementZero = addr.plus(12);
+        addrElementZero.store(addr);  // stuff the _address_ of the array into an element
to test enumeration
+        org.apache.HarmonyDRLVM.mm.mmtk.Scanning.addressOfTestRoot = addrElementZero.toInt();
+        System.out.println("addressOfTestRoot = " + Integer.toHexString(addrElementZero.toInt()
) );
+        System.out.println("the root itself is = " + Integer.toHexString(addr.toInt()) );
+
+        or = addr.toObjectReference();
+        ia = (int []) (or.toObject() );
 
-        for (long ii = 0; ii < 0x00FFffFFffFFffFFL; ii++) // for it to run out of memory,
see if error msg is correct
+        for (int kk = 0;  kk < 1024*1024*1024; kk++)
         {
-            addr = nm.alloc(64, 8, 0, NoGC.ALLOC_DEFAULT, 0);
-            //System.out.println("test NoGC alloc --- " + Integer.toHexString(addr.toInt())
);
+            ia[3] = ia[4] = ia[5] = ia[6] = ia[7] = ia[8] = kk;
+            for (int jj = 0; jj < 800000; jj++) 
+            {
+                addr = mc.alloc(52, 0, 0, Plan.ALLOC_DEFAULT, 0);
+                addr.store(vtblPtr);
+                Address addrLen = addr.plus(8);
+                addrLen.store(length);
+                ObjectReference or2 = addr.toObjectReference();
+                Object obj2 = or2.toObject();
+            }
+            System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test loop iteration = " + kk);
+            if ( (ia[3] != kk) | (ia[4] != kk) | (ia[5] != kk) | (ia[6] != kk) | (ia[7] !=
kk) | (ia[8] != kk)  )
+                VM.assertions._assert(false);
         }
 
-        System.out.println("top of test wjw------");
-		test0();
-		test1();
-		test2();
-		testWB();
+        //for (long ii = 0; ii < 0x00FFffFFffFFffFFL; ii++) // for it to run out of memory,
see if error msg is correct
+        {
+            //addr = nm.alloc(64, 8, 0, NoGC.ALLOC_DEFAULT, 0);
+            //System.out.println("test NoGC alloc --- " + Integer.toHexString(addr.toInt())
);
+        }
 	}
 
 	static final int arrayLenOffset = 8;
@@ -127,5 +184,6 @@
 		//
 		System.out.println("testWB - seems ok");
 	}
-
+//// from DRLVM gc_header.h
+//// 
 }



Mime
View raw message