2016/08/16

07:35

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

07:37

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.

09:20

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

12:12

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.

14:37

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.

18:55

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

19:01

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".

19:07

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

19:30

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

19:34

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

19:43

Will need to solve this one also.

20:23

Looks like the ELF header size is not valid.

20:25

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.

20:26

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).

21:36

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

21:39

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.

22:06

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