cps & contification
Stephen Weeks
MLton@sourcelight.com
Wed, 24 Jan 2001 15:38:52 -0800 (PST)
Something strange is happening with the self compile and the new contifier. It
happens even when I run with contify strategy Both. Using a stable G1 from Jan
18, I compile a G2 where the only difference is the new contify pass. This
works fine. I then attempt to compile a G3 using this G2 (which should be
equivalent, since I'm running with strategy Both). Indeed, the CPS program
produced has exactly the same number of syntax tree nodes, so I assume it's the
same. However, the size (in bytes) of the syntax tree has blown up from 57M to
138M. Here are two explanations I can think of, neither of which seem very
plausible.
* The new contify is producing a lot of data that is getting stored somewhere and
is not getting cleared by the Program.clear.
* There is a bug in MLton's globalization that is causing something huge to get
retained.
Here are the logs of the two self compiles.
Any ideas?
--------------------------------------------------------------------------------
Compiling mlton (takes a while)
time mlton -vv -no-polyvariance mlton.cm
MLton internal (built Thu Jan 18 12:30:37 2001 on starlinux.epr.com)
created this file on Wed Jan 24 14:41:55 2001.
Do not edit this file.
Flag settings:
aux: false
chunk: chunk per function
contify strategy: Both
debug: false
defines: [NODEBUG,MLton_safe=TRUE,MLton_detectOverflow=TRUE]
detect overflow: true
fixed heap: None
indentation: 3
includes: [mlton.h]
inline: NonRecursive {product = 320,small = 60}
input file: mlton.cm
instrument: false
instrument Sxml: false
keep Cps: false
match: left to right
native: true
native commented: 0
native copy prop: true
future: 64
native ieee fp: false
native live transfer: true
native move hoist: true
native optimize: 1
native split: Some (100000)
polyvariance: None
print at fun entry: false
profile: false
safe: true
show types: false
static: false
use basis library: true
verbose: true
very verbose: true
Compile SML starting
parse and elaborate starting
parse and elaborate finished in 12.010
core-ml size is 11,453,644 bytes
numPeeks = 14
average position in property list = 0.0
numPeeks = 302439
average position in bucket = 0.732
lex and parse totals 9.330
elaborate totals 2.590
dead starting
dead finished in 0.090
basis size is 804,848 bytes
numPeeks = 76015
average position in property list = 0.0
numPeeks = 302439
average position in bucket = 0.732
size = 194879
gcc -DNODEBUG -DMLton_safe=TRUE -DMLton_detectOverflow=TRUE \
-I/home/sweeks/mlton/include -o /tmp/filee7ztmo /tmp/filejSFCch.c \
-L/home/sweeks/mlton/lib -lmlton -lm -lgmp
/tmp/filee7ztmo /tmp/fileFsTzCK
infer starting
unification starting
unification finished in 3.230
finish infer starting
finish infer finished in 20.110
infer finished in 24.180
xml.unsimplified size is 38,271,076 bytes
numPeeks = 1127079
average position in property list = 0.000
numPeeks = 447250
average position in bucket = 0.895
infer simplify starting
infer simplify finished in 3.250
xml size is 21,401,104 bytes
numPeeks = 3407553
average position in property list = 0.100
numPeeks = 447250
average position in bucket = 0.895
size = 125689
num types in program = 22587
num distinct types = 38045
hash table size is 0 bytes
mono starting
mono finished in 6.870
mono.unsimplified size is 50,123,220 bytes
numPeeks = 8489624
average position in property list = 0.040
numPeeks = 1275253
average position in bucket = 1.656
mono simplify starting
mono simplify finished in 6.190
mono size is 39,598,348 bytes
numPeeks = 11984307
average position in property list = 0.079
numPeeks = 1275253
average position in bucket = 1.656
size = 214693
num types in program = 15075
num distinct types = 72349
hash table size is 0 bytes
implement exceptions starting
implement exceptions finished in 0.350
sxml.unsimplified size is 40,078,980 bytes
numPeeks = 12316790
average position in property list = 0.077
numPeeks = 1277009
average position in bucket = 1.655
implement exceptions simplify starting
implement exceptions simplify finished in 3.630
sxml size is 37,786,928 bytes
numPeeks = 15001347
average position in property list = 0.088
numPeeks = 1277009
average position in bucket = 1.655
polyvariance starting
polyvariance finished in 0.0
sxml.poly size is 37,786,928 bytes
numPeeks = 15001347
average position in property list = 0.088
numPeeks = 1277009
average position in bucket = 1.655
size = 201336
num types in program = 14654
num distinct types = 72653
hash table size is 0 bytes
closure convert starting
original size is 37,786,928 bytes
after flow analysis size is 69,220,792 bytes
free variables starting
free variables finished in 3.360
after lambda free size is 69,996,412 bytes
globalize starting
globalize finished in 0.380
after globalize size is 69,652,908 bytes
convert starting
convert finished in 32.050
closure convert finished in 48.370
cps.unsimplified size is 73,768,264 bytes
numPeeks = 21298830
average position in property list = 0.986
numPeeks = 1348725
average position in bucket = 1.608
closure convert simplify starting
num functions 14187
num local functions 157694
num primExps 176503
removeUnused starting
removeUnused finished in 1.320
num functions 12324
num local functions 92813
num primExps 157969
leaf-inline starting
inline starting
inline finished in 4.310
leaf-inline finished in 4.310
num functions 9175
num local functions 64631
num primExps 155648
raise-to-jump starting
inferHandlers starting
inferHandlers finished in 3.570
raise-to-jump finished in 8.790
num functions 9175
num local functions 64199
num primExps 155625
contify starting
contify finished in 3.480
num functions 3985
num local functions 59773
num primExps 145591
constantPropagation starting
inferHandlers starting
inferHandlers finished in 0.150
fixed point starting
fixed point finished in 3.980
constantPropagation finished in 7.910
num functions 3985
num local functions 55854
num primExps 104812
useless starting
analyze starting
analyze finished in 5.080
useless finished in 13.940
num functions 3985
num local functions 55263
num primExps 95199
removeUnused starting
removeUnused finished in 0.660
num functions 3920
num local functions 53919
num primExps 93016
simplifyTypes starting
fixed point starting
fixed point finished in 0.080
simplifyTypes finished in 3.740
num functions 3920
num local functions 44611
num primExps 89509
poly-equal starting
poly-equal finished in 0.180
num functions 3932
num local functions 45266
num primExps 90045
contify starting
contify finished in 2.590
num functions 3745
num local functions 45229
num primExps 89935
num functions 3745
num local functions 45229
num primExps 89935
inline starting
inline finished in 7.030
num functions 1013
num local functions 69848
num primExps 143347
removeUnused starting
removeUnused finished in 0.930
num functions 1012
num local functions 67391
num primExps 141911
raise-to-jump starting
inferHandlers starting
inferHandlers finished in 0.180
raise-to-jump finished in 3.920
num functions 1012
num local functions 67336
num primExps 141894
contify starting
contify finished in 3.530
num functions 1010
num local functions 67333
num primExps 141888
introduce-loops starting
introduce-loops finished in 0.050
num functions 1010
num local functions 67358
num primExps 141888
loop-invariant starting
loop-invariant finished in 3.450
num functions 1010
num local functions 64435
num primExps 133583
flatten starting
analyze starting
analyze finished in 0.160
flatten finished in 7.390
num functions 1010
num local functions 64506
num primExps 93667
redundant starting
redundant finished in 0.750
num functions 1010
num local functions 64506
num primExps 93667
removeUnused starting
removeUnused finished in 3.200
num functions 1010
num local functions 64201
num primExps 91969
closure convert simplify finished in 93.370
cps size is 56,717,884 bytes
numPeeks = 55738811
average position in property list = 0.459
numPeeks = 1643417
average position in bucket = 2.095
backend starting
compute representations starting
compute representations finished in 0.030
inferHandlers starting
inferHandlers finished in 0.150
chunkify starting
chunkify finished in 2.240
allocate registers starting
allocate registers finished in 9.310
backend finished in 13.250
size is 69,125,404 bytes
numPeeks = 65052849
average position in property list = 0.481
numPeeks = 1644427
average position in bucket = 2.094
x86 code gen starting
outputC starting
outputC finished in 0.400
outputAssembly starting
translateChunk totals 7.290
simplify totals 95.900
verifyLiveInfo totals 14.870
computeJumpInfo totals 1.380
elimGoto totals 5.030
elimIff: 8 / 8
elimSwitch: 20 / 20
elimSimpleGoto totals 2.250
elimComplexGoto totals 0.720
verifyJumpInfo totals 0.0
peepholeBlock_pre totals 3.230
commuteBinALMD: 535 / 6248
elimAddSub1: 2320 / 2320
elimMDPow2: 283 / 345
toLivenessBlock totals 13.700
moveHoist totals 23.670
peepholeLivenessBlock totals 6.100
elimALCopy: 17640 / 24436
elimFltACopy: 23 / 24
elimDeadDsts: 141 / 144
elimSelfMove: 972 / 972
elimFltSelfMove: 0 / 0
commuteBinALMD: 991 / 55189
commuteFltBinA: 17 / 55
conditionalJump: 3544 / 3544
copyPropagate totals 12.380
peepholeLivenessBlock_minor totals 4.860
elimDeadDsts_minor: 0 / 3
elimSelfMove_minor: 1 / 1
elimFltSelfMove_minor: 0 / 0
verifyLivenessBlock totals 0.0
toBlock totals 2.200
peepholeBlock_post totals 4.480
elimBinALMDDouble: 17 / 51294
elimFltBinADouble: 0 / 16
elimCMPTST: 0 / 0
generateTransfers totals 6.430
computeLiveTransferInfo totals 3.610
allocateRegisters totals 268.400
toLiveness totals 128.990
toNoLiveness totals 0.0
Assembly.allocateRegisters totals 138.380
Instruction.allocateRegisters totals 103.150
pre totals 14.560
post totals 40.140
allocateOperand totals 28.900
allocateFltOperand totals 0.0
allocateFltStackOperands totals 0.0
Directive.allocateRegisters totals 25.640
validate totals 0.0
outputAssembly finished in 385.730
x86 code gen finished in 432.560
numPeeks = 73813583
average position in property list = 0.699
numPeeks = 1724001
average position in bucket = 2.049
Compile SML finished in 665.620
Compile C starting
gcc -S -DNODEBUG -DMLton_safe=TRUE -DMLton_detectOverflow=TRUE \
-I/home/sweeks/mlton/include -o /tmp/fileDUMh1n.s /tmp/filemW3wph.c
Compile C finished in 4.890
Assemble starting
gcc -c -o /tmp/filewSXZ6P.o /tmp/fileDUMh1n.s
gcc -c -o /tmp/fileM6mMRn.o /tmp/fileGhBQMo.10.S
gcc -c -o /tmp/fileUA00Pb.o /tmp/fileV0PjCH.9.S
gcc -c -o /tmp/fileWbwVqz.o /tmp/file4hFHGy.8.S
gcc -c -o /tmp/filernqVGM.o /tmp/fileLzOe4p.7.S
gcc -c -o /tmp/filebYnaQT.o /tmp/filejJlzYz.6.S
gcc -c -o /tmp/fileEf7eg4.o /tmp/filehVjJIn.5.S
gcc -c -o /tmp/filejCqd3y.o /tmp/fileePTLeR.4.S
gcc -c -o /tmp/fileUFXADV.o /tmp/file0YQJqK.3.S
gcc -c -o /tmp/filehdGPg3.o /tmp/file6ZNskD.2.S
gcc -c -o /tmp/fileeTE75E.o /tmp/fileG1shFg.1.S
gcc -c -o /tmp/fileRZitvr.o /tmp/filehHd1oj.0.S
Assemble finished in 27.510
Link starting
gcc -o mlton /tmp/filewSXZ6P.o /tmp/fileRZitvr.o /tmp/fileeTE75E.o \
/tmp/filehdGPg3.o /tmp/fileUFXADV.o /tmp/filejCqd3y.o \
/tmp/fileEf7eg4.o /tmp/filebYnaQT.o /tmp/filernqVGM.o \
/tmp/fileWbwVqz.o /tmp/fileUA00Pb.o /tmp/fileM6mMRn.o \
-L/home/sweeks/mlton/lib -lmlton -lm -lgmp
Link finished in 0.890
max semispace size(bytes): 224,886,784
max stack size(bytes): 4,087,808
GC time(ms): 314,590 (47.3%)
maxPause(ms): 4,920
number of GCs: 175
bytes allocated: 27,409,968,024
bytes copied: 9,812,321,748
max bytes live: 151,693,688
size mlton
689.20user 10.03system 11:42.34elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (25023major+419194minor)pagefaults 897swaps
text data bss dec hex filename
3877479 644360 28248 4550087 456dc7 mlton
--------------------------------------------------------------------------------
Compiling mlton (takes a while)
time mlton -vv -no-polyvariance mlton.cm
MLton internal (built Wed Jan 24 14:53:38 2001 on starlinux.epr.com)
created this file on Wed Jan 24 14:55:28 2001.
Do not edit this file.
Flag settings:
aux: false
chunk: chunk per function
contify strategy: Both
debug: false
defines: [NODEBUG,MLton_safe=TRUE,MLton_detectOverflow=TRUE]
detect overflow: true
fixed heap: None
indentation: 3
includes: [mlton.h]
inline: NonRecursive {product = 320,small = 60}
input file: mlton.cm
instrument: false
instrument Sxml: false
keep Cps: false
match: left to right
native: true
native commented: 0
native copy prop: true
future: 64
native ieee fp: false
native live transfer: true
native move hoist: true
native optimize: 1
native split: Some (100000)
polyvariance: None
print at fun entry: false
profile: false
safe: true
show types: false
static: false
use basis library: true
verbose: true
very verbose: true
Compile SML starting
parse and elaborate starting
parse and elaborate finished in 8.350
core-ml size is 11,453,644 bytes
numPeeks = 14
average position in property list = 0.0
numPeeks = 302439
average position in bucket = 0.732
lex and parse totals 6.780
elaborate totals 1.500
dead starting
dead finished in 0.090
basis size is 804,848 bytes
numPeeks = 76015
average position in property list = 0.0
numPeeks = 302439
average position in bucket = 0.732
size = 194879
gcc -DNODEBUG -DMLton_safe=TRUE -DMLton_detectOverflow=TRUE \
-I/home/sweeks/mlton/include -o /tmp/fileqkNYLb /tmp/fileWo0V3F.c \
-L/home/sweeks/mlton/lib -lmlton -lm -lgmp
/tmp/fileqkNYLb /tmp/filewxZCyV
infer starting
unification starting
unification finished in 3.210
finish infer starting
finish infer finished in 19.970
infer finished in 24.030
xml.unsimplified size is 38,271,076 bytes
numPeeks = 1127079
average position in property list = 0.000
numPeeks = 447250
average position in bucket = 0.880
infer simplify starting
infer simplify finished in 3.230
xml size is 21,401,104 bytes
numPeeks = 3407553
average position in property list = 0.100
numPeeks = 447250
average position in bucket = 0.880
size = 125689
num types in program = 22587
num distinct types = 38045
hash table size is 0 bytes
mono starting
mono finished in 6.870
mono.unsimplified size is 50,123,348 bytes
numPeeks = 8489624
average position in property list = 0.040
numPeeks = 1275253
average position in bucket = 1.709
mono simplify starting
mono simplify finished in 6.190
mono size is 39,598,556 bytes
numPeeks = 11984307
average position in property list = 0.079
numPeeks = 1275253
average position in bucket = 1.709
size = 214693
num types in program = 15075
num distinct types = 72349
hash table size is 0 bytes
implement exceptions starting
implement exceptions finished in 0.350
sxml.unsimplified size is 40,079,188 bytes
numPeeks = 12316790
average position in property list = 0.077
numPeeks = 1277009
average position in bucket = 1.708
implement exceptions simplify starting
implement exceptions simplify finished in 3.630
sxml size is 37,787,104 bytes
numPeeks = 15001347
average position in property list = 0.088
numPeeks = 1277009
average position in bucket = 1.708
polyvariance starting
polyvariance finished in 0.0
sxml.poly size is 37,787,104 bytes
numPeeks = 15001347
average position in property list = 0.088
numPeeks = 1277009
average position in bucket = 1.708
size = 201336
num types in program = 14654
num distinct types = 72653
hash table size is 0 bytes
closure convert starting
original size is 37,787,104 bytes
after flow analysis size is 69,221,352 bytes
free variables starting
free variables finished in 3.360
after lambda free size is 69,996,972 bytes
globalize starting
globalize finished in 0.380
after globalize size is 69,653,468 bytes
convert starting
convert finished in 31.990
closure convert finished in 48.300
cps.unsimplified size is 73,768,504 bytes
numPeeks = 21298830
average position in property list = 0.986
numPeeks = 1348725
average position in bucket = 1.657
closure convert simplify starting
num functions 14187
num local functions 157694
num primExps 176503
removeUnused starting
removeUnused finished in 1.330
num functions 12324
num local functions 92813
num primExps 157969
leaf-inline starting
inline starting
inline finished in 4.300
leaf-inline finished in 4.300
num functions 9175
num local functions 64631
num primExps 155648
raise-to-jump starting
inferHandlers starting
inferHandlers finished in 3.580
raise-to-jump finished in 8.810
num functions 9175
num local functions 64199
num primExps 155625
contify starting
contify finished in 3.850
num functions 3985
num local functions 59773
num primExps 145591
constantPropagation starting
inferHandlers starting
inferHandlers finished in 0.150
fixed point starting
fixed point finished in 0.950
constantPropagation finished in 8.290
num functions 3985
num local functions 55854
num primExps 104812
useless starting
analyze starting
analyze finished in 10.010
useless finished in 20.440
num functions 3985
num local functions 55263
num primExps 95199
removeUnused starting
removeUnused finished in 0.670
num functions 3920
num local functions 53919
num primExps 93016
simplifyTypes starting
fixed point starting
fixed point finished in 0.090
simplifyTypes finished in 4.610
num functions 3920
num local functions 44611
num primExps 89509
poly-equal starting
poly-equal finished in 0.190
num functions 3932
num local functions 45266
num primExps 90045
contify starting
contify finished in 4.260
num functions 3745
num local functions 45229
num primExps 89935
inline starting
inline finished in 9.720
num functions 1013
num local functions 69848
num primExps 143347
removeUnused starting
removeUnused finished in 5.830
num functions 1012
num local functions 67391
num primExps 141911
raise-to-jump starting
inferHandlers starting
inferHandlers finished in 0.180
raise-to-jump finished in 10.450
num functions 1012
num local functions 67336
num primExps 141894
contify starting
contify finished in 10.360
num functions 1010
num local functions 67333
num primExps 141888
introduce-loops starting
introduce-loops finished in 0.040
num functions 1010
num local functions 67358
num primExps 141888
loop-invariant starting
loop-invariant finished in 10.500
num functions 1010
num local functions 64435
num primExps 133583
flatten starting
analyze starting
analyze finished in 0.150
flatten finished in 12.280
num functions 1010
num local functions 64506
num primExps 93667
redundant starting
redundant finished in 5.990
num functions 1010
num local functions 64506
num primExps 93667
removeUnused starting
removeUnused finished in 5.920
num functions 1010
num local functions 64201
num primExps 91969
closure convert simplify finished in 155.460
cps size is 138,392,184 bytes
numPeeks = 56744697
average position in property list = 0.451
numPeeks = 1643417
average position in bucket = 2.161
backend starting
compute representations starting
compute representations finished in 0.030
inferHandlers starting
inferHandlers finished in 5.100
chunkify starting
chunkify finished in 0.050
allocate registers starting
allocate registers finished in 32.780
backend finished in 52.090
size is 163,564,768 bytes
numPeeks = 66058735
average position in property list = 0.474
numPeeks = 1644427
average position in bucket = 2.160
x86 code gen starting
outputC starting
outputC finished in 5.990
outputAssembly starting
translateChunk totals 36.690
simplify totals 374.880
verifyLiveInfo totals 107.010
computeJumpInfo totals 6.230
elimGoto totals 28.630
elimIff: 8 / 8
elimSwitchTest: 0 / 0
elimSwitchCases: 20 / 20
elimSimpleGoto totals 6.000
elimComplexGoto totals 5.770
verifyJumpInfo totals 0.0
peepholeBlock_pre totals 6.700
commuteBinALMD: 535 / 6248
elimAddSub1: 2320 / 2320
elimMDPow2: 283 / 345
toLivenessBlock totals 67.990
moveHoist totals 64.860
peepholeLivenessBlock totals 17.670
elimALCopy: 17640 / 24436
elimFltACopy: 23 / 24
elimDeadDsts: 141 / 144
elimSelfMove: 972 / 972
elimFltSelfMove: 0 / 0
commuteBinALMD: 991 / 55189
commuteFltBinA: 17 / 55
conditionalJump: 3544 / 3544
copyPropagate totals 19.140
peepholeLivenessBlock_minor totals 16.650
elimDeadDsts_minor: 0 / 3
elimSelfMove_minor: 1 / 1
elimFltSelfMove_minor: 0 / 0
verifyLivenessBlock totals 0.0
toBlock totals 0.540
peepholeBlock_post totals 11.420
elimBinALMDDouble: 17 / 51294
elimFltBinADouble: 0 / 16
elimCMPTST: 0 / 0
generateTransfers totals 35.440
computeLiveTransferInfo totals 11.990
allocateRegisters totals 1045.570
toLiveness totals 605.260
toNoLiveness totals 0.0
Assembly.allocateRegisters totals 439.560
Instruction.allocateRegisters totals 339.140
pre totals 61.300
post totals 143.430
allocateOperand totals 87.910
allocateFltOperand totals 0.0
allocateFltStackOperands totals 0.0
Directive.allocateRegisters totals 76.570
validate totals 0.0
outputAssembly finished in 1508.930
x86 code gen finished in 1561.500
numPeeks = 74819469
average position in property list = 0.690
numPeeks = 1724001
average position in bucket = 2.111
Compile SML finished in 1901.130
Compile C starting
gcc -S -DNODEBUG -DMLton_safe=TRUE -DMLton_detectOverflow=TRUE \
-I/home/sweeks/mlton/include -o /tmp/filekz6I4P.s /tmp/file9jNeuY.c
Compile C finished in 4.820
Assemble starting
gcc -c -o /tmp/fileubgF22.o /tmp/filekz6I4P.s
gcc -c -o /tmp/fileVs6u4g.o /tmp/fileruUXLp.10.S
gcc -c -o /tmp/filewBlDVK.o /tmp/fileOUVSbL.9.S
gcc -c -o /tmp/filebKIqog.o /tmp/fileC9X4db.8.S
gcc -c -o /tmp/filefZHnjl.o /tmp/fileVZbMdO.7.S
gcc -c -o /tmp/fileZCkODm.o /tmp/fileYM5Y7y.6.S
gcc -c -o /tmp/filecTEvzX.o /tmp/fileyPdgrG.5.S
gcc -c -o /tmp/fileyJW5Z9.o /tmp/filejvG2dH.4.S
gcc -c -o /tmp/fileiXLqLe.o /tmp/fileaEuK9D.3.S
gcc -c -o /tmp/fileEn3JWe.o /tmp/fileD9Rx8h.2.S
gcc -c -o /tmp/filejr7A6f.o /tmp/fileYv05x6.1.S
gcc -c -o /tmp/fileLb68bI.o /tmp/fileQBy2QZ.0.S
Assemble finished in 27.520
Link starting
gcc -o mlton /tmp/fileubgF22.o /tmp/fileLb68bI.o /tmp/filejr7A6f.o \
/tmp/fileEn3JWe.o /tmp/fileiXLqLe.o /tmp/fileyJW5Z9.o \
/tmp/filecTEvzX.o /tmp/fileZCkODm.o /tmp/filefZHnjl.o \
/tmp/filebKIqog.o /tmp/filewBlDVK.o /tmp/fileVs6u4g.o \
-L/home/sweeks/mlton/lib -lmlton -lm -lgmp
size mlton
Link finished in 0.760
max semispace size(bytes): 224,886,784
max stack size(bytes): 4,083,712
GC time(ms): 1,545,580 (81.3%)
maxPause(ms): 6,550
number of GCs: 336
bytes allocated: 27,510,513,720
bytes copied: 45,861,735,108
max bytes live: 188,677,280
1923.97user 10.60system 32:17.27elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (22993major+418286minor)pagefaults 0swaps
text data bss dec hex filename
3877495 644360 28244 4550099 456dd3 mlton