[m-dev.] Deep.data and Deep.procrep

Peter Wang novalazy at gmail.com
Tue Aug 3 14:36:58 AEST 2010


On 2010-08-03, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
>   1. When the runtime writes out the data, it should generate a pseudo-random
>      number and include it in the headers of both files.  Upon reading both
>      files check that the numbers match.
> 
>      Cons: A little too strong, this means writing out the Deep.procrep file
>            every time the executable is executed.

How do you avoid writing out a Deep.procrep file?

>   2. Store a hash of the Deep.procrep file inside the Deep.data file so that
>      the hash can be compared against the data when reading the files.
> 
>      Cons: More difficult.
> 
>      Cons; Computing the hash might take just as long as writing out the data
>            every time the program is executed.

Does it take long to write out?  Computing the hash should take negligible
time anyway.  There is plenty of code you can use (including compiler/md4.m)
but even MR_hash_string is probably good enough to prevent accidental
mismatches.

I suggest writing the hash out to Deep.procrep, and duplicating that
into Deep.data.  Then you can check the files are compatible just by
comparing the two strings.

Peter
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list