[mercury-users] Bug in NT Version?

Ralph Becket rbeck at microsoft.com
Wed Sep 22 21:41:59 AEST 1999


Two things.  [Context: this is using rotd-1999-08-13 compiled using the
Cygnus tools under NT.]

1. I've finally got the time to have a go at a coding challenge issued
by a friend in systems, namely to reimplement the SPEC benchmark
129.compress in Mercury, in a readable style, without bailing out to C,
and make it run no more than six times slower than the C version (which
is an unholy mess that makes LLDS output look readable).

I've got the compression side working fine, but when I compiled in
the default grade (asm_fast.gc) and put in a couple of calls to
report_stats, I get the following (using EXTRA_MCFLAGS = -O 6):

$ cat /Mercury/mercury-compiler-rotd-1999-08-13/library/*.m | ./compress.exe
> /tmp/foo
[Time: +0.000s, 0.000s, D Stack: 0.031k, ND Stack: 0.023k,
#GCs: 1, Heap used since last GC: 4244.371k, Total used: 5504.000k]
[Time: +1.632s, 1.632s, D Stack: 0.031k, ND Stack: 0.023k,
#GCs: 7, Heap used since last GC: 1582.520k, Total used: 6884.000k]

Now what's surprising to me here is that this code is totally
deterministic, uses only tail recursion, and performs no structure
creation other than to build a destructively updatable array at the
start-of-day.  Therefore, there shouldn't be anything on the ND Stack
nor should there be a need for any GCs (the array consists of 140,000
ints).

All very strange.

2. When I try to get rid of GC altogether, by specifying either
`--gc none' or `--grade asm_fast' in EXTRA_GRADEFLAGS, I get the
following:

$ mmake compress
mmc --make-interface  --use-subdirs -O 6   compression.m
rm -f Mercury/cs/compress.c
mmc --compile-to-c --grade asm_fast.gc --grade asm_fast    --use-subdirs -O
6
compress.m > compress.err 2>&1
mgnuc --grade asm_fast.gc --grade asm_fast          -I. -c
Mercury/cs/compress.c
 -o Mercury/os/compress.o
rm -f Mercury/cs/compression.c
mmc --compile-to-c --grade asm_fast.gc --grade asm_fast    --use-subdirs -O
6
compression.m > compression.err 2>&1
mgnuc --grade asm_fast.gc --grade asm_fast          -I. -c
Mercury/cs/compressio
n.c -o Mercury/os/compression.o
ml --grade asm_fast.gc --grade asm_fast        -o compress
Mercury/os/compress_i
nit.o \
        Mercury/os/compress.o Mercury/os/compression.o
Mercury/os/compress_init.o(.text+0xe):compress_init.: undefined reference to
`GC
_add_roots'
Mercury/os/compress_init.o(.text+0x2d):compress_init.: undefined reference
to `G
C_stackbottom'
Mercury/os/compress_init.o(.text+0x47):compress_init.: undefined reference
to `a
ddress_of_init_gc'
collect2: ld returned 1 exit status
make: *** [compress] Error 1

Now I now that the libraries have been compiled in the asm_fast grade -
this is a standard installation and, moreover,

$ ls /usr/local/mercury/lib/mercury/lib/asm_fast/i386-pc-cygwin32/
libmer_browser.a  libmer_rt.a       libmer_std.a      libmer_trace.a

Help!

Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list