in reply to maximum length of scalar in theory

You can go through the perl source code here: https://perl5.git.perl.org/ all the way to whatever version including 4 and earlier.

I don't think there is any reservation of the upper 4 bits. STRLEN for an SV is set to MEM_SIZE which is set to size_t which technically just has to be any value at least 16 bits.

The point at which it all falls over is up to the implementation of the memory allocation. You would need to dig into the malloc configuration for the particular compiled build. I notice the very old DOS malloc has something called 'MALLOC_ITEM_MAXSZ' which is 12 bits (ie 4096).