snazzy-d / sdc

The Snazzy D Compiler
MIT License
246 stars 55 forks source link

Add slab finalizers. #370

Closed schveiguy closed 1 month ago

schveiguy commented 1 month ago

This adds slab finalizer calling from the GC.

The added test tries all block sizes that are sparse or dense slabs, and verifies that the destructor for them will run.

schveiguy commented 1 month ago

OK, I updated the abstraction. Now the SlotMetadata wraps the size_t at the end of the block, and I use pointer casting to access it.

I did something a bit less pointer-y with the free space ushort. I think this also paves the way to have bigendian support, as it would just be a difference in layout of that union member.

deadalnix commented 1 month ago

I fixed the CI. It was failing because LLVM 18 wasn't available by default for github. Anyways, this is sorted out now and we can check this PR passes. Good.