M2toM3

M2toM3

A simple Modula-2 to Modula-3 translator by Peter Klein <pk@i3.informatik.rwth-aachen.de> which covers most of the syntactic differences between those languages. No context sensitive analysis is done, so WITH statements, local modules, enumeration type literals and variant RECORDs have to be dealt with by hand. Part of the Sun Modula 2 library is emulated by the Modula 3 library.

Version 1.01.

ftp://martha.informatik.rwth-aachen.de/pub/Modula3.
References in periodicals archive ?
Due to a compiler bug in Gcc, we were unable to perform the standard optimizations on m2tom3, which explains its unusually large number of other loads.
1994] postcard Graphical mail reader m2tom3 Converts Modula-2 Code to Modula-3 m3cg M3 v.
Static Alias Pairs as a Percent of All Possible Pairs Intraprocedural Interprocedural Program T-TBAA TF-TBAA TFM-TBAA T-TBAA TF-TBAA TFM-TBAA format 31 27 27 11 8 8 dformat 24 16 16 19 11 11 write- 24 13 13 11 4 4 pickle k-tree 29 17 17 15 10 10 slisp 45 33 33 23 16 16 dom 39 25 25 9 7 7 postcard 39 15 15 6 1 1 m2tom3 41 23 23 3 1 1 m3cg 32 5 5 5 1 1 trestle 23 11 11 8 3 3 The table shows that TBAA based on field declarations (TF-TBAA) is much more precise than the basic TBAA (T-TBAA), and that selective type merging offers little added precision.
Number of Redundant Loads Removed Statically Programs Loads T-TBAA (%) TF-TBAA (%) TFM-TBAA (%) format 193 14.0 15.0 15.0 dformat 321 3.1 6.9 6.9 write-pickle 385 11.9 12.2 12.2 k-tree 1018 21.7 22.4 22.4 slisp 1066 3.4 3.5 3.5 dom 3773 8.7 11.2 11.2 postcard 4631 5.6 7.1 7.1 m2tom3 6444 5.7 6.1 6.1 m3cg 6765 7.7 9.1 9.1 trestle 12737 4.1 4.6 4.6 By comparing Table VI and Table VII, we see that the reduction in alias pairs caused by considering field declarations in TBAA translates into more optimization opportunities: TF-TBAA finds more redundant loads than T-TBAA.
Percent of original running time A B C Format 98 97 97 Dformat 99 99 99 Write-Pickle 98 98 98 K-Tree 98 98 98 Slisp 92 92 92 M2toM3 96 97 97 M3CG 95 94 94 A = T-TBAA B = TF-TBAA C = TFM-TBAA Note: Table made from a bar graph.
Percent of original heap references Redundant Redundant after originally RLE and TFM-TBAA format 8 5 dformat 5 1 write-pickle 14 5 ktree 34 21 slisp 56 16 m2tom3 32 4 m3cg 22 3 Note: Table made from a bar graph.
Percentage of total invocations (A, B) format (26, 0) dformat (65, 0) write-pickle (9, 1) slisp (94, 0) dom (128, 6) k-tree (2, 5) postcard (88, 32) m2tom3 (494, 16) m3cg (155, 56) trestle (8, 12) A = Resolved B = Unresolved Note: Table made from a bar graph.
Percent of original running time Base+Inlining Minv Minv+RLE Minv+RLE+Inlining Format 97% 96% 95% 92% Dformat 95% 89% 88% 78% Write-Pickle 91% 94% 94% 73% K-Tree 83% 99% 97% 79% Slisp 93% 99% 91% 102% M2toM3 99% 91% 89% 89% M3CG 81% 100% 96% 78% This graph shows that our optimizations together have a significant impact on the speed of our benchmark programs.
Analysis Time in Seconds for Interprocedural Type Propagation and TFM-TBAA Time in seconds Program Our optimizations TBAA Build format 0.2 0.06 17.1 dformat 0.5 0.09 15.4 write-pickle 0.3 0.12 20.0 k-tree 1.1 0.26 23.7 slisp 3.1 0.93 24.0 dom 8.9 1.29 94.4 postcard 10.2 1.80 65.2 m2tom3 32.7 1.44 273.4 m3cg 58.4 6.29 321.9 trestle 43.2 8.10 420.5 In our experiments, we found that TFM-TBAA and TF-TBAA enabled the same optimizations.
Simulated execution time using open- and closed-world assumptions Percent of original running time RLE RLE Open Format 97 97 Dformat 99 99 Write-Pickle 98 98 K-Tree 98 98 M2toM3 97 97 Slisp 92 92 M3CG 94 94 Note: Table made from a bar graph.