Add vim modelines to most tools.

tools/add_cont_lines:
tools/appears:
tools/assemble:
tools/avg_frame_size:
tools/build_srcdist:
tools/cleanint:
tools/compare_frame_sizes:
tools/configure_mingw_cross:
tools/cont:
tools/ctor_rep_stats:
tools/cur_param:
tools/dd_speedtest:
tools/divide:
tools/extract_dd_stats:
tools/file_name_translation_stats:
tools/frame_sizes:
tools/gdbrun:
tools/half:
tools/info_stats.awk:
tools/linear:
tools/lmc.in:
tools/mai_stats:
tools/make_arena:
tools/next_param:
tools/not:
tools/optstages:
tools/type_ctor_stats:
    Add vim mode lines. Replace tabs with spaces.
This commit is contained in:
Zoltan Somogyi
2021-04-27 03:54:27 +10:00
parent 22864a6d52
commit 47a1a02a92
28 changed files with 641 additions and 614 deletions

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
# This script add a backslash to the end of every line in its input.
# The input can come either from a list of files named on the command line
# or from standard input.
@@ -6,10 +7,10 @@
# This script assumes that there are no tabs in the input.
awk '
{
printf "%s", $0;
for (i = length($0); i < 78; i++)
printf " ";
{
printf "%s", $0;
for (i = length($0); i < 78; i++)
printf " ";
printf "\\\n";
}' "$@"
printf "\\\n";
}' "$@"

View File

@@ -1,20 +1,21 @@
#!/bin/sh
# See if the first argument appears among the following arguments.
# If yes, return true (0), otherwise, return false (1).
# vim: ft=sh ts=4 sw=4 et
# See whether the first argument appears among the following arguments.
# If yes, return true (0); otherwise, return false (1).
if test $# -lt 1
then
echo "Usage: appears word word1 ..."
exit 2
echo "Usage: appears word word1 ..."
exit 2
fi
word=$1
shift
for arg in "$@"
do
if test "$word" = "$arg"
then
exit 0
fi
if test "$word" = "$arg"
then
exit 0
fi
done
exit 1

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
# Assemble a C source file from its component parts.
# The parts are stage2.{$base,$trial}/$testeddir/$module.c.part.{1,2,...$count}.
# Assemble uses the parts from stage2.$trial for the parts whose numbers are
@@ -7,8 +8,8 @@
if test $# -le 5
then
echo "Usage: assemble base trial testeddir module count testedparts ..."
exit 1
echo "Usage: assemble base trial testeddir module count testedparts ..."
exit 1
fi
base="$1"
@@ -23,12 +24,13 @@ cat /dev/null > stage2/$testeddir/$module.c
i=0
while test $i -le $cnt
do
if appears $i $tested
then
which="$trial"
else
which="$base"
fi
cat stage2.$which/$testeddir/$module.c.part.$i >> stage2/$testeddir/$module.c
i=`expr $i + 1`
if appears $i $tested
then
which="$trial"
else
which="$base"
fi
cat stage2.$which/$testeddir/$module.c.part.$i \
>> stage2/$testeddir/$module.c
i=`expr $i + 1`
done

View File

@@ -1,22 +1,23 @@
#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
#
# Given a file generated by frame_sizes as its input, which has one line per
# procedure and gives the stack frame size of that procedure, this script
# computes and prints the average frame size.
{
if (NF != 5) {
printf "error: NF != 5\n"
printf "%s\n", $0;
next;
}
{
if (NF != 5) {
printf "error: NF != 5\n"
printf "%s\n", $0;
next;
}
proc = $3 " " $4 " " $5;
framesize = $2;
proc = $3 " " $4 " " $5;
framesize = $2;
frames += 1;
sizes += framesize;
}
END {
printf "number of procedures with frames: %d\n", frames;
printf "average number of words per frame: %5.2f\n", sizes / frames;
}
frames += 1;
sizes += framesize;
}
END {
printf "number of procedures with frames: %d\n", frames;
printf "average number of words per frame: %5.2f\n", sizes / frames;
}

View File

@@ -1,4 +1,5 @@
#!/bin/bash
# vim: ft=sh ts=4 sw=4 et
# Copyright (C) 2013-2015 The Mercury team.
#
# This script builds the Mercury source distribution.

View File

@@ -1,5 +1,5 @@
#!/bin/sh
#
# vim: ft=sh ts=4 sw=4 et
# Check whether there are any Mercury-compiler generated files in this
# directory that do not belong to Mercury modules in this directory.
# Report their names.
@@ -11,42 +11,42 @@
prefix=
while getopts p: flag
do
case $flag in
p) prefix="$OPTARG/"
;;
*) echo "usage: cleanint [-p prefix]"
exit 1
;;
esac
case $flag in
p) prefix="$OPTARG/"
;;
*) echo "usage: cleanint [-p prefix]"
exit 1
;;
esac
done
shift `expr $OPTIND - 1`
if test $# -gt 0
then
echo "usage: cleanint [-p prefix]"
exit 1
echo "usage: cleanint [-p prefix]"
exit 1
fi
for suffix in d dep int int2 int3 date date3 opt optdate trans_opt trans_opt_date err
do
for file in *.$suffix
do
# If there are no files with a given suffix,
# then avoid the ill-formed call to basename.
for file in *.$suffix
do
# If there are no files with a given suffix,
# then avoid the ill-formed call to basename.
if test -f "$file"
then
base=`basename $file .$suffix`
if test ! -f "$base.m"
then
basebase=`echo $base | sed -e 's/.*\.//'`
if test ! -f "$basebase.m"
then
echo $prefix$file
fi
fi
fi
done
if test -f "$file"
then
base=`basename $file .$suffix`
if test ! -f "$base.m"
then
basebase=`echo $base | sed -e 's/.*\.//'`
if test ! -f "$basebase.m"
then
echo $prefix$file
fi
fi
fi
done
done
exit 0

View File

