2016/08/12

07:55

Strings do not have to be written together, they can be written as soon as possible (say when there is no current output). The only issue would be that strings could not be sorted for binary lookup. However in general strings are going to need to be imported so that constants are equal with extra classes in consideration.

12:59

Well, Writer.lock is not final, that seems like a mistake. Also the CLDC one is not Flushable although it has a flush method.

14:16

Actually, the imports for certain things can be flagged for simplicity. For example if I write to a field I can mark it as read. However, if the field ends up really being final (meaning the class changed) then it can fail at import resolution time.

14:21

The same can be done for super and interfaces.

17:42

The namespace writer is getting rather ugly again however.

17:17

I am thinking far too much into it. One thing that every class has is the constant pool. The constant pool is the import table. Anything the class uses refers to the constant pool. It might also be best to have fragmentable classes. For example instead of merging all classes into a single namespace, they can be individually referenced. They would still be executable in memory. So essentially the namespace format would be like a ZIP file so to speak. The class processor for the most part can just define a constant pool and pass it to the writer, which then handles references to the entries in it as such. Then for each method in a class, they refer to a constant pool so to speak. The pool would be a bit smarter having the previously thought about extends and implements flags. Before I just ignored the constant pool, but the information is all there. Also, if I ignore a global string table, although it would cost some more bytes it would in effect make it so classes are stand alone and processed on their own. I would not need to keep a record of strings.

17:32

It will be similar to ZIP along with using CRCs, but with a different magic number and such. This way it is possible to stream classes rather than using a table of sorts.