Add task for running tests that runs both clutter levels accordingly.
[SquirrelJME.git] / assets / developer-notes / stephanie-gawroriski / 2016 / 08 / 27.mkd
blob14dcaf61aeb083c2a543281ee5423fa8655ef767
1 # 2016/08/27
3 ## 13:10
5 So something that would be needed is a way to store jump locations within a
6 program. So do I make `JITMethodProgram` immutable or mutable? Once it is
7 passed to the native code generator it will not be touched again. Changing the
8 state could be used by the writer (such as making floating point operations
9 software). Alternatively, programs can be divided into secitons and used
10 that way, containing microops. Then any code that can jump to other areas would
11 do so via labels and such. There could never be a jump in the middle of a block
12 so that essentially each group becomes a basic block in a program.
14 ## 14:31
16 Technically for a program, the number of locals and stack items used is
17 pointless in most cases.
19 ## 14:34
21 Although the large number of jump targets, I would need to parse the stack map
22 table for optimal results (since that knows the type of elements on the stack).
24 ## 14:35
26 However, if I defer handling code and read the exception and the stack map
27 table, when parsing the byte code I will know the types used and all of the
28 entry points in the code. Then in that case, I will not need micro-operations
29 at all. I can have explicit code generation without building a temporary
30 program. Then I can also just do a linear pass through the byte code also.
32 ## 14:37
34 The only allocations needed would be for the stack map table information, the
35 exception table, and the extra bytes that the byte code uses. This would be
36 likely the fastest means of code generation. Then the only optimization that
37 can be performed for the most part reliably would be caching of stack values.
38 However reading the other tables first gives me the information needed where I
39 can easily determine if a value is used or not. I can then take the approach I
40 have thought up of before, where any write to a local is stored to the stack
41 while anything on the stack is purely temporary. There would just need to be
42 a temporary storage area in the event an exception occurs. However stack
43 temporaries only need to be managed in a single basic block for the most part.
44 Jumps to exceptions are ignored. Transition to another basic block just needs
45 a translocation of entries if required (in the event of a jump back and a stack
46 position was deallocated to the stack but at that given point it is allocated).
48 ## 14:42
50 So in short, skipping the code for now, will produce a bit faster of a
51 generator without going into lots of allocations to setup a program and then
52 performing allocations. I have previously written compact stack map table
53 parsers and state which I can use.
55 ## 17:21
57 And I decided to split `__ClassDecoder__` up, so now all of the resulting split
58 off code is in their own classes and much smaller. In the end some memory could
59 be saved in a way.
61 ## 20:19
63 Oh yes, `read` does not have to read all the bytes on the input, what I need to
64 do is use `readFully`.