[m-dev.] for review: Aditi bytecode bug fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 8 13:28:59 AEDT 1999


On 08-Mar-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> Fix bugs in the Aditi bytecode output routines.
> 
> compiler/bytecode.m:
> compiler/bytecode_data.m:
> 	Move the data conversion predicates from bytecode.m to a new module
> 	so they can be used by for output of Aditi-RL bytecode in the
> 	compiler and in the RL bytecode assembler in the Aditi distribution.
> 	Add new predicates to convert integers and floats to lists of
> 	bytes rather than writing them out immediately.
> 
> compiler/rl_code.m:
> 	Use the same data conversion predicates for Aditi-RL
> 	bytecodes as for Mercury bytecodes.
> 	This fixes a bug with the output of integers on 32 bit machines
> 	(integers were being shifted by more than the width of the type,
> 	the result of which is undefined) and endianness problems with
> 	floating point numbers.

Actually there is a more general problem here.  The `<<' and `>>'
functions in library/int.m do not document that the results will be
undefined in this case.  So either (a) the documentation should be
changed to make this clear, or (b) the implementation should be changed
to make it work.

There are arguments both ways.  Perhaps the best thing to do would be to
change the implementation to make it work, but to also add functions
`unchecked_left_shift' and `unchecked_right_shift' that omit the
range checks.

> +++ bytecode_data.m	Mon Mar  8 09:44:11 1999
...
> +% Author: zs, stayl.

You should put `aet' in that list (have a look at the output of
`cvs annotate bytecode.m').

Otherwise that change looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list