[MLton-commit] r6192

Matthew Fluet fluet at mlton.org
Tue Nov 20 17:23:14 PST 2007


Regression test demonstrating bug in weak pointers and mark-compact GC; unfortunately, sensitive to physical memory on host system
----------------------------------------------------------------------

A   mlton/trunk/regression/finalize.6.ok
A   mlton/trunk/regression/finalize.6.sml

----------------------------------------------------------------------

Added: mlton/trunk/regression/finalize.6.ok
===================================================================
--- mlton/trunk/regression/finalize.6.ok	2007-11-21 00:58:55 UTC (rev 6191)
+++ mlton/trunk/regression/finalize.6.ok	2007-11-21 01:23:13 UTC (rev 6192)
@@ -0,0 +1,500 @@
+5000000
+4990000
+4980000
+4970000
+4960000
+4950000
+4940000
+4930000
+4920000
+4910000
+4900000
+4890000
+4880000
+4870000
+4860000
+4850000
+4840000
+4830000
+4820000
+4810000
+4800000
+4790000
+4780000
+4770000
+4760000
+4750000
+4740000
+4730000
+4720000
+4710000
+4700000
+4690000
+4680000
+4670000
+4660000
+4650000
+4640000
+4630000
+4620000
+4610000
+4600000
+4590000
+4580000
+4570000
+4560000
+4550000
+4540000
+4530000
+4520000
+4510000
+4500000
+4490000
+4480000
+4470000
+4460000
+4450000
+4440000
+4430000
+4420000
+4410000
+4400000
+4390000
+4380000
+4370000
+4360000
+4350000
+4340000
+4330000
+4320000
+4310000
+4300000
+4290000
+4280000
+4270000
+4260000
+4250000
+4240000
+4230000
+4220000
+4210000
+4200000
+4190000
+4180000
+4170000
+4160000
+4150000
+4140000
+4130000
+4120000
+4110000
+4100000
+4090000
+4080000
+4070000
+4060000
+4050000
+4040000
+4030000
+4020000
+4010000
+4000000
+3990000
+3980000
+3970000
+3960000
+3950000
+3940000
+3930000
+3920000
+3910000
+3900000
+3890000
+3880000
+3870000
+3860000
+3850000
+3840000
+3830000
+3820000
+3810000
+3800000
+3790000
+3780000
+3770000
+3760000
+3750000
+3740000
+3730000
+3720000
+3710000
+3700000
+3690000
+3680000
+3670000
+3660000
+3650000
+3640000
+3630000
+3620000
+3610000
+3600000
+3590000
+3580000
+3570000
+3560000
+3550000
+3540000
+3530000
+3520000
+3510000
+3500000
+3490000
+3480000
+3470000
+3460000
+3450000
+3440000
+3430000
+3420000
+3410000
+3400000
+3390000
+3380000
+3370000
+3360000
+3350000
+3340000
+3330000
+3320000
+3310000
+3300000
+3290000
+3280000
+3270000
+3260000
+3250000
+3240000
+3230000
+3220000
+3210000
+3200000
+3190000
+3180000
+3170000
+3160000
+3150000
+3140000
+3130000
+3120000
+3110000
+3100000
+3090000
+3080000
+3070000
+3060000
+3050000
+3040000
+3030000
+3020000
+3010000
+3000000
+2990000
+2980000
+2970000
+2960000
+2950000
+2940000
+2930000
+2920000
+2910000
+2900000
+2890000
+2880000
+2870000
+2860000
+2850000
+2840000
+2830000
+2820000
+2810000
+2800000
+2790000
+2780000
+2770000
+2760000
+2750000
+2740000
+2730000
+2720000
+2710000
+2700000
+2690000
+2680000
+2670000
+2660000
+2650000
+2640000
+2630000
+2620000
+2610000
+2600000
+2590000
+2580000
+2570000
+2560000
+2550000
+2540000
+2530000
+2520000
+2510000
+2500000
+2490000
+2480000
+2470000
+2460000
+2450000
+2440000
+2430000
+2420000
+2410000
+2400000
+2390000
+2380000
+2370000
+2360000
+2350000
+2340000
+2330000
+2320000
+2310000
+2300000
+2290000
+2280000
+2270000
+2260000
+2250000
+2240000
+2230000
+2220000
+2210000
+2200000
+2190000
+2180000
+2170000
+2160000
+2150000
+2140000
+2130000
+2120000
+2110000
+2100000
+2090000
+2080000
+2070000
+2060000
+2050000
+2040000
+2030000
+2020000
+2010000
+2000000
+1990000
+1980000
+1970000
+1960000
+1950000
+1940000
+1930000
+1920000
+1910000
+1900000
+1890000
+1880000
+1870000
+1860000
+1850000
+1840000
+1830000
+1820000
+1810000
+1800000
+1790000
+1780000
+1770000
+1760000
+1750000
+1740000
+1730000
+1720000
+1710000
+1700000
+1690000
+1680000
+1670000
+1660000
+1650000
+1640000
+1630000
+1620000
+1610000
+1600000
+1590000
+1580000
+1570000
+1560000
+1550000
+1540000
+1530000
+1520000
+1510000
+1500000
+1490000
+1480000
+1470000
+1460000
+1450000
+1440000
+1430000
+1420000
+1410000
+1400000
+1390000
+1380000
+1370000
+1360000
+1350000
+1340000
+1330000
+1320000
+1310000
+1300000
+1290000
+1280000
+1270000
+1260000
+1250000
+1240000
+1230000
+1220000
+1210000
+1200000
+1190000
+1180000
+1170000
+1160000
+1150000
+1140000
+1130000
+1120000
+1110000
+1100000
+1090000
+1080000
+1070000
+1060000
+1050000
+1040000
+1030000
+1020000
+1010000
+1000000
+990000
+980000
+970000
+960000
+950000
+940000
+930000
+920000
+910000
+900000
+890000
+880000
+870000
+860000
+850000
+840000
+830000
+820000
+810000
+800000
+790000
+780000
+770000
+760000
+750000
+740000
+730000
+720000
+710000
+700000
+690000
+680000
+670000
+660000
+650000
+640000
+630000
+620000
+610000
+600000
+590000
+580000
+570000
+560000
+550000
+540000
+530000
+520000
+510000
+500000
+490000
+480000
+470000
+460000
+450000
+440000
+430000
+420000
+410000
+400000
+390000
+380000
+370000
+360000
+350000
+340000
+330000
+320000
+310000
+300000
+290000
+280000
+270000
+260000
+250000
+240000
+230000
+220000
+210000
+200000
+190000
+180000
+170000
+160000
+150000
+140000
+130000
+120000
+110000
+100000
+90000
+80000
+70000
+60000
+50000
+40000
+30000
+20000
+10000

