Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/compiler/Semant/pickle/rehash.sml
ViewVC logotype

View of /sml/trunk/src/compiler/Semant/pickle/rehash.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1137 - (download) (annotate)
Tue Mar 12 22:28:55 2002 UTC (19 years, 3 months ago) by blume
File size: 1160 byte(s)
implemented better, simpler PID allocation scheme;
binfile format has changed, version number is 110.39.2; NEW BOOTFILES
(* rehash.sml
 *  (C) 2001 Lucent Technologies, Bell Labs
 * Compute hash for a library that is the product of filtering
 * a larger environment.  Since every environment (after unpickling)
 * contains references to its own hash id, re-hashing requires
 * the original hash id (to be able to recognize it).  The result
 * of re-hashing will then be the same value that would have been
 * produced had the smaller environment been pickled (and hashed) in
 * the first place. *)
structure Rehash : sig
    val addGUID : { hash: PersStamps.persstamp, guid: string }
		    -> PersStamps.persstamp
    val rehash : { env: StaticEnv.staticEnv,
		   orig_pid: PersStamps.persstamp,
		   guid: string }
		 -> PersStamps.persstamp
end = struct
    fun addGUID { hash, guid } = let
	val crc = CRC.fromString (Byte.bytesToString (PersStamps.toBytes hash))
	fun append (c, x) = CRC.append (x, c)
	val crc' = CharVector.foldl append crc guid
	PersStamps.fromBytes (Byte.stringToBytes (CRC.toString crc'))

    fun rehash { env, orig_pid, guid } =
	addGUID { hash = #hash (PickMod.pickleEnv
				    (PickMod.REHASH orig_pid) env),
		  guid = guid }

ViewVC Help
Powered by ViewVC 1.0.0