Make it so mapping files are used and then reapplied.
[SquirrelJME.git] / modules / cldc-compact / src / test / resources / squirreljme / compilerbug / TestLLIAByteCode.j
blob9f6440ac87bc151874ef89bfc1e9bf8b43957745
1 ; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
2 ; ---------------------------------------------------------------------------
3 ; SquirrelJME
4 ; Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 ; ---------------------------------------------------------------------------
6 ; SquirrelJME is under the GNU General Public License v3+, or later.
7 ; See license.mkd for licensing and copyright information.
8 ; ---------------------------------------------------------------------------
9 ; There is a SummerCoat compiler bug with __LinkedListListIterator__
10 ; Where DUP_X1 causes an object reference to be trashed
12 .class public squirreljme/compilerbug/TestLLIAByteCode
14 ; Jasmin is being very impossible right now and I cannot declare fields in
15 ; this class at all because of a stupid syntax error.......
16 .super squirreljme/compilerbug/__LLIAFields__
17 ;.super net/multiphasicapps/tac/TestRunnable
18 ;.field _vdx I
19 ;.field list Lsquirreljme/compilerbug/FakeLinkedList;
20 ;.field _next Lsquirreljme/compilerbug/__Link__;
22 .method public <init>()V
23 aload 0
24 ;invokenonvirtual net/multiphasicapps/tac/TestRunnable/<init>()V
25 invokenonvirtual squirreljme/compilerbug/__LLIAFields__/<init>()V
26 return
27 .end method
29 ; The actual test
30 .method public test()V
31 .limit stack 8
32 .limit locals 2
33 ; Setup Fake Linked List
34 aload_0
35 new squirreljme/compilerbug/FakeLinkedList
36 dup
37 astore_1
38 dup
39 invokenonvirtual squirreljme/compilerbug/FakeLinkedList/<init>()V
40 putfield squirreljme/compilerbug/TestLLIAByteCode/list Lsquirreljme/compilerbug/FakeLinkedList;
42 ; Our next is the head of the list
43 aload_0
44 aload_1
45 getfield squirreljme/compilerbug/FakeLinkedList/_head Lsquirreljme/compilerbug/__Link__;
46 putfield squirreljme/compilerbug/TestLLIAByteCode/_next Lsquirreljme/compilerbug/__Link__;
48 ; Make a new fake object and add to the list
49 aload_0
50 new java/lang/Object
51 dup
52 invokenonvirtual java/lang/Object/<init>()V
53 invokevirtual squirreljme/compilerbug/TestLLIAByteCode/add(Ljava/lang/Object;)V
55 ; VDX Value
56 aload_0
57 ldc "vdx"
58 aload_0
59 getfield squirreljme/compilerbug/TestLLIAByteCode/_vdx I
60 invokevirtual net/multiphasicapps/tac/TestRunnable/secondary(Ljava/lang/String;I)V
62 ; atmod Value
63 aload_0
64 ldc "atmod"
65 aload_0
66 getfield squirreljme/compilerbug/TestLLIAByteCode/_atmod I
67 invokevirtual net/multiphasicapps/tac/TestRunnable/secondary(Ljava/lang/String;I)V
69 ; Next link
70 aload_0
71 ldc "next"
72 aload_0
73 getfield squirreljme/compilerbug/TestLLIAByteCode/_next Lsquirreljme/compilerbug/__Link__;
74 invokevirtual java/lang/Object/hashCode()I
75 invokevirtual net/multiphasicapps/tac/TestRunnable/secondary(Ljava/lang/String;I)V
76 notnull:
78 return
79 .end method
81 ; This method is an issue that happens in the compiler, as commented below
82 .method public add(Ljava/lang/Object;)V
83 .limit stack 5
84 .limit locals 4
85 .line 94
86 ; #8 = this
87 ; #9 = arg1
88 ; #12 = stack...
90 ; [] -> [this]
91 aload 0
92 ; [this] -> []
93 invokenonvirtual squirreljme/compilerbug/TestLLIAByteCode/__checkConcurrent()V
95 .line 97
96 ; [] -> [this]
97 aload 0
98 ; [this] -> [int this._vdx]
99 getfield squirreljme/compilerbug/TestLLIAByteCode/_vdx I
100 ; [int this._vdx] -> []
101 ; #2 = int this._vdx
102 istore 2
104 .line 98
105 ; [] -> [this]
106 aload 0
107 ; [this] -> [__Link__ this._next]
108 getfield squirreljme/compilerbug/TestLLIAByteCode/_next Lsquirreljme/compilerbug/__Link__;
109 ; [__Link__ this._next] -> []
110 ; #3 = __Link__ this._next
111 astore 3
113 .line 105
114 ; [] -> [__Link__ a]
115 new squirreljme/compilerbug/__Link__
116 ; [__Link__ a] -> [__Link__ a, __Link__ a]
118 ; [__Link__ a, __Link__ a] ->
119 ; [__Link__ a, __Link__ a, __Link__ this._next (#3)]
120 aload 3
121 ; [__Link__ a, __Link__ a, __Link__ this._next (#3)] ->
122 ; [__Link__ a, __Link__ a.prev]
123 getfield squirreljme/compilerbug/__Link__/_prev Lsquirreljme/compilerbug/__Link__;
124 ; [__Link__ a, __Link__ a.prev] ->
125 ; [__Link__ a, __Link__ a.prev, Object arg1]
126 aload 1
127 ; [__Link__ a,__Link__ a.prev, Object arg1] ->
128 ; [__Link__ a, __Link__ a.prev, Object arg1, __Link__ this._next (#3)]
129 aload 3
130 ; [__Link__ a, __Link__ a.prev, Object arg1, __Link__ this._next (#3)] ->
131 ; [__Link__ a]
132 invokenonvirtual squirreljme/compilerbug/__Link__/<init>(Lsquirreljme/compilerbug/__Link__;Ljava/lang/Object;Lsquirreljme/compilerbug/__Link__;)V
133 ; [__Link__ a] -> []
136 .line 108
137 ; [] -> [this]
138 aload 0
139 ; [this] -> [this, this]
141 ; [this, this] -> [this, int this._vdx]
142 getfield squirreljme/compilerbug/TestLLIAByteCode/_vdx I
143 ; [this, int this._vdx] -> [this, int this._vdx, 1]
144 iconst_1
145 ; [this, int this._vdx, 1] -> [this, int this._vdx + 1]
146 iadd
147 ; [this, int this._vdx + 1] -> []
148 putfield squirreljme/compilerbug/TestLLIAByteCode/_vdx I
150 .line 111
151 ; [] -> [this]
152 aload 0
153 ; [this] -> [FakeLinkedList this.list]
154 getfield squirreljme/compilerbug/TestLLIAByteCode/list Lsquirreljme/compilerbug/FakeLinkedList;
155 ; [FakeLinkedList this.list] ->
156 ; [FakeLinkedList this.list, FakeLinkedList this.list]
158 ; [FakeLinkedList this.list, FakeLinkedList this.list] ->
159 ; [FakeLinkedList this.list, int this.list._size]
160 getfield squirreljme/compilerbug/FakeLinkedList/_size I
161 ; [FakeLinkedList this.list, int this.list._size] ->
162 ; [FakeLinkedList this.list, int this.list._size, 1]
163 iconst_1
164 ; [FakeLinkedList this.list, int this.list._size, 1] ->
165 ; [FakeLinkedList this.list, int this.list._size + 1]
166 iadd
167 ; [FakeLinkedList this.list, int this.list._size + 1] -> []
168 putfield squirreljme/compilerbug/FakeLinkedList/_size I
170 .line 114
171 ; >> "*** Java :114 ALOAD_0@51 ***"
172 ; >> "*** Java :114 ALOAD_0@52 ***"
173 ; [] -> [this]
174 aload 0
175 ; [this] -> [this, this]
176 aload 0
178 ; >> "*** Java :114 GETFIELD@53 ***"
179 ; r13 == LinkedList
180 ; >> "IF_ICMP_EQUALS:[[8, 0, 1376]]"
181 ; >> "LOAD_POOL:[[#5658(ACCESSED_FIELD):READ+INSTANCE+field
182 ; java/util/__LinkedListListIterator__::list Ljava/util/LinkedList;,
183 ; 20]]"
184 ; >> "MEM_HANDLE_OFF_LOAD_OBJECT_REG_JAVA:[[13, 8, 20]]"
185 ; >> "IF_ICMP_EQUALS:[[13, 0, 7]]"
186 ; >> "MEM_HANDLE_COUNT_UP:[[13]]"
187 ; [this, this] -> [this, FakeLinkedList list]
188 getfield squirreljme/compilerbug/TestLLIAByteCode/list Lsquirreljme/compilerbug/FakeLinkedList;
190 ; >> "*** Java :114 DUP@56 ***"
191 ; [this, FakeLinkedList list] -> [this, FakeLinkedList list, FakeLinkedList list]
194 ; >> "*** Java :114 GETFIELD@57 ***"
195 ; >> "IF_ICMP_EQUALS:[[13, 0, 1348]]"
196 ; >> "LOAD_POOL:[[#5271(ACCESSED_FIELD):READ+INSTANCE+field
197 ; java/util/LinkedList::modCount I, 20]]"
198 ; >> "MEM_HANDLE_OFF_LOAD_INTEGER_REG_JAVA:[[14, 13, 20]]"
199 ; [this, FakeLinkedList list, FakeLinkedList list] ->
200 ; [this, FakeLinkedList list, int list.modCount]
201 getfield squirreljme/compilerbug/FakeLinkedList/modCount I
203 ; >> "*** Java :114 ICONST_1@60 ***"
204 ; >> "INTEGER_OR_CONST:[[0, 1, 15]]"
205 ; [this, FakeLinkedList list, int list.modCount] ->
206 ; [this, FakeLinkedList list, int list.modCount, 1]
207 iconst_1
209 ; >> "*** Java :114 IADD@61 ***"
210 ; >> "INTEGER_ADD_REG:[[14, 15, 14]]"
211 ; #13 #14 #15
212 ; [this, FakeLinkedList list, int list.modCount, 1] ->
213 ; [this, FakeLinkedList list, int list.modCount + 1]
214 iadd
216 ; >> "*** Java :114 DUP_X1@62 ***"
217 ; >> "COPY:[[14, 18]]"
218 ; r13 (our linked list) gets trashed here with the method
219 ; >> "COPY:[[18, 13]]"
220 ; #13 #14->#18 #18->#13
221 ; [this, FakeLinkedList list, int list.modCount + 1] ->
222 ; [this, int list.modCount + 1, FakeLinkedList list,
223 ; int list.modCount + 1]
224 ; DB: ********************
225 ; DB: Preprocessing STACKSHUFFLE:[DUP_X1] (@62#DUP_X1~:[])
226 ; DB: Shuffle with: DUP_X1 -> [[ba] -> [aba]]
227 ; DB: Popped: [r13:Ljava/util/LinkedList;, r14:I]
228 ; DB: Source map: {1=r13:Ljava/util/LinkedList;, 0=r14:I}
229 ; DB: Collide origUseVal=-1 ssl.value=14 useVal=14 ods.register=13
230 ; DB: Pre 18 -> 13
231 ; DB: Pre-copies: {14=18}
232 ; DB: *** Stack Result ***
233 ; DB: BEF: State:{L=[r8:Ljava/util/__LinkedListListIterator__;:RN,
234 ; r9:Ljava/lang/Object;:RN, r10:I, r11:Ljava/util/__Link__;],
235 ; S=[r8(12):Ljava/util/__LinkedListListIterator__;:N,
236 ; r13:Ljava/util/LinkedList;, r14:I]}
237 ; DB: AFT: State:{L=[r8:Ljava/util/__LinkedListListIterator__;:RN,
238 ; r9:Ljava/lang/Object;:RN, r10:I, r11:Ljava/util/__Link__;],
239 ; S=[r8(12):Ljava/util/__LinkedListListIterator__;:N, r13:I,
240 ; r13(14):Ljava/util/LinkedList;:N, r13(15):I]}
241 ; ^^^^^ ALL THREE OF THESE ARE r13??? THIS IS NOT GOOD!
242 ; DB: IN : []
243 ; DB: OUT: []
244 ; DB: OPS: [COPY(14, 18), COPY(18, 13)]
245 dup_x1
247 ; >> "*** Java :114 PUTFIELD@63 ***"
248 ; >> "IF_ICMP_EQUALS:[[13, 0, 1155]]"
249 ; >> "LOAD_POOL:[[#5272(ACCESSED_FIELD):NORMAL+INSTANCE+field
250 ; java/util/LinkedList::modCount I, 20]]"
251 ; >> "MEM_HANDLE_OFF_STORE_INTEGER_REG_JAVA:[[13, 13, 20]]"
252 ; ^ should be 14 (for list)!
253 ; >> "IF_ICMP_NOT_EQUALS:[[3, 0, 1579]]"
254 ; [this, int list.modCount + 1, FakeLinkedList list,
255 ; int list.modCount + 1] -> [this, int list.modCount + 1]
256 putfield squirreljme/compilerbug/FakeLinkedList/modCount I
258 ; >> "IF_ICMP_EQUALS:[[8, 0, 1133]]"
259 ; >> "LOAD_POOL:[[#5659(ACCESSED_FIELD):NORMAL+INSTANCE+field
260 ; java/util/__LinkedListListIterator__::_atmod I, 20]]"
261 ; >> "MEM_HANDLE_OFF_STORE_INTEGER_REG_JAVA:[[13, 8, 20]]"
262 ; >> "IF_ICMP_NOT_EQUALS:[[3, 0, 1557]]"
263 ; [this, int list.modCount + 1] -> []
264 putfield squirreljme/compilerbug/TestLLIAByteCode/_atmod I
266 .line 117
267 aload 0
268 aconst_null
269 putfield squirreljme/compilerbug/TestLLIAByteCode/_last Lsquirreljme/compilerbug/__Link__;
271 .line 118
272 return
273 .end method
275 ; Does nothing here for this test
276 .method __checkConcurrent()V
277 return
278 .end method