Added: mlton/trunk/regression/finalize.6.sml
===================================================================
--- mlton/trunk/regression/finalize.6.sml	2007-11-21 00:58:55 UTC (rev 6191)
+++ mlton/trunk/regression/finalize.6.sml	2007-11-21 01:23:13 UTC (rev 6192)
@@ -0,0 +1,55 @@
+structure Bug =
+struct 
+
+  structure F = MLton.Finalizable
+
+  fun new_t () =
+      let 
+        val p = 0
+        val t = F.new p
+        fun finalize x = ()
+      in
+        F.addFinalizer(t,finalize);
+        t
+      end
+
+  fun from_string (_:string) = 
+      let
+        val x = new_t ()
+      in
+        F.withValue(x,fn p => ());
+        x
+      end
+
+  val zero = from_string "0.0"
+
+  (* NOTE: I removed the F.withValue lines in an attempt to make the
+   code simpler, but the bug didn't manifest itself.  So I think these
+   lines are critical. *)
+  fun plus (x,y) = 
+      let
+        val z = new_t ()
+      in
+        F.withValue(x,fn xp => 
+          F.withValue(y,fn yp => 
+            F.withValue(z,fn zp => 
+              let in
+                z
+              end)))
+      end
+
+end
+ 
+structure B = Bug
+
+fun bigsum (n,store) =
+    if n = 0 then store else
+    let
+      val _ = if Int.mod(n,10000) = 0 then print (Int.toString n ^ "\n") else ()
+    in
+      bigsum(Int.-(n,1),B.plus(store,B.from_string(Int.toString n ^ ".0")))
+    end
+
+val bigsum = (fn n => bigsum(n,B.zero))
+
+val x = bigsum 5000000




More information about the MLton-commit mailing list