@@ -1,4 +1,5 @@
#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
#
# This script compares two files generated by the frame_sizes script, which
# each contain information about stack frame sizes in a version of the Mercury
@@ -8,79 +9,79 @@
#
# Usage: compare_frame_sizes SP.batch.version1 SP.batch.version2
{
if (NF != 5) {
printf "error: NF != 5\n"
printf "%s\n", $0;
next;
}
{
if (NF != 5) {
printf "error: NF != 5\n"
printf "%s\n", $0;
next;
}
batch = $1 "";
batch = $1 "";
# We expect to encounter two values of batch. The first becomes
# the value of base; the second becomes the value of new.
# We expect to encounter two values of batch. The first becomes
# the value of base; the second becomes the value of new.
if (batch != base && batch != new) {
if (base == "") {
base = batch;
} else if (new == "") {
new = batch;
} else {
printf "error: unknown batch %s (%s %s)\n", batch, base, new;
exit 1;
}
}
if (batch != base && batch != new) {
if (base == "") {
base = batch;
} else if (new == "") {
new = batch;
} else {
printf "error: unknown batch %s (%s %s)\n", batch, base, new;
exit 1;
}
}
proc = $3 " " $4 " " $5;
framesize = $2;
proc = $3 " " $4 " " $5;
framesize = $2;
repcount = count[batch "@" proc];
count[batch "@" proc] = repcount + 1;
repcount = count[batch "@" proc];
count[batch "@" proc] = repcount + 1;
if (repcount > 0) {
repcount++;
proc = proc "#" repcount;
}
if (repcount > 0) {
repcount++;
proc = proc "#" repcount;
}
procs[proc] = 1;
procs[proc] = 1;
sizes[batch "@" proc] = framesize;
exist[batch "@" proc] = 1;
}
END {
basetotal = 0;
newtotal = 0;
proccount = 0;
basebetter = 0;
newbetter = 0;
sizes[batch "@" proc] = framesize;
exist[batch "@" proc] = 1;
}
END {
basetotal = 0;
newtotal = 0;
proccount = 0;
basebetter = 0;
newbetter = 0;
for (proc in procs) {
if (exist[base "@" proc] == 1 && exist[new "@" proc] == 1) {
basesize = sizes[base "@" proc];
newsize = sizes[new "@" proc];
basetotal += basesize;
newtotal += newsize;
proccount += 1;
for (proc in procs) {
if (exist[base "@" proc] == 1 && exist[new "@" proc] == 1) {
basesize = sizes[base "@" proc];
newsize = sizes[new "@" proc];
basetotal += basesize;
newtotal += newsize;
proccount += 1;
if (basesize < newsize) {
basebetter += 1;
worsened = worsened proc " " basesize "->" newsize "\n"
} else if (basesize > newsize) {
newbetter += 1;
improved = improved proc " " basesize "->" newsize "\n"
}
} else {
printf "error: mismatch for %s\n", proc;
}
}
if (basesize < newsize) {
basebetter += 1;
worsened = worsened proc " " basesize "->" newsize "\n"
} else if (basesize > newsize) {
newbetter += 1;
improved = improved proc " " basesize "->" newsize "\n"
}
} else {
printf "error: mismatch for %s\n", proc;
}
}
printf "base slots: %5d, %5.2f, %6.2f\n", basetotal, basetotal / proccount, 100;
printf "new slots: %5d, %5.2f, %6.2f\n", newtotal, newtotal / proccount, 100 * newtotal / basetotal;
printf "number of procedures: %d\n", proccount;
printf "base better: %d, %5.2f\n", basebetter, 100 * basebetter / proccount;
printf "new better: %d, %5.2f\n", newbetter, 100 * newbetter / proccount;
printf "\n";
printf "improved:\n%s", improved;
printf "\n";
printf "worsened:\n%s", worsened;
}
printf "base slots: %5d, %5.2f, %6.2f\n", basetotal, basetotal / proccount, 100;
printf "new slots: %5d, %5.2f, %6.2f\n", newtotal, newtotal / proccount, 100 * newtotal / basetotal;
printf "number of procedures: %d\n", proccount;
printf "base better: %d, %5.2f\n", basebetter, 100 * basebetter / proccount;
printf "new better: %d, %5.2f\n", newbetter, 100 * newbetter / proccount;
printf "\n";
printf "improved:\n%s", improved;
printf "\n";
printf "worsened:\n%s", worsened;
}

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#---------------------------------------------------------------------------#
# Copyright (C) 2012 The University of Melbourne.
# Copyright (C) 2014, 2018 The Mercury team.

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
# This script add a backslash to the end of every line in its input except
# the last. The input can come either from a list of files named on the
# command line or from standard input.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
{
rep[$2] = 1;
all += $3;

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#
# The scripts cur_param and next_param allow their callers to cycle through
# circular lists of parameters. Both scripts take two parameters, a directory
@@ -18,8 +19,8 @@ usage="cur_param dir counter"
if test $# != 2
then
echo $usage
exit 1
echo $usage
exit 1
fi
dir=$1
@@ -27,22 +28,22 @@ counter=$2
if test ! -f $dir/next.$counter
then
echo 1 > $dir/next.$counter
echo 1 > $dir/next.$counter
fi
if test -s $dir/list.$counter
then
cur=`cat $dir/next.$counter`
if awk "NR == $cur" $dir/list.$counter
then
true
else
echo "$dir/list.$counter isn't long enough"
exit 1
fi
cur=`cat $dir/next.$counter`
if awk "NR == $cur" $dir/list.$counter
then
true
else
echo "$dir/list.$counter isn't long enough"
exit 1
fi
else
echo "$dir/list.$counter doesn't exist or is empty"
exit 1
echo "$dir/list.$counter doesn't exist or is empty"
exit 1
fi
exit 0

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#---------------------------------------------------------------------------#
# Copyright (C) 2005 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
@@ -39,19 +40,19 @@ limit=6
ddopts="-s divide_and_query -n 50000 -d 1"
while getopts c:n:d: flag; do
case $flag in
c) cmd="$OPTARG" ;;
d) ddopts="$OPTARG" ;;
n) limit="$OPTARG" ;;
\?) echo $usage; exit 1 ;;
*) echo internal error in getopts; exit 2 ;;
esac
case $flag in
c) cmd="$OPTARG" ;;
d) ddopts="$OPTARG" ;;
n) limit="$OPTARG" ;;
\?) echo $usage; exit 1 ;;
*) echo internal error in getopts; exit 2 ;;
esac
done
shift `expr "$OPTIND" - 1`
if test "$cmd" == ""; then
echo $usage
exit 1
echo $usage
exit 1
fi
total_runs=`expr $limit + 2`
@@ -61,19 +62,19 @@ echo START $ddopts >> dd.stats
count=1
while test $count -le $total_runs
do
if test $count == 1; then
run_name="FIRST"
else
if test $count == $total_runs; then
run_name="FINAL"
else
during_cnt=`expr $count - 1`
run_name="DURING$during_cnt"
fi
fi
if test $count == 1; then
run_name="FIRST"
else
if test $count == $total_runs; then
run_name="FINAL"
else
during_cnt=`expr $count - 1`
run_name="DURING$during_cnt"
fi
fi
echo $run_name >> dd.stats
echo STARTWCTIME = `date +"%s"` >> dd.stats
echo $run_name >> dd.stats
echo STARTWCTIME = `date +"%s"` >> dd.stats
mdb $cmd << END1 2>> dd.stats >> dd.stdout
table_io start
@@ -82,8 +83,8 @@ dd $ddopts --test
quit -y
END1
echo ENDWCTIME = `date +"%s"` >> dd.stats
count=`expr $count + 1`
echo ENDWCTIME = `date +"%s"` >> dd.stats
count=`expr $count + 1`
done
echo END >> dd.stats

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ts=4 sw=4 et ft=sh
# Given the name of a C source file generated by the Mercury compiler,
# and a count of the number of the number of modules in it (say N),
# generate N+1 files named $filename.part.{0,1,...N}.
@@ -12,8 +13,8 @@
if test $# != 2
then
echo "Usage: divide filename module_count"
exit 1
echo "Usage: divide filename module_count"
exit 1
fi
TERMCAP=/etc/termcap; export TERMCAP
@@ -22,15 +23,15 @@ cp $1 tmp
i=0
while test $i -lt $2
do
ed - tmp > /dev/null << END
/^MR_END_MODULE/
1,.w $1.part.$i
1,.d
w
q
ed - tmp > /dev/null << END
/^MR_END_MODULE/
1,.w $1.part.$i
1,.d
w
q
END
echo done part $i
i=`expr $i + 1`
echo done part $i
i=`expr $i + 1`
done
mv tmp $1.part.$i
echo done final part $i

