RSSA

Matthew Fluet fluet@CS.Cornell.EDU
Mon, 7 Jan 2002 18:53:09 -0500 (EST)


More questions on Arrays and limit checks: is there is bug in the
c-codegen's implementation of array limit checks:

			 in case limitCheck
			    of NONE => ()
			     | SOME {gcInfo, bytesPerElt, bytesAllocated} 
			       => let
				     val bytes =
					concat [numElts, 
						" * ", C.int bytesPerElt, 
						" + ", 
						C.int bytesAllocated];
				  in
				     GCInfo.outputLimitCheck (gcInfo, bytes,
							     false, print);
				     print "\t"
				  end;

Don't we need at least two more bytes for the header and the length?  And,
in the case numElts = 0, we need one byte for the forwarding pointer.
I'm happy enough just adding 3 to every array allocation limit check, even
though that might request one more byte than is strictly necessary.