Lameguy64 / PSn00bSDK

The most powerful open source SDK for the PS1 (as far as open source PS1 SDKs go). Not recommended for beginner use.
Other
819 stars 66 forks source link

Support multiple allocators, add `TLSF` allocator and create cmake switches #83

Open EngineersBox opened 7 months ago

EngineersBox commented 7 months ago

Changes

This adds support for multiple allocator implementations in tandem with a CMake switch -D PSN00BSDK_LIBC_ALLOCATOR with the current implementations:

To Consider

In order to directly support the TLSF allocator repo, might be better to add it as a submodule with an include wrapper for the necessary coupling to the SDK's expected malloc interface. On the other hand this might not be a good idea, since I plan to cut down the TLSF implementation to only support 32-bit and change the alignment from 4 to 8 bytes.

I'd imagine that there might be some discussion to be had around the implementation of the CMake side of things. I'm really not overly familiar with CMake so there may well be better ways of doing what I've done in this PR.

Something else to think about is adding performance tests/benchmarking in the form of a standard suite to run against a given allocator implementation. This gives both SDK devs and users a decent idea of how the supported allocators run and their practical usage.

TODO

Notes

I've used TLSF before a while ago for an undergrad thesis project and it showed promise over the standard GlibC allocator and will subsequently perform much better than the current implementation in the SDK.