View File

@@ -1,16 +1,17 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#
# The objective of this script is to transform a shorthand description
# of an Mmake.params file into the Mmake.params itself. The shorthand
# description is given to this script as its arguments.
#
# The shorthand consists of pairs of word:
#
# grade <full grade name> meaning that grade
# args {s,c} meaning simple or compact
# typeinfo {1,2,s,d} meaning one-cell, one-or-two-cell,
# shared-one-or-two-cell, or default
# opt <integer> meaning that optimization level
# grade <full grade name> meaning that grade
# args {s,c} meaning simple or compact
# typeinfo {1,2,s,d} meaning one-cell, one-or-two-cell,
# shared-one-or-two-cell, or default
# opt <integer> meaning that optimization level
#
# Other arguments are also allowed; these are expected to be other arguments
# to mmc.
@@ -22,65 +23,65 @@ MCFLAGS=""
CFLAGS=""
while [ $# -gt 0 ]; do
case "$1" in
case "$1" in
grade)
GRADE="$2"
shift
shift
;;
grade)
GRADE="$2"
shift
shift
;;
args)
if test "$2" = s
then
MCFLAGS="$MCFLAGS --args simple"
elif test "$2" = c
then
MCFLAGS="$MCFLAGS --args compact"
CFLAGS="$CFLAGS -DCOMPACT_ARGS"
else
echo $usage ; exit 1
fi
shift
shift
;;
args)
if test "$2" = s
then
MCFLAGS="$MCFLAGS --args simple"
elif test "$2" = c
then
MCFLAGS="$MCFLAGS --args compact"
CFLAGS="$CFLAGS -DCOMPACT_ARGS"
else
echo $usage ; exit 1
fi
shift
shift
;;
typeinfo)
if test "$2" = 1
then
MCFLAGS="$MCFLAGS --type-info one-cell"
CFLAGS="$CFLAGS -DONE_CELL_TYPEINFO"
elif test "$2" = 2
then
MCFLAGS="$MCFLAGS --type-info one-or-two-cell"
CFLAGS="$CFLAGS -DONE_OR_TWO_CELL_TYPEINFO"
elif test "$2" = s
then
MCFLAGS="$MCFLAGS --type-info shared-one-or-two-cell"
CFLAGS="$CFLAGS -DSHARED_ONE_OR_TWO_CELL_TYPEINFO"
elif test "$2" = d
then
MCFLAGS="$MCFLAGS --type-info default"
CFLAGS="$CFLAGS -DDEFAULT_TYPEINFO"
else
echo $usage ; exit 1
fi
shift
shift
;;
typeinfo)
if test "$2" = 1
then
MCFLAGS="$MCFLAGS --type-info one-cell"
CFLAGS="$CFLAGS -DONE_CELL_TYPEINFO"
elif test "$2" = 2
then
MCFLAGS="$MCFLAGS --type-info one-or-two-cell"
CFLAGS="$CFLAGS -DONE_OR_TWO_CELL_TYPEINFO"
elif test "$2" = s
then
MCFLAGS="$MCFLAGS --type-info shared-one-or-two-cell"
CFLAGS="$CFLAGS -DSHARED_ONE_OR_TWO_CELL_TYPEINFO"
elif test "$2" = d
then
MCFLAGS="$MCFLAGS --type-info default"
CFLAGS="$CFLAGS -DDEFAULT_TYPEINFO"
else
echo $usage ; exit 1
fi
shift
shift
;;
opt)
MCFLAGS="$MCFLAGS -O$2"
shift
shift
;;
opt)
MCFLAGS="$MCFLAGS -O$2"
shift
shift
;;
*)
MCFLAGS="$MCFLAGS $1"
shift
;;
*)
MCFLAGS="$MCFLAGS $1"
shift
;;
esac
esac
done
echo "MC = ../scripts/mmc"

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#---------------------------------------------------------------------------#
# Copyright (C) 2005 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
@@ -25,105 +26,105 @@
awk '
BEGIN {
FS = " = "
printf("%6s %11s %10s %7s %7s %7s %7s\n", \
"reexec", "nodes", "ratio", "CPU", \
"WC", "RSS", "VSZ");
FS = " = "
printf("%6s %11s %10s %7s %7s %7s %7s\n", \
"reexec", "nodes", "ratio", "CPU", \
"WC", "RSS", "VSZ");
}
/^START / {
reset_per_run();
num_runs = 0;
total_time = 0;
total_wc_time = 0;
last_time = 0;
reset_per_run();
num_runs = 0;
total_time = 0;
total_wc_time = 0;
last_time = 0;
start = 1;
final = 0;
during = 0;
start = 1;
final = 0;
during = 0;
match($0, /START (.*)$/, a);
dd_opts = a[1];
printf("Options = %s\n", dd_opts);
match($0, /START (.*)$/, a);
dd_opts = a[1];
printf("Options = %s\n", dd_opts);
}
/^DURING/ {
reset_per_run();
num_runs++;
if (start != 1) {
total_time += last_time;
}
reset_per_run();
num_runs++;
if (start != 1) {
total_time += last_time;
}
start = 0;
final = 0;
during = 1;
start = 0;
final = 0;
during = 1;
last_time = 0;
last_time = 0;
}
/^FINAL/ {
reset_per_run();
total_time += last_time;
reset_per_run();
total_time += last_time;
start = 0;
final = 1;
during = 0;
start = 0;
final = 1;
during = 0;
}
/^END$/ {
# discard the first and last re-execution.
reexec -= 2;
total_nodes = actual_nodes_for_run - nodes_in_first_reexecution \
- last_nodes_constructed_in_run;
# discard the first and last re-execution.
reexec -= 2;
total_nodes = actual_nodes_for_run - nodes_in_first_reexecution \
- last_nodes_constructed_in_run;
if (out_of_memory == 1){
mem = "Out of Memory";
out_of_memory = 0;
} else {
mem = sprintf("%.1f", rss/1024);
}
printf("%6i %11i %10d %7.1f %7.1f %7s %7.1f\n", \
reexec, \
total_nodes, total_nodes/reexec, \
total_time/num_runs, total_wc_time/num_runs, \
mem, vsz/1024);
if (out_of_memory == 1){
mem = "Out of Memory";
out_of_memory = 0;
} else {
mem = sprintf("%.1f", rss/1024);
}
printf("%6i %11i %10d %7.1f %7.1f %7s %7.1f\n", \
reexec, \
total_nodes, total_nodes/reexec, \
total_time/num_runs, total_wc_time/num_runs, \
mem, vsz/1024);
}
/Total CPU time/ {last_time = $2}
/Nodes constructed in this run/ {
if (start_of_run) {
nodes_in_first_reexecution = $2;
start_of_run = 0;
}
actual_nodes_for_run += $2
last_nodes_constructed_in_run = $2;
if (start_of_run) {
nodes_in_first_reexecution = $2;
start_of_run = 0;
}
actual_nodes_for_run += $2
last_nodes_constructed_in_run = $2;
}
/Total reexecutions so far/ {
reexec = $2
reexec = $2
}
/RSS =/ {
rss = $2
rss = $2
}
/VSZ =/ {
vsz = $2
vsz = $2
}
/Out of Memory/ {
out_of_memory = 1;
out_of_memory = 1;
}
/^STARTWCTIME/ {
start_wc_time = $2;
start_wc_time = $2;
}
/^ENDWCTIME/ {
if (during == 1) {
total_wc_time += ($2 - start_wc_time);
}
if (during == 1) {
total_wc_time += ($2 - start_wc_time);
}
}
function reset_per_run() {
actual_nodes_for_run = 0;
nodes_in_first_reexecution = 0;
start_of_run = 1;
last_nodes_constructed_in_run = 0;
actual_nodes_for_run = 0;
nodes_in_first_reexecution = 0;
start_of_run = 1;
last_nodes_constructed_in_run = 0;
}
' "$@"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
$1 == "overall_stats" {
num_invocations += 1;
overall_count += $2;

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#
# This script extracts information about the sizes of stack frames of
# procedures in various versions of the Mercury compiler (compiled with
@@ -18,22 +19,22 @@
if test $# -lt 1
then
echo "Usage: frame_sizes batchname ..."
exit 1
echo "Usage: frame_sizes batchname ..."
exit 1
fi
for prefix in $@
do
n=1
n2=`two_digit $n`
while test -d $prefix.library.$n2
do
echo "creating SP.$prefix.$n2 and AVG.$prefix.$n2"
gunzip $prefix.library.$n2/*.c.gz $prefix.compiler.$n2/*.c.gz > /dev/null 2>&1
( echo VERSION_NUMBER $n2 ; cat $prefix.library.$n2/*.c $prefix.compiler.$n2/*.c ) | extract_incr_sp > SP.$prefix.$n2
gzip $prefix.library.$n2/*.c $prefix.compiler.$n2/*.c > /dev/null 2>&1
avg_frame_size SP.$prefix.$n2 > AVG.$prefix.$n2
n=`expr $n + 1`
n2=`two_digit $n`
done
n=1
n2=`two_digit $n`
while test -d $prefix.library.$n2
do
echo "creating SP.$prefix.$n2 and AVG.$prefix.$n2"
gunzip $prefix.library.$n2/*.c.gz $prefix.compiler.$n2/*.c.gz > /dev/null 2>&1
( echo VERSION_NUMBER $n2 ; cat $prefix.library.$n2/*.c $prefix.compiler.$n2/*.c ) | extract_incr_sp > SP.$prefix.$n2
gzip $prefix.library.$n2/*.c $prefix.compiler.$n2/*.c > /dev/null 2>&1
avg_frame_size SP.$prefix.$n2 > AVG.$prefix.$n2
n=`expr $n + 1`
n2=`two_digit $n`
done
done

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#---------------------------------------------------------------------------#
# Copyright (C) 2001 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
@@ -8,6 +9,7 @@
# Usage: gdbrun <program> <arguments>
# Invokes gdb on <program>, and runs the program with the given <arguments>.
#
program="$1"
tmpfile=/tmp/gdbrun.$$
trap "rm -f $tmpfile" 0 1 2 3 13 15
@@ -16,17 +18,15 @@ shift
runargs=""
for arg in "$@"
do
# This quotes spaces properly, which is necessary to handle some of
# the arguments created by lmc. We do not quote other special
# characters (e.g. #, >, and \) properly. At the moment there is
# no need to do so, since lmc does not pass us strings containing
# such characters (in the usual case that the workspace name has no
# such characters).
case "$arg" in
*" "*) runargs="$runargs \"$arg\"" ;;
*) runargs="$runargs $arg" ;;
esac
# This quotes spaces properly, which is necessary to handle some of
# the arguments created by lmc. We do not quote other special characters
# (e.g. #, >, and \) properly. At the moment there is no need to do so,
# since lmc does not pass us strings containing such characters
# (in the usual case that the workspace name has no such characters).
case "$arg" in
*" "*) runargs="$runargs \"$arg\"" ;;
*) runargs="$runargs $arg" ;;
esac
done
echo "set args $runargs" > "$tmpfile"

View File

@@ -1,17 +1,18 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
# Given N arguments, print the first N/2 arguments, rounding down.
if test -x /usr/ucb/echo
then
ECHO=/usr/ucb/echo
ECHO=/usr/ucb/echo
else
ECHO=echo
ECHO=echo
fi
take=`expr $# / 2`
while test $take -gt 0
do
$ECHO -n "$1 "
shift
take=`expr $take - 1`
$ECHO -n "$1 "
shift
take=`expr $take - 1`
done

View File

@@ -1,4 +1,5 @@
#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
BEGIN {
NUM_FIELDS = 100;
for (i = 0; i < NUM_FIELDS ; i++)

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
# This script finds miscompiled procedures.
#
# Given a stage2 directory that works (stage2.ok) and one that doesn't
@@ -17,30 +18,30 @@
usage="\
Usage: $0 [options]
Options:
-b-, --no-bootcheck
Do not perform a bootcheck; check only the tests directory.
-c, --compile-only
Compile only. Do not compare stage2.ok and stage3.
-d <dirname>, --dir <dirname>
Confine the search to one directory, library or compiler.
(Usually useful only after a previous search.)
-f <filename>, --file <filename>
Confine the search to the named file(s).
(Usually useful only after a previous search.)
-h, --help
Display this usage message.
-j <num-jobs>, --jobs <num-jobs>
Run using <num-jobs> different parallel processes.
-m <mmake-args>, --mmake-args <mmake-args>
Pass <mmake-args> as options to \`mmake'.
-n, --negative-search
Look for the module that suppresses the bug, not causes it.
-o <filename>, --output-file <filename>
Output results to <filename>.
-r, --copy-runtime
Copy the runtime directory instead of linking it.
-t <testdir>, --test-dir <testdir>
Execute runtests from the named subdirectory of tests.
-b-, --no-bootcheck
Do not perform a bootcheck; check only the tests directory.
-c, --compile-only
Compile only. Do not compare stage2.ok and stage3.
-d <dirname>, --dir <dirname>
Confine the search to one directory, library or compiler.
(Usually useful only after a previous search.)
-f <filename>, --file <filename>
Confine the search to the named file(s).
(Usually useful only after a previous search.)
-h, --help
Display this usage message.
-j <num-jobs>, --jobs <num-jobs>
Run using <num-jobs> different parallel processes.
-m <mmake-args>, --mmake-args <mmake-args>
Pass <mmake-args> as options to \`mmake'.
-n, --negative-search
Look for the module that suppresses the bug, not causes it.
-o <filename>, --output-file <filename>
Output results to <filename>.
-r, --copy-runtime
Copy the runtime directory instead of linking it.
-t <testdir>, --test-dir <testdir>
Execute runtests from the named subdirectory of tests.
"
# If you change this, you will also need to change the files indicated
@@ -59,83 +60,83 @@ alldirs="library compiler"
allmodules=""
while [ $# -gt 0 ]; do
case "$1" in
case "$1" in
-b-|--no-bootcheck)
bootcheck="-b-" ;;
-b-|--no-bootcheck)
bootcheck="-b-" ;;
-c|--compile-only)
compile_only="-c" ;;
-c|--compile-only)
compile_only="-c" ;;
-d|--dir)
alldirs="$2"; shift ;;
-d*)
alldirs="` expr $1 : '-d\(.*\)' `"; ;;
-d|--dir)
alldirs="$2"; shift ;;
-d*)
alldirs="` expr $1 : '-d\(.*\)' `"; ;;
-f|--file)
allmodules="$2"; shift ;;
-f*)
allmodules="` expr $1 : '-f\(.*\)' `"; ;;
-f|--file)
allmodules="$2"; shift ;;
-f*)
allmodules="` expr $1 : '-f\(.*\)' `"; ;;
-h|--help)
echo "$usage"
exit 0 ;;
-h|--help)
echo "$usage"
exit 0 ;;
-j|--jobs)
jfactor="-j$2"; shift ;;
-j*)
jfactor="-j` expr $1 : '-j\(.*\)' `" ;;
--jobs*)
jfactor="--jobs ` expr $1 : '--jobs\(.*\)' `" ;;
-j|--jobs)
jfactor="-j$2"; shift ;;
-j*)
jfactor="-j` expr $1 : '-j\(.*\)' `" ;;
--jobs*)
jfactor="--jobs ` expr $1 : '--jobs\(.*\)' `" ;;
-m|--mmake)
mmake_opts="$mmake_opts $2"; shift ;;
-m|--mmake)
mmake_opts="$mmake_opts $2"; shift ;;
-n|--negative-search)
negative=true ;;
-n|--negative-search)
negative=true ;;
-o|--output-file)
outfile="-o $2"; shift ;;
-o*)
outfile="-o ` expr $1 : '-o\(.*\)' `"; ;;
-o|--output-file)
outfile="-o $2"; shift ;;
-o*)
outfile="-o ` expr $1 : '-o\(.*\)' `"; ;;
-r|--copy-runtime)
copy_runtime=true ;;
-r|--copy-runtime)
copy_runtime=true ;;
-t|--test-dir)
testdirs="$testdirs -t$2"; shift ;;
-t*)
testdirs="$testdirs ` expr $1 : '-t\(.*\)' `" ;;
-t|--test-dir)
testdirs="$testdirs -t$2"; shift ;;
-t*)
testdirs="$testdirs ` expr $1 : '-t\(.*\)' `" ;;
-*)
echo "$0: unknown option \`$1'" 1>&2
echo "$usage" 1>&2
exit 1 ;;
-*)
echo "$0: unknown option \`$1'" 1>&2
echo "$usage" 1>&2
exit 1 ;;
*)
echo "$usage" 1>&2
exit 1 ;;
esac
shift
*)
echo "$usage" 1>&2
exit 1 ;;
esac
shift
done
if test "$negative" = true
then
base=bad
trial=ok
expected=failure
base=bad
trial=ok
expected=failure
else
base=ok
trial=bad
expected=success
base=ok
trial=bad
expected=success
fi
if test -d stage2.ok -a -d stage2.bad
then
echo "stage2.ok and stage2.bad both present"
echo "stage2.ok and stage2.bad both present"
else
echo "at least one of stage2.ok and stage2.bad is missing"
exit 1
echo "at least one of stage2.ok and stage2.bad is missing"
exit 1
fi
echo "starting at `date`"
@@ -161,17 +162,17 @@ cp $root/library/Mmake* .
cd $root/stage2
if test "$copy_runtime" = "true"
then
mkdir runtime
cd runtime
ln -s $root/runtime/*.h .
ln -s $root/runtime/*.c .
ln -s $root/runtime/*.mod .
ln -s $root/runtime/*.in .
ln -s $root/runtime/machdeps .
cp $root/runtime/Mmake* .
cd $root/stage2
mkdir runtime
cd runtime
ln -s $root/runtime/*.h .
ln -s $root/runtime/*.c .
ln -s $root/runtime/*.mod .
ln -s $root/runtime/*.in .
ln -s $root/runtime/machdeps .
cp $root/runtime/Mmake* .
cd $root/stage2
else
ln -s $root/runtime .
ln -s $root/runtime .
fi
ln -s $root/boehm_gc .
ln -s $root/browser .
@@ -205,13 +206,13 @@ cp stage2.$base/compiler/*.[co] stage2/compiler
if test "$copy_runtime" = "true"
then
if (cd stage2 ; mmake $mmake_opts $jfactor runtime)
then
echo "building of stage 2 runtime successful"
else
echo "building of stage 2 runtime not successful"
exit 1
fi
if (cd stage2 ; mmake $mmake_opts $jfactor runtime)
then
echo "building of stage 2 runtime successful"
else
echo "building of stage 2 runtime not successful"
exit 1
fi
fi
set -x
@@ -222,95 +223,95 @@ unusualparts=
for testeddir in $alldirs
do
# find the set of modules to search, if not given on command line
if test "$allmodules" = ""
then
cd stage2/$testeddir
allmodules=`sub X.c X *.c`
cd $root
fi
# find the set of modules to search, if not given on command line
if test "$allmodules" = ""
then
cd stage2/$testeddir
allmodules=`sub X.c X *.c`
cd $root
fi
for testedmodule in $allmodules
do
# at this point, all the files in stage2
# should be from stage2.$base
for testedmodule in $allmodules
do
# at this point, all the files in stage2
# should be from stage2.$base
echo "testing module: $testedmodule"
echo "testing module: $testedmodule"
cp stage2.$trial/$testeddir/$testedmodule.[co] stage2/$testeddir
cp stage2.$trial/$testeddir/$testedmodule.[co] stage2/$testeddir
if binary_step $bootcheck $compile_only $jfactor -m "$mmake_opts" $outfile $testdirs
then
echo "test succeeded"
lasttest=success
else
echo "test failed"
lasttest=failure
fi
if binary_step $bootcheck $compile_only $jfactor -m "$mmake_opts" $outfile $testdirs
then
echo "test succeeded"
lasttest=success
else
echo "test failed"
lasttest=failure
fi
if test "$lasttest" = "$expected"
then
normal="$normal $testeddir/$testedmodule"
else
unusual="$unusual $testeddir/$testedmodule"
if test "$lasttest" = "$expected"
then
normal="$normal $testeddir/$testedmodule"
else
unusual="$unusual $testeddir/$testedmodule"
basecnt=`egrep '^MR_END_MODULE' stage2.$base/$testeddir/$testedmodule.c | wc -l`
trialcnt=`egrep '^MR_END_MODULE' stage2.$trial/$testeddir/$testedmodule.c | wc -l`
basecnt=`egrep '^MR_END_MODULE' stage2.$base/$testeddir/$testedmodule.c | wc -l`
trialcnt=`egrep '^MR_END_MODULE' stage2.$trial/$testeddir/$testedmodule.c | wc -l`
if test $basecnt -ne $trialcnt
then
basecnt=`echo $basecnt | tr -d ' '`
trialcnt=`echo $trialcnt | tr -d ' '`
if test $basecnt -ne $trialcnt
then
basecnt=`echo $basecnt | tr -d ' '`
trialcnt=`echo $trialcnt | tr -d ' '`
echo "the two versions of the unusual module"
echo "differ in the number of C modules they have"
echo "$base version: $basecnt vs $trial version: $trialcnt"
exit 1
fi
echo "the two versions of the unusual module"
echo "differ in the number of C modules they have"
echo "$base version: $basecnt vs $trial version: $trialcnt"
exit 1
fi
for dir in $base $trial
do
cd stage2.$dir/$testeddir
divide $testedmodule.c $basecnt
cd $root
done
for dir in $base $trial
do
cd stage2.$dir/$testeddir
divide $testedmodule.c $basecnt
cd $root
done
allparts=
i=0
while test $i -le $basecnt
do
allparts="$allparts $i"
i=`expr $i + 1`
done
allparts=
i=0
while test $i -le $basecnt
do
allparts="$allparts $i"
i=`expr $i + 1`
done
for testedpart in $allparts
do
echo testing part $testedpart in `/bin/pwd`
assemble $base $trial $testeddir $testedmodule $basecnt $testedpart
for testedpart in $allparts
do
echo testing part $testedpart in `/bin/pwd`
assemble $base $trial $testeddir $testedmodule $basecnt $testedpart
cd stage2/$testeddir
/bin/rm $testedmodule.o
mmake $testedmodule.o
cd $root
cd stage2/$testeddir
/bin/rm $testedmodule.o
mmake $testedmodule.o
cd $root
if binary_step $bootcheck $compile_only $jfactor -m "$mmake_opts" $outfile $testdirs
then
echo "test succeeded"
lasttest=success
else
echo "test failed"
lasttest=failure
fi
if binary_step $bootcheck $compile_only $jfactor -m "$mmake_opts" $outfile $testdirs
then
echo "test succeeded"
lasttest=success
else
echo "test failed"
lasttest=failure
fi
if test "$lasttest" != "$expected"
then
unusualparts="$unusualparts $testeddir/$testedmodule.part.$testedpart"
fi
done
fi
if test "$lasttest" != "$expected"
then
unusualparts="$unusualparts $testeddir/$testedmodule.part.$testedpart"
fi
done
fi
cp stage2.$base/$testeddir/$testedmodule.[co] stage2/$testeddir
done
cp stage2.$base/$testeddir/$testedmodule.[co] stage2/$testeddir
done
done
echo "modules whose stage.$trial versions behave as expected:"

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#---------------------------------------------------------------------------#
# Copyright (C) 2001,2003,2007 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
@@ -48,8 +49,8 @@
#
# If you want to track down some low level bug, you can ask this script to
# execute the Mercury compiler under gdb by setting the environment variable
# MMC_UNDER_GDB to the string "true".
#
# MMC_UNDER_GDB to the string "true".
#
# You can ask this script to run the Mercury compiler under valgrind by
# setting MMC_UNDER_VALGRIND to "true". Valgrind options can be placed in
# the environment variable MMC_VALGRIND_OPTIONS.
@@ -62,118 +63,118 @@
if test ! -d $WORKSPACE
then
echo "workspace $WORKSPACE does not exist"
echo "workspace $WORKSPACE does not exist"
fi
if test "$MERCURY_COMPILER_OVERRIDE" != ""
then
MERCURY_COMPILER=$MERCURY_COMPILER_OVERRIDE
MERCURY_COMPILER=$MERCURY_COMPILER_OVERRIDE
else
MERCURY_COMPILER=$WORKSPACE/compiler/mercury_compile
MERCURY_COMPILER=$WORKSPACE/compiler/mercury_compile
fi
export MERCURY_COMPILER
if test "$MMC_USE_SHARED_LIBS" != ""
then
O="$MMC_USE_SHARED_LIBS"
O="$MMC_USE_SHARED_LIBS"
else
O="a"
O="a"
fi
if test -s $WORKSPACE/boehm_gc/libgc.$O
then
gclib="$WORKSPACE/boehm_gc/libgc.$O"
gclib="$WORKSPACE/boehm_gc/libgc.$O"
elif test -s $WORKSPACE/boehm_gc/libpar_gc.$O
then
gclib="$WORKSPACE/boehm_gc/libpar_gc.$O"
gclib="$WORKSPACE/boehm_gc/libpar_gc.$O"
elif test -s $WORKSPACE/boehm_gc/libgc_prof.$O
then
gclib="$WORKSPACE/boehm_gc/libgc_prof.$O"
gclib="$WORKSPACE/boehm_gc/libgc_prof.$O"
elif test -s $WORKSPACE/boehm_gc/libgc_ll_debug.$O
then
gclib="$WORKSPACE/boehm_gc/libgc_ll_debug.$O"
gclib="$WORKSPACE/boehm_gc/libgc_ll_debug.$O"
elif test -s $WORKSPACE/boehm_gc/libpar_gc_ll_debug.$O
then
gclib="$WORKSPACE/boehm_gc/libpar_gc_ll_debug.$O"
gclib="$WORKSPACE/boehm_gc/libpar_gc_ll_debug.$O"
else
echo "$WORKSPACE/boehm_gc does not have a gc library"
echo "$WORKSPACE/boehm_gc does not have a gc library"
fi
LIB_FLAGS="\
--link-object $WORKSPACE/trace/libmer_trace.$O \
--link-object $WORKSPACE/trace/libmer_eventspec.$O \
--link-object $WORKSPACE/ssdb/libmer_ssdb.$O \
--link-object $WORKSPACE/browser/libmer_browser.$O \
--link-object $WORKSPACE/mdbcomp/libmer_mdbcomp.$O \
--link-object $WORKSPACE/library/libmer_std.$O \
--link-object $WORKSPACE/runtime/libmer_rt.$O \
--link-object $gclib \
-lm @TRACE_BASE_LIBS_SYSTEM@ @READLINE_LIBRARIES@"
--link-object $WORKSPACE/trace/libmer_trace.$O \
--link-object $WORKSPACE/trace/libmer_eventspec.$O \
--link-object $WORKSPACE/ssdb/libmer_ssdb.$O \
--link-object $WORKSPACE/browser/libmer_browser.$O \
--link-object $WORKSPACE/mdbcomp/libmer_mdbcomp.$O \
--link-object $WORKSPACE/library/libmer_std.$O \
--link-object $WORKSPACE/runtime/libmer_rt.$O \
--link-object $gclib \
-lm @TRACE_BASE_LIBS_SYSTEM@ @READLINE_LIBRARIES@"
# ssdb.init is not included here because it breaks deep profiling programs
# built with lmc.
INIT_FLAGS="\
--trace-init-file $WORKSPACE/browser/mer_browser.init \
--trace-init-file $WORKSPACE/mdbcomp/mer_mdbcomp.init \
--init-file $WORKSPACE/library/mer_std.init \
--init-file $WORKSPACE/runtime/mer_rt.init"
--trace-init-file $WORKSPACE/browser/mer_browser.init \
--trace-init-file $WORKSPACE/mdbcomp/mer_mdbcomp.init \
--init-file $WORKSPACE/library/mer_std.init \
--init-file $WORKSPACE/runtime/mer_rt.init"
LINK_FLAGS=""
if test "$MMC_CDEBUG" != ""
then
CDEBUG_FLAGS="--target-debug --cflags -O0"
CDEBUG_FLAGS="--target-debug --cflags -O0"
else
CDEBUG_FLAGS=""
CDEBUG_FLAGS=""
fi
if test "$MMC_LOWLEVEL_DEBUG" != ""
then
CDEBUG_FLAGS="$CDEBUG_FLAGS --cflags -DMR_LOWLEVEL_DEBUG"
CDEBUG_FLAGS="$CDEBUG_FLAGS --cflags -DMR_LOWLEVEL_DEBUG"
fi
if test "$MMC_TABLE_DEBUG" != ""
then
CDEBUG_FLAGS="$CDEBUG_FLAGS --cflags -DMR_TABLE_DEBUG"
CDEBUG_FLAGS="$CDEBUG_FLAGS --cflags -DMR_TABLE_DEBUG"
fi
if test "$MMC_GPROF" != ""
then
CDEBUG_FLAGS="$CDEBUG_FLAGS --target-debug --cflags -pg --cflags --no-omit-frame-pointer"
LINK_FLAGS="--ld-flags -pg"
CDEBUG_FLAGS="$CDEBUG_FLAGS --target-debug --cflags -pg --cflags --no-omit-frame-pointer"
LINK_FLAGS="--ld-flags -pg"
fi
if test "$MMC_ADDED_CFLAGS" != ""
then
CDEBUG_FLAGS="$CDEBUG_FLAGS --cflags \"$MMC_ADDED_CFLAGS\""
CDEBUG_FLAGS="$CDEBUG_FLAGS --cflags \"$MMC_ADDED_CFLAGS\""
fi
C_FLAGS="--c-include-directory $WORKSPACE/trace \
--c-include-directory $WORKSPACE/library \
--c-include-directory $WORKSPACE/library/Mercury/mihs \
--c-include-directory $WORKSPACE/ssdb \
--c-include-directory $WORKSPACE/ssdb/Mercury/mihs \
--c-include-directory $WORKSPACE/runtime \
--c-include-directory $WORKSPACE/boehm_gc \
--c-include-directory $WORKSPACE/boehm_gc/include"
--c-include-directory $WORKSPACE/library \
--c-include-directory $WORKSPACE/library/Mercury/mihs \
--c-include-directory $WORKSPACE/ssdb \
--c-include-directory $WORKSPACE/ssdb/Mercury/mihs \
--c-include-directory $WORKSPACE/runtime \
--c-include-directory $WORKSPACE/boehm_gc \
--c-include-directory $WORKSPACE/boehm_gc/include"
if test "$MMC_UNDER_GDB" != ""
then
MERCURY_COMPILER="$WORKSPACE/tools/gdbrun $MERCURY_COMPILER"
export MERCURY_COMPILER
MERCURY_COMPILER="$WORKSPACE/tools/gdbrun $MERCURY_COMPILER"
export MERCURY_COMPILER
fi
if test "$MMC_UNDER_VALGRIND" != ""
then
MERCURY_COMPILER="valgrind $MMC_VALGRIND_OPTIONS $MERCURY_COMPILER"
export MERCURY_COMPILER
MERCURY_COMPILER="valgrind $MMC_VALGRIND_OPTIONS $MERCURY_COMPILER"
export MERCURY_COMPILER
fi
PATH="$WORKSPACE/scripts:$WORKSPACE/util:$PATH"
export PATH
exec mmc --no-mercury-stdlib-dir \
--config-file $WORKSPACE/scripts/Mercury.config \
-I $WORKSPACE/library \
-I $WORKSPACE/mdbcomp \
-I $WORKSPACE/ssdb \
$CDEBUG_FLAGS $C_FLAGS $INIT_FLAGS $LIB_FLAGS $LINK_FLAGS "$@"
--config-file $WORKSPACE/scripts/Mercury.config \
-I $WORKSPACE/library \
-I $WORKSPACE/mdbcomp \
-I $WORKSPACE/ssdb \
$CDEBUG_FLAGS $C_FLAGS $INIT_FLAGS $LIB_FLAGS $LINK_FLAGS "$@"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
BEGIN {
for (i = 2; i <= 28; i++) {
init[i] = "not accessed";

View File

@@ -1,17 +1,18 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#
# Create and populate an arena directory for use in speed tests.
if test ! -d boehm_gc
then
echo "make_arena should be executed at the top level of a workspace"
exit 1
echo "make_arena should be executed at the top level of a workspace"
exit 1
fi
if test -d arena
then
echo "make_arena: arena directory already exists"
exit 1
echo "make_arena: arena directory already exists"
exit 1
fi
mkdir arena
@@ -22,8 +23,8 @@ cp compiler/*.m arena
# Copy the interface files and possibly optimization files they will need.
for dir in library mdbcomp compiler
do
cp $dir/*.int* arena
cp $dir/*.*opt arena > /dev/null 2>&1
cp $dir/*.int* arena
cp $dir/*.*opt arena > /dev/null 2>&1
done
# Copy all the auxiliary files.

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
#
# The scripts cur_param and next_param allow their callers to cycle through
# circular lists of parameters. Both scripts take two parameters, a directory
@@ -18,8 +19,8 @@ usage="next_param dir counter"
if test $# != 2
then
echo $usage
exit 1
echo $usage
exit 1
fi
dir=$1
@@ -27,22 +28,22 @@ counter=$2
if test ! -f $dir/next.$counter
then
echo 0 > $dir/next.$counter
echo 0 > $dir/next.$counter
fi
if test -s $dir/list.$counter
then
prev=`cat $dir/next.$counter`
next=`expr $prev + 1`
length=`wc -l $dir/list.$counter`
if test "$next" -gt "$length"
then
next=1
fi
echo "$next" > $dir/next.$counter
prev=`cat $dir/next.$counter`
next=`expr $prev + 1`
length=`wc -l $dir/list.$counter`
if test "$next" -gt "$length"
then
next=1
fi
echo "$next" > $dir/next.$counter
else
echo "$dir/list.$counter doesn't exist or is empty"
exit 1
echo "$dir/list.$counter doesn't exist or is empty"
exit 1
fi
exit 0

View File

@@ -1,8 +1,9 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
if "$@"
then
exit 1
exit 1
else
exit 0
exit 0
fi

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: ft=sh ts=4 sw=4 et
# Given the name of a file containing output generated by mmc --debug-opt,
# e.g. Out, generate a series of files Out.stage.N, each containing the
# output of one stage of the optimization process.
@@ -8,8 +9,8 @@
if test $# != 1
then
echo "Usage: optstages filename"
exit 1
echo "Usage: optstages filename"
exit 1
fi
TERMCAP=/etc/termcap; export TERMCAP
@@ -32,16 +33,16 @@ echo "created $1.stage.0"
i=1
while test `egrep '^after' .tmp | wc -l` -gt 1
do
ed - .tmp > /dev/null << END
/^after/
/^% Optimizing/
1,-w $1.stage.$i
1,-d
w
q
ed - .tmp > /dev/null << END
/^after/
/^% Optimizing/
1,-w $1.stage.$i
1,-d
w
q
END
echo "created $1.stage.$i"
i=`expr $i + 1`
echo "created $1.stage.$i"
i=`expr $i + 1`
done
mv .tmp $1.stage.$i

View File

@@ -1,40 +1,41 @@
#!/usr/bin/awk -f
NF == 3 {
rep[$2] = 1;
all_rep += $3;
pred_rep[$1] += $3;
kind_rep[$1 "-" $2] += $3;
}
NF == 5 {
qualified = $2 ":" $3;
type[qualified] = 1;
ctor_rep[qualified] = $4;
all_name += $5;
pred_name[$1] += $5;
kind_name[$1 "-" qualified] += $5;
}
END {
if (all_rep == all_name) {
printf "total %15.0f\n\n", all_rep;
} else {
printf "total %15.0f rep, %15.0f name\n\n", all_rep, all_name;
}
# vim: ft=awk ts=4 sw=4 et
NF == 3 {
rep[$2] = 1;
all_rep += $3;
pred_rep[$1] += $3;
kind_rep[$1 "-" $2] += $3;
}
NF == 5 {
qualified = $2 ":" $3;
type[qualified] = 1;
ctor_rep[qualified] = $4;
all_name += $5;
pred_name[$1] += $5;
kind_name[$1 "-" qualified] += $5;
}
END {
if (all_rep == all_name) {
printf "total %15.0f\n\n", all_rep;
} else {
printf "total %15.0f rep, %15.0f name\n\n", all_rep, all_name;
}
for (p in pred_rep) {
for (r in rep) {
printf "%-9s %-20s %15.0f (%7.2f%%, %5.2f%%)\n", p, r, kind_rep[p "-" r], (100 * kind_rep[p "-" r]) / pred_rep[p], (100 * kind_rep[p "-" r]) / all_rep;
}
for (p in pred_rep) {
for (r in rep) {
printf "%-9s %-20s %15.0f (%7.2f%%, %5.2f%%)\n", p, r, kind_rep[p "-" r], (100 * kind_rep[p "-" r]) / pred_rep[p], (100 * kind_rep[p "-" r]) / all_rep;
}
printf "%-30s %15.0f (%9s %5.2f%%)\n\n", p ":", pred_rep[p], "", (100 * pred_rep[p]) / all_rep;
}
printf "%-30s %15.0f (%9s %5.2f%%)\n\n", p ":", pred_rep[p], "", (100 * pred_rep[p]) / all_rep;
}
for (p in pred_name) {
for (t in type) {
if (kind_name[p "-" t] > 0) {
printf "%-9s %-32s %12.0f (%7.2f%%, %5.2f%%)\n", p, ctor_rep[t] " " t, kind_name[p "-" t], (100 * kind_name[p "-" t]) / pred_name[p], (100 * kind_name[p "-" t]) / all_name;
}
}
for (p in pred_name) {
for (t in type) {
if (kind_name[p "-" t] > 0) {
printf "%-9s %-32s %12.0f (%7.2f%%, %5.2f%%)\n", p, ctor_rep[t] " " t, kind_name[p "-" t], (100 * kind_name[p "-" t]) / pred_name[p], (100 * kind_name[p "-" t]) / all_name;
}
}
printf "%-42s %12.0f (%9s %5.2f%%)\n\n", p ":", pred_name[p], "", (100 * pred_name[p]) / all_name;
}
}
printf "%-42s %12.0f (%9s %5.2f%%)\n\n", p ":", pred_name[p], "", (100 * pred_name[p]) / all_name;
}
}