Thinking about it, namespaces can be in their own sections so to speak as part of the ELF.


I just thought that the unaligned ELF could include the entire ELF. Which is does 0x000000 in one of the hello binaries. So I could technically use this to my advantage and just include the entire ELF in the program. This would mean that I would not need to have a bunch of padding everywhere and can still keep the ELF rather simple.


So when an ELF is generated, I will need a kind of ordering map and list that generates everything accordingly.


So the next thing to rewrite is the SlidingByteWindow class and have it not use ByteDeque because that gets inefficient once the read inflate stream gets large.


Namespaces would likely best be placed into the boot program although they could exist on their own in each section and not require a boot program at all. This may possibly be the best course of action.


Kind of feels like blobs are being written over and over again.


One thing to consider is that unused stuff in the constant pool will waste a bunch of space, such as unused strings (for attributes for example), so it would be best if they were done last and then have it where entries can be marked as being "used".


Also, the program headers does not use a null element, so that is wrong.


Ok, so now I get ./squirreljme: Invalid ELF image for this architecture.


It is possible it is due to the lack of section headers.


Will need to solve this one also.


Looks like the ELF header size is not valid.


And now it works, since I get:

qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

So now I can kind of just get to generating machine code to place in the given binary.


Before doing that however, I need to make it so constant pool entries are marked so that pointless ones are not included (such as signature data and such).


Removing pointless entries drops it to 81KiB, which is quite a drop.


So now is the big thing, generating machine code. It has been awhile and I have gotten close, but now I have reached this point. I could have done it many months ago, but the code would be extremely ugly and very difficult to maintain. So now the mainline refactoring of pre-existing code is nearly complete (except for a few things). I have written compilers before, so I have some experience in this. However, sometimes excitement makes me lazy.


I should also profile memory usage to reduce the GC requirements and such also.