larcenists / larceny

Larceny Scheme implementation
Other
202 stars 32 forks source link

Don't panic about excessively large allocations (ticket #343) #805

Closed jkoser closed 7 years ago

jkoser commented 7 years ago

Introduced an exception, which is now raised in IAssassin millicode when trying to allocate an object of more than LARGEST_OBJECT bytes.

This patch addresses both failure modes observed in the ticket. We avoid the panic by validating the allocation size before requesting memory from the GC. We avoid the segfault by checking for carry in an address calculation in the optimized millicode.

There is no special handling of calls to make-vector, etc. Justin believes detecting the problem in mc_alloc provides the greatest possible benefit. For example, calls with absurdly many rest arguments, as in (apply + (make-list #xffffff 1)), will now raise an error rather than panic.