5 It would probably be best to split off the string table from the constant pool.
9 The pool should probably become a visible map of sorts, potentially. I can
10 use the sorted tree classes I made, although all of the indices will be off.
14 The generic JIT is getting a bit unweildy. I believe it needs to be split off
15 a bit. One thing I would split off is the machine code related stuff, things
16 which are used by the compiler such as logic generators and register
17 allocation. Then after that, what is left is the result of the standard JIT,
18 that is anything layered on top of that. However, one consideration is that the
19 standard JIT can use the same base machine code generators also. Although I
20 would still have to decide on that. If however, they do use the same interfaces
21 then there could be a simpler bridging of output logic although it would not
22 have register allocation and it would basically be providing a byte code
23 representation of the program.
27 Another thing I can do is merge together some of the generic and JIT pool
28 related stuff. Perhaps remove the representation of the constant pool
33 For the most part, the native code pieces can be reused by every implementation
34 of the JIT for the most part. One thing I can have though is that the
35 register allocator could potentially be replaced rather than using the default.
36 This could be used when a slightly difference scheme is desired. If I can
37 remove the bulk of the native code generated stuff from the generic JIT then
38 that package would be much lighter. The generic JIT just has to pass
39 information for the most part to the native code generators. Then the native
40 code generators could be used in the future to generate bootstrap code such as
41 if I need to have some kind of raw initialization process.
45 Then another plan would be a merging of the constant system, right now there
46 are some constant pool entries that are generic only that could be useful in
47 the JIT, these would be the call types and such. One thing I can do is to
48 remove the constant pool from the JIT and make it completely hidden. In most
49 cases the pool could become a burden as at least in the case of the generic
50 JIT, most of the pool would go unused. The generic JIT also virtualizes all
51 of the entries also. Also the base JIT code has an inclusion system so that
52 entries are marked as being used. Since I am doing that, it would be best to
53 just completely remove passing the pool and let the JIT implementation handle
60 * Move native code off to its own stand-alone project.
61 * Hide the constant pool from the JIT interfaces and have a unified simple
66 So what I could do as I thought of before is that I could move the program
67 representation around also. Then this could be reused by code such as a
68 hypothetical interpreter or `javap`. The JIT interfaces can then take this
69 information and pass it to the JIT implementation. So that project would
70 contain just a class representation that can be piped into the JIT for usage.
74 So the end result of all of this should be much smaller and simpler JITs along
75 with reusable native code generators and class representations. I would
76 suppose that the hiding of the constant pool can be done by the class
77 representation code. And that representation code can use directly the stack
78 and local variables also. Then the JIT would handle stack caching so that it
79 is not in that representation code. Then once the JIT caches stack items and
80 such it will send that to the implementing JIT. The implementing JIT then
81 generates native code via the native code generator classes. Then this means
82 that the base JIT will get all of the stack and pool entry representations
83 moved out making it far simpler.
87 Then I can move forward with implementing the JIT and I would then be less
88 likely to step over anything, since the current rather large set of classes can
89 be difficult to navigate especially when they will only increase in size.
95 * `jit` -> `class-format`
96 * Anything that represents the class file format goes here.
97 * Make class streamers the JIT can use.
98 * Hide the constant pool.
99 * `jit`/`jit-generic` -> `class-format`
101 * `jit-generic` -> `native-code`
102 * Move any register stuff and other interfaces related to target code
108 * Keep a simplified and merged pool, hide the details of it and use only
110 * Does not handle stack caching.
112 * Performs stack caching then passes that to JIT implementations.
114 * Anything related to native code generate goes here.
118 It may be possible to even remove `jit-generic-mips` and `jit-generic-powerpc`
123 So the Java stuff needs to be removed from the native allocator and placed in
128 What the native code allocator needs is a kind of state that can be used. It
129 either specifies that a register is used or some stack space was allocated. I
130 can then move the Java allocation state to use these markers. This would be
131 more effective than keeping variable states somewhere and using raw register
132 or stack values. Then the allocator state can be what is currently allocated.
133 The allocations should be immutable so they can be shared with the state,
134 otherwise it can get a bit messy.
138 Going to need a `native-code-base` which is dependend on by `jit-base`. Then
139 the floating point type is moved there. Then also with this native code being
140 split off, the allocator could handle cases where registers are 8-bit. So in
141 a way, in the future, it can help me when I write the small target JIT if the
142 current JIT does not become a part of it.
146 One thing I need to adjust is how the generic JIT allocates variables. I
147 believe I should follow a similar route and have it be based on allocations.
148 That is instead of register and stack it is just `NativeAllocation`.
152 Currently stuck on moving the generic stuff over, I suppose what I should do
153 then is move over the MIPS/PowerPC stuff such as ABIs and other things to the
154 `native-code` roots. Then from there I can work out how I want to access the
155 stuff from the generic JIT.
159 This means that the generic JIT becomes essentially final and provides the
164 So the only thing I have to in the generic JIT code for this move is to make
165 the initial argument allocation with argument priming. However this should be
166 easy as I can have an input argument request that fills parts of the state. So
167 some of the generic code moves back and it becomes just a wrapped
168 `NativeAllocation` which is bound to the general allocator state.
172 So the moving of the native code generator is partly complete as my code now
173 compiles, I just need to reimplement that behavior now.
177 The generic output needs a factory that can create native compilers as needed
178 when methods are to be output.
182 I will need another tread for locals to store copied stack values since the
183 native allocator will not allow values to be duplicated, only spliced in
184 registers and stack. I can continue the reimplementation of the register
185 allocator code in the future. Now one thing I need to do is move the class
186 format decoding code into its own project and out of the JIT. Basically it
187 would operate as a kind of class reader where the constant pool is hidden away.
191 This means the class decode is rid of the JIT details.
195 And that is a good thing since it makes the class decoder code much simpler as
196 the decoder no longer has to juggle JIT details at all.
200 The stack map parser state needs a partial and then a locked state. One thing
201 to consider though is that the information could be hidden again. I may want to
202 go for it being hidden as before. Except for `ClassStackMapType`.
206 The operation parsing part of the class decoder is a bit ugly. However now that
207 that code compiled, I must now rework the JIT itself. Then after the JIT is
208 reworked I would then go into the generic JIT code again and refix that due to
209 the changes. However, the benefit now is that I can refactor the class parsing
210 code also. The class parsing code as I said is ugly and I will want to rework
211 that a bit, especially the operation decoding part. However the description
212 streams will allow me to easily refactor without changing much. One intended
213 goal that I have is to make the stack and local references a bit more stable.
214 That is, the Class code will give me what I need. However, the Class prefix
215 before the class format code is quite annoying and I should remove that
216 before I continue on to the JIT.
220 So now all my code compiles again. I spent the entire day refactoring. However,
221 my refactor is not yet complete. I must reimplement the code I removed and
222 perform a refactor of the class parsing code, especially the operation
227 Seems that this split off code will work rather nice. Although the class writer
228 bridge will be very empty, it would definitely be a bit more clean compared to
233 The class writers for the JIT does not need the pool index numbers.
237 So today, I got much work done. Now I shall go to sleep since I am rather
238 tired. Tomorrow I will work on reimplementing the removed parts of the code so
239 that I get back to where I was. Then I suppose I will refactor the byte code
240 handling so it is a much cleaner. Then after that, hopefully I can then get to
241 emitting actual instructions and such.