Offload int[] to byte[].
[SquirrelJME.git] / assets / developer-notes / stephanie-gawroriski / 2021 / 07 / 04.mkd
blob259326eac6ea24838470c97beb93cbc3f6dda2f7
1 # 2021/07/04
3 ## 18:30
5 So working on this stack shuffling method and looking at the original and
6 the new one, this is what it looks like:
8 ```
9 DB: ********************    NEW CODE (THIS OUTPUT IS WRONG)
10 DB: Preprocessing STACKSHUFFLE:[DUP2] (@62#DUP2~:[])
11 DB: Shuffle with: DUP2 -> [[A+] -> [A+A+]]
12 DB: *** Stack Result ***
13 DB: BEF: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMe
14 mory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B
15 :N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory
16 ;:N, r9(18):J, r10(19):top-long]}
17 DB: AFT: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMe
18 mory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B
19 :N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory
20 ;:N]}
21 DB: IN : [In:{r=r9, type=J, flags=}]
22 DB: OUT: []
24 DB: ********************    OLD CODE
25 DB: Preprocessing STACKSHUFFLE:[DUP2] (@62#DUP2~:[])
26 DB: Shuffle with: DUP2 -> [[A+] -> [A+A+]]
27 DB: Popped: [r9(18):J, r10(19):top-long]
28 DB: Source map: {0=r9(18):J}
29 DB: Pre-copies: {}
30 DB: *** Stack Result ***
31 DB: BEF: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMe
32 mory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B
33 :N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory
34 ;:N, r9(18):J, r10(19):top-long]}
35 DB: AFT: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMe
36 mory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B
37 :N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory
38 ;:N, r9(18):J, r10(19):top-long, r9(20):J, r10(21):top-long]}
39 DB: IN : []
40 DB: OUT: []
41 DB: ********************
42 ```
44 So I wonder what the pushed Java types are...
46 Actually the correct new code result is this:
48 ```
49 DB: ********************
50 DB: Preprocessing STACKSHUFFLE:[DUP2] (@62#DUP2~:[])
51 DB: Shuffle with: DUP2 -> [[A+] -> [A+A+]]
52 DB: >>>>>>>> PRE-DETERMINE
53 DB: *** Stack Result ***
54 DB: BEF: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:N, r9(18):J, r10(19):top-long]}
55 DB: AFT: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:N]}
56 DB: IN : [In:{r=r9, type=J, flags=}]
57 DB: OUT: []
58 DB: ********************
59 DB: @@PUSHTYPE: [[A+] -> [A+A+]] -> [J, J]
60 DB: *** Stack Result ***
61 DB: BEF: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:N, r9(18):J, r10(19):top-long]}
62 DB: AFT: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r17:J, r18:top-long, r19:J, r20:top-long]}
63 DB: IN : [In:{r=r8, type=Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;, flags=NC}, In:{r=r9, type=J, flags=}]
64 DB: OUT: [Out:{r=r17, type=J, flags=}, Out:{r=r19, type=J, flags=}]
65 DB: ********************
66 DB: <<<<<<<< POST-DETERMINE
67 DB: @@PUSHPOP: [[A+] -> [A+A+]] -> Result:{bef=State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:N, r9(18):J, r10(19):top-long]}, aft=State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r17:J, r18:top-long, r19:J, r20:top-long]}, enq=ENQ[|], in=[In:{r=r8, type=Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;, flags=NC}, In:{r=r9, type=J, flags=}], out=[Out:{r=r17, type=J, flags=}, Out:{r=r19, type=J, flags=}], ops=[]}
68 DB: @@INOUT: In:{r=r8, type=Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;, flags=NC} -> Out:{r=r17, type=J, flags=}
69 DB: @@INOUT: In:{r=r8, type=Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;, flags=NC} -> Out:{r=r19, type=J, flags=}
70 DB: *** Stack Result ***
71 DB: BEF: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:N, r9(18):J, r10(19):top-long]}
72 DB: AFT: State:{L=[r8:Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:RN, r9:J, r10:top-long, r11:[B:RN, r12:I, r13:I:R, r14:I], S=[r11(15):[B:N, r16:I, r17:J, r18:top-long, r19:J, r20:top-long]}
73 DB: IN : []
74 DB: OUT: []
75 DB: OPS: [COPY(R8, T0), COPY(T0, R17), COPY(T0, R19)]
76 DB: ********************
77 ```
79 And I see it:
81 ```
82 BEFORE:
83 S=[r11(15):[B:N, r16:I, r8(17):Lcc/squirreljme/jvm/summercoat/ld/mem/AbstractReadableMemory;:N, r9(18):J, r10(19):top-long]}
84 AFTER:
85 S=[r11(15):[B:N, r16:I, r17:J, r18:top-long, r19:J, r20:top-long]}
86 ```
88 That `AbstractReadableMemory` is just going poof for some reason.
90 ## 18:49
92 Ah, I am mixing the maxes... the pops is logical but one has logical and
93 the other has not... so after doing this basically it works and compiles
94 the code? Now to see if it actually produces the right result.
96 ### 19:35
98 Okay so looks to be correct, although the optimizations that I did have been
99 tossed out the window, but oh well...
102 - "*** Java :113 IADD@61 ***"
103 - "INTEGER_ADD_REG:[[14, 15, 14]]"
104 - "*** Java :113 DUP_X1@62 ***"
105 - "COPY:[[14, 20]]"
106 - "IF_ICMP_EQUALS:[[13, 0, 7]]"
107 - "MEM_HANDLE_COUNT_UP:[[13]]"
108 - "COPY:[[13, 21]]"
109 - "COPY:[[20, 13]]"
110 - "COPY:[[21, 14]]"
111 - "COPY:[[20, 15]]"
112 - "*** Java :113 PUTFIELD@63 ***"
113 - "COPY:[[14, 20]]"
114 - "IF_ICMP_EQUALS:[[14, 0, 542]]"
115 - "LOAD_POOL:[[#5271(ACCESSED_FIELD):NORMAL+INSTANCE+field java/util/LinkedLis
116   t::modCount I, 21]]"
117 - "MEM_HANDLE_OFF_STORE_INTEGER_REG_JAVA:[[15, 14, 21]]"
118 - "IF_ICMP_EQUALS:[[20, 0, 61]]"
119 - "MEM_HANDLE_COUNT_DOWN:[[20, 21]]"
120 - "IF_ICMP_GREATER_THAN:[[21, 0, 53]]"
121 - "COPY:[[3, 22]]"
122 - "COPY:[[0, 3]]"
123 - "LOAD_POOL:[[#5(INVOKE_XTABLE):XTable:STATIC[cc/squirreljme/jvm/summercoat/L
124   ogicHandler], 23]]"
125 - "LOAD_POOL:[[#19(INVOKED_METHOD):STATIC+cc/squirreljme/jvm/summercoat/LogicH
126   andler::gcMemHandle(I)V, 26]]"
127 - "MEM_HANDLE_OFF_LOAD_INTEGER_REG_JAVA:[[24, 23, 26]]"
128 - "INTEGER_ADD_CONST:[[26, 4, 26]]"
129 - "MEM_HANDLE_OFF_LOAD_INTEGER_REG_JAVA:[[25, 23, 26]]"
130 - "INVOKE_POINTER_AND_POOL:[[24, 25, R[20]]]"
131 - "IF_ICMP_NOT_EQUALS:[[3, 0, 8]]"
132 - "COPY:[[22, 3]]"
133 - "IF_ICMP_NOT_EQUALS:[[3, 0, 1792]]"
134 - "COPY:[[0, 20]]"
135 - "IF_ICMP_NOT_EQUALS:[[3, 0, 1784]]"