1 ; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
2 ; ---------------------------------------------------------------------------
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
19 ;.field list Lsquirreljme/compilerbug/FakeLinkedList;
20 ;.field _next Lsquirreljme/compilerbug/__Link__;
22 .
method public <init
>()V
24 ;invokenonvirtual net/multiphasicapps/tac/TestRunnable/<init>()V
25 invokenonvirtual squirreljme
/compilerbug
/__LLIAFields__
/<init
>()V
30 .
method public test
()V
33 ; Setup Fake Linked List
35 new squirreljme
/compilerbug
/FakeLinkedList
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
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
52 invokenonvirtual java
/lang
/Object
/<init
>()V
53 invokevirtual squirreljme
/compilerbug
/TestLLIAByteCode
/add
(Ljava
/lang
/Object
;)V
59 getfield squirreljme
/compilerbug
/TestLLIAByteCode
/_vdx I
60 invokevirtual net
/multiphasicapps
/tac
/TestRunnable
/secondary
(Ljava
/lang
/String
;I)V
66 getfield squirreljme
/compilerbug
/TestLLIAByteCode
/_atmod I
67 invokevirtual net
/multiphasicapps
/tac
/TestRunnable
/secondary
(Ljava
/lang
/String
;I)V
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
81 ; This method is an issue that happens in the compiler, as commented below
82 .
method public add
(Ljava
/lang
/Object
;)V
93 invokenonvirtual squirreljme
/compilerbug
/TestLLIAByteCode
/__checkConcurrent
()V
98 ; [this] -> [int this._vdx]
99 getfield squirreljme
/compilerbug
/TestLLIAByteCode
/_vdx I
100 ; [int this._vdx] -> []
107 ; [this] -> [__Link__ this._next]
108 getfield squirreljme
/compilerbug
/TestLLIAByteCode
/_next Lsquirreljme
/compilerbug
/__Link__
;
109 ; [__Link__ this._next] -> []
110 ; #3 = __Link__ this._next
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)]
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]
127 ; [__Link__ a,__Link__ a.prev, Object arg1] ->
128 ; [__Link__ a, __Link__ a.prev, Object arg1, __Link__ this._next (#3)]
130 ; [__Link__ a, __Link__ a.prev, Object arg1, __Link__ this._next (#3)] ->
132 invokenonvirtual squirreljme
/compilerbug
/__Link__
/<init
>(Lsquirreljme
/compilerbug
/__Link__
;Ljava/lang/Object;Lsquirreljme/compilerbug/__Link__;)V
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]
145 ; [this, int this._vdx, 1] -> [this, int this._vdx + 1]
147 ; [this, int this._vdx + 1] -> []
148 putfield squirreljme
/compilerbug
/TestLLIAByteCode
/_vdx I
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]
164 ; [FakeLinkedList this.list, int this.list._size, 1] ->
165 ; [FakeLinkedList this.list, int this.list._size + 1]
167 ; [FakeLinkedList this.list, int this.list._size + 1] -> []
168 putfield squirreljme
/compilerbug
/FakeLinkedList
/_size I
171 ; >> "*** Java :114 ALOAD_0@51 ***"
172 ; >> "*** Java :114 ALOAD_0@52 ***"
175 ; [this] -> [this, this]
178 ; >> "*** Java :114 GETFIELD@53 ***"
180 ; >> "IF_ICMP_EQUALS:[[8, 0, 1376]]"
181 ; >> "LOAD_POOL:[[#5658(ACCESSED_FIELD):READ+INSTANCE+field
182 ; java/util/__LinkedListListIterator__::list Ljava/util/LinkedList;,
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]
209 ; >> "*** Java :114 IADD@61 ***"
210 ; >> "INTEGER_ADD_REG:[[14, 15, 14]]"
212 ; [this, FakeLinkedList list, int list.modCount, 1] ->
213 ; [this, FakeLinkedList list, int list.modCount + 1]
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
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!
244 ; DB: OPS: [COPY(14, 18), COPY(18, 13)]
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
269 putfield squirreljme
/compilerbug
/TestLLIAByteCode
/_last Lsquirreljme
/compilerbug
/__Link__
;
275 ; Does nothing here for this test
276 .
method __checkConcurrent
()V