KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > codegen > StackMapFrameCodeStream


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.compiler.codegen;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.HashSet JavaDoc;
15 import java.util.Set JavaDoc;
16
17 import org.eclipse.jdt.core.compiler.CharOperation;
18 import org.eclipse.jdt.internal.compiler.ClassFile;
19 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
20 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
21 import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
22 import org.eclipse.jdt.internal.compiler.lookup.Binding;
23 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
24 import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
25 import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
26 import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
27 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
28 import org.eclipse.jdt.internal.compiler.lookup.Scope;
29 import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding;
30 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
31 import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
32
33 public class StackMapFrameCodeStream extends CodeStream {
34     public StackMapFrame currentFrame;
35     public ArrayList JavaDoc frames;
36
37     public Set JavaDoc framePositions;
38
39     public ArrayList JavaDoc variablesModificationsPositions;
40
41     public int[] stateIndexes;
42     public int stateIndexesCounter;
43
44 public StackMapFrameCodeStream(ClassFile givenClassFile) {
45     super(givenClassFile);
46 }
47 public void aaload() {
48     super.aaload();
49     if (this.currentFrame.numberOfStackItems >= 2) {
50         this.currentFrame.numberOfStackItems--;
51         this.currentFrame.replaceWithElementType();
52     }
53 }
54 public void aastore() {
55     super.aastore();
56     if (this.currentFrame.numberOfStackItems >= 3) {
57         this.currentFrame.numberOfStackItems-=3;
58     }
59 }
60 public void aconst_null() {
61     super.aconst_null();
62     this.currentFrame.addStackItem(TypeBinding.NULL);
63 }
64 public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
65     // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
66
loop: for (int i = 0; i < visibleLocalsCount; i++) {
67         LocalVariableBinding localBinding = visibleLocals[i];
68         if (localBinding != null) {
69             // Check if the local is definitely assigned
70
boolean isDefinitelyAssigned = isDefinitelyAssigned(scope, initStateIndex, localBinding);
71             if (!isDefinitelyAssigned) {
72                 if (this.stateIndexes != null) {
73                     for (int j = 0, max = this.stateIndexesCounter; j < max; j++) {
74                         if (isDefinitelyAssigned(scope, this.stateIndexes[j], localBinding)) {
75                             currentFrame.putLocal(localBinding.resolvedPosition, new VerificationTypeInfo(localBinding.type));
76                             if ((localBinding.initializationCount == 0) || (localBinding.initializationPCs[((localBinding.initializationCount - 1) << 1) + 1] != -1)) {
77                                 /* There are two cases:
78                                  * 1) there is no initialization interval opened ==> add an opened interval
79                                  * 2) there is already some initialization intervals but the last one is closed ==> add an opened interval
80                                  * An opened interval means that the value at localBinding.initializationPCs[localBinding.initializationCount - 1][1]
81                                  * is equals to -1.
82                                  * initializationPCs is a collection of pairs of int:
83                                  * first value is the startPC and second value is the endPC. -1 one for the last value means that the interval
84                                  * is not closed yet.
85                                  */

86                                 localBinding.recordInitializationStartPC(position);
87                             }
88                             continue loop;
89                         }
90                     }
91                 }
92             } else {
93                 currentFrame.putLocal(localBinding.resolvedPosition, new VerificationTypeInfo(localBinding.type));
94                 if ((localBinding.initializationCount == 0) || (localBinding.initializationPCs[((localBinding.initializationCount - 1) << 1) + 1] != -1)) {
95                     /* There are two cases:
96                      * 1) there is no initialization interval opened ==> add an opened interval
97                      * 2) there is already some initialization intervals but the last one is closed ==> add an opened interval
98                      * An opened interval means that the value at localBinding.initializationPCs[localBinding.initializationCount - 1][1]
99                      * is equals to -1.
100                      * initializationPCs is a collection of pairs of int:
101                      * first value is the startPC and second value is the endPC. -1 one for the last value means that the interval
102                      * is not closed yet.
103                      */

104                     localBinding.recordInitializationStartPC(position);
105                 }
106             }
107         }
108     }
109     Integer JavaDoc newValue = new Integer JavaDoc(this.position);
110     if (this.variablesModificationsPositions.size() == 0 || !this.variablesModificationsPositions.get(this.variablesModificationsPositions.size() - 1).equals(newValue)) {
111         this.variablesModificationsPositions.add(newValue);
112     }
113     storeStackMapFrame();
114 }
115 public void addVariable(LocalVariableBinding localBinding) {
116     currentFrame.putLocal(localBinding.resolvedPosition, new VerificationTypeInfo(localBinding.type));
117     storeStackMapFrame();
118     super.addVariable(localBinding);
119 }
120 public void aload(int iArg) {
121     super.aload(iArg);
122     this.currentFrame.addStackItem(getLocal(iArg, this.currentFrame));
123 }
124 public void aload_0() {
125     super.aload_0();
126     this.currentFrame.addStackItem(getLocal(0, this.currentFrame));
127 }
128 public void aload_1() {
129     super.aload_1();
130     this.currentFrame.addStackItem(getLocal(1, this.currentFrame));
131 }
132
133 public void aload_2() {
134     super.aload_2();
135     this.currentFrame.addStackItem(getLocal(2, this.currentFrame));
136 }
137 public void aload_3() {
138     super.aload_3();
139     this.currentFrame.addStackItem(getLocal(3, this.currentFrame));
140 }
141 public void anewarray(TypeBinding typeBinding) {
142     super.anewarray(typeBinding);
143     char[] constantPoolName = typeBinding.constantPoolName();
144     int length = constantPoolName.length;
145     System.arraycopy(constantPoolName, 0, (constantPoolName = new char[length + 3]), 2, length);
146     constantPoolName[0] = '[';
147     constantPoolName[1] = 'L';
148     constantPoolName[length + 2] = ';';
149     int numberOfStackItems = this.currentFrame.numberOfStackItems;
150     if (numberOfStackItems >= 1) {
151         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(typeBinding.id, constantPoolName);
152     }
153 }
154 public void areturn() {
155     super.areturn();
156     if (this.currentFrame.numberOfStackItems >= 1) {
157         this.currentFrame.numberOfStackItems--;
158     }
159     framePositions.add(new Integer JavaDoc(this.position));
160 }
161 public void arraylength() {
162     super.arraylength();
163     int numberOfStackItems = this.currentFrame.numberOfStackItems;
164     if (numberOfStackItems >= 1) {
165         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.INT);
166     }
167 }
168 public void astore(int iArg) {
169     super.astore(iArg);
170     int numberOfStackItems = this.currentFrame.numberOfStackItems;
171     if (numberOfStackItems >= 1) {
172         this.currentFrame.putLocal(iArg, this.currentFrame.stackItems[numberOfStackItems - 1]);
173         this.currentFrame.numberOfStackItems--;
174     }
175 }
176 public void astore_0() {
177     super.astore_0();
178     int numberOfStackItems = this.currentFrame.numberOfStackItems;
179     if (numberOfStackItems >= 1) {
180         this.currentFrame.putLocal(0, this.currentFrame.stackItems[numberOfStackItems - 1]);
181         this.currentFrame.numberOfStackItems--;
182     }
183 }
184 public void astore_1() {
185     super.astore_1();
186     int numberOfStackItems = this.currentFrame.numberOfStackItems;
187     if (numberOfStackItems >= 1) {
188         this.currentFrame.putLocal(1, this.currentFrame.stackItems[numberOfStackItems - 1]);
189         this.currentFrame.numberOfStackItems--;
190     }
191 }
192 public void astore_2() {
193     super.astore_2();
194     int numberOfStackItems = this.currentFrame.numberOfStackItems;
195     if (numberOfStackItems >= 1) {
196         this.currentFrame.putLocal(2, this.currentFrame.stackItems[numberOfStackItems - 1]);
197         this.currentFrame.numberOfStackItems--;
198     }
199 }
200 public void astore_3() {
201     super.astore_3();
202     int numberOfStackItems = this.currentFrame.numberOfStackItems;
203     if (numberOfStackItems >= 1) {
204         this.currentFrame.putLocal(3, this.currentFrame.stackItems[numberOfStackItems - 1]);
205         this.currentFrame.numberOfStackItems--;
206     }
207 }
208 public void athrow() {
209     super.athrow();
210     if (this.currentFrame.numberOfStackItems >= 1) {
211         this.currentFrame.numberOfStackItems--;
212     }
213     framePositions.add(new Integer JavaDoc(this.position));
214 }
215 public void baload() {
216     super.baload();
217     if (this.currentFrame.numberOfStackItems >= 2) {
218         this.currentFrame.numberOfStackItems--;
219         this.currentFrame.replaceWithElementType();
220     }
221 }
222 public void bastore() {
223     super.bastore();
224     if (this.currentFrame.numberOfStackItems >= 3) {
225         this.currentFrame.numberOfStackItems-=3;
226     }
227 }
228 public void bipush(byte b) {
229     super.bipush(b);
230     this.currentFrame.addStackItem(TypeBinding.INT);
231 }
232 public void caload() {
233     super.caload();
234     if (this.currentFrame.numberOfStackItems >= 2) {
235         this.currentFrame.numberOfStackItems--;
236         this.currentFrame.replaceWithElementType();
237     }
238 }
239 public void castore() {
240     super.castore();
241     if (this.currentFrame.numberOfStackItems >= 3) {
242         this.currentFrame.numberOfStackItems-=3;
243     }
244 }
245 public void checkcast(int baseId) {
246     super.checkcast(baseId);
247     VerificationTypeInfo info = null;
248     switch (baseId) {
249         case TypeIds.T_byte :
250             info = new VerificationTypeInfo(TypeIds.T_JavaLangByte, ConstantPool.JavaLangByteConstantPoolName);
251             break;
252         case TypeIds.T_short :
253             info = new VerificationTypeInfo(TypeIds.T_JavaLangShort, ConstantPool.JavaLangShortConstantPoolName);
254             break;
255         case TypeIds.T_char :
256             info = new VerificationTypeInfo(TypeIds.T_JavaLangCharacter, ConstantPool.JavaLangCharacterConstantPoolName);
257             break;
258         case TypeIds.T_int :
259             info = new VerificationTypeInfo(TypeIds.T_JavaLangInteger, ConstantPool.JavaLangIntegerConstantPoolName);
260             break;
261         case TypeIds.T_long :
262             info = new VerificationTypeInfo(TypeIds.T_JavaLangLong, ConstantPool.JavaLangLongConstantPoolName);
263             break;
264         case TypeIds.T_float :
265             info = new VerificationTypeInfo(TypeIds.T_JavaLangFloat, ConstantPool.JavaLangFloatConstantPoolName);
266             break;
267         case TypeIds.T_double :
268             info = new VerificationTypeInfo(TypeIds.T_JavaLangDouble, ConstantPool.JavaLangDoubleConstantPoolName);
269             break;
270         case TypeIds.T_boolean :
271             info = new VerificationTypeInfo(TypeIds.T_JavaLangBoolean, ConstantPool.JavaLangBooleanConstantPoolName);
272     }
273     int numberOfStackItems = this.currentFrame.numberOfStackItems;
274     if (info != null && (numberOfStackItems >= 1)) {
275         this.currentFrame.stackItems[numberOfStackItems - 1] = info;
276     }
277 }
278 public void checkcast(TypeBinding typeBinding) {
279     super.checkcast(typeBinding);
280     int numberOfStackItems = this.currentFrame.numberOfStackItems;
281     if (numberOfStackItems >= 1) {
282         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(typeBinding);
283     }
284 }
285 public void d2f() {
286     super.d2f();
287     int numberOfStackItems = this.currentFrame.numberOfStackItems;
288     if (numberOfStackItems >= 1) {
289         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.FLOAT);
290     }
291 }
292 public void d2i() {
293     super.d2i();
294     int numberOfStackItems = this.currentFrame.numberOfStackItems;
295     if (numberOfStackItems >= 1) {
296         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.INT);
297     }
298 }
299 public void d2l() {
300     super.d2l();
301     int numberOfStackItems = this.currentFrame.numberOfStackItems;
302     if (numberOfStackItems >= 1) {
303         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.LONG);
304     }
305 }
306 public void dadd() {
307     super.dadd();
308     if (this.currentFrame.numberOfStackItems >= 1) {
309         this.currentFrame.numberOfStackItems--;
310     }
311 }
312 public void daload() {
313     super.daload();
314     if (this.currentFrame.numberOfStackItems >= 2) {
315         this.currentFrame.numberOfStackItems--;
316         this.currentFrame.replaceWithElementType();
317     }
318 }
319 public void dastore() {
320     super.dastore();
321     if (this.currentFrame.numberOfStackItems >= 3) {
322         this.currentFrame.numberOfStackItems-=3;
323     }
324 }
325 public void dcmpg() {
326     super.dcmpg();
327     if (this.currentFrame.numberOfStackItems >= 2) {
328         this.currentFrame.numberOfStackItems-=2;
329         this.currentFrame.addStackItem(TypeBinding.INT);
330     }
331 }
332 public void dcmpl() {
333     super.dcmpl();
334     if (this.currentFrame.numberOfStackItems >= 2) {
335         this.currentFrame.numberOfStackItems-=2;
336         this.currentFrame.addStackItem(TypeBinding.INT);
337     }
338 }
339 public void dconst_0() {
340     super.dconst_0();
341     this.currentFrame.addStackItem(TypeBinding.DOUBLE);
342 }
343 public void dconst_1() {
344     super.dconst_1();
345     this.currentFrame.addStackItem(TypeBinding.DOUBLE);
346 }
347 public void ddiv() {
348     super.ddiv();
349     if (this.currentFrame.numberOfStackItems >= 1) {
350         this.currentFrame.numberOfStackItems--;
351     }
352 }
353 public void decrStackSize(int offset) {
354     super.decrStackSize(offset);
355     if (this.currentFrame.numberOfStackItems >= 1) {
356         this.currentFrame.numberOfStackItems --;
357     }
358 }
359 public void dload(int iArg) {
360     super.dload(iArg);
361     this.currentFrame.addStackItem(getLocal(iArg, this.currentFrame));
362 }
363 public void dload_0() {
364     super.dload_0();
365     this.currentFrame.addStackItem(getLocal(0, this.currentFrame));
366 }
367 public void dload_1() {
368     super.dload_1();
369     this.currentFrame.addStackItem(getLocal(1, this.currentFrame));
370 }
371 public void dload_2() {
372     super.dload_2();
373     this.currentFrame.addStackItem(getLocal(2, this.currentFrame));
374 }
375 public void dload_3() {
376     super.dload_3();
377     this.currentFrame.addStackItem(getLocal(3, this.currentFrame));
378 }
379 public void dmul() {
380     super.dmul();
381     if (this.currentFrame.numberOfStackItems >= 1) {
382         this.currentFrame.numberOfStackItems--;
383     }
384 }
385 public void drem() {
386     super.drem();
387     if (this.currentFrame.numberOfStackItems >= 1) {
388         this.currentFrame.numberOfStackItems--;
389     }
390 }
391 public void dreturn() {
392     super.dreturn();
393     if (this.currentFrame.numberOfStackItems >= 1) {
394         this.currentFrame.numberOfStackItems--;
395     }
396     this.framePositions.add(new Integer JavaDoc(this.position));
397 }
398 public void dstore(int iArg) {
399     super.dstore(iArg);
400     int numberOfStackItems = this.currentFrame.numberOfStackItems;
401     if (numberOfStackItems >= 1) {
402         this.currentFrame.putLocal(iArg, this.currentFrame.stackItems[numberOfStackItems - 1]);
403         this.currentFrame.numberOfStackItems--;
404     }
405 }
406 public void dstore_0() {
407     super.dstore_0();
408     int numberOfStackItems = this.currentFrame.numberOfStackItems;
409     if (numberOfStackItems >= 1) {
410         this.currentFrame.putLocal(0, this.currentFrame.stackItems[numberOfStackItems - 1]);
411         this.currentFrame.numberOfStackItems--;
412     }
413 }
414 public void dstore_1() {
415     super.dstore_1();
416     int numberOfStackItems = this.currentFrame.numberOfStackItems;
417     if (numberOfStackItems >= 1) {
418         this.currentFrame.putLocal(1, this.currentFrame.stackItems[numberOfStackItems - 1]);
419         this.currentFrame.numberOfStackItems--;
420     }
421 }
422 public void dstore_2() {
423     super.dstore_2();
424     int numberOfStackItems = this.currentFrame.numberOfStackItems;
425     if (numberOfStackItems >= 1) {
426         this.currentFrame.putLocal(2, this.currentFrame.stackItems[numberOfStackItems - 1]);
427         this.currentFrame.numberOfStackItems--;
428     }
429 }
430 public void dstore_3() {
431     super.dstore_3();
432     int numberOfStackItems = this.currentFrame.numberOfStackItems;
433     if (numberOfStackItems >= 1) {
434         this.currentFrame.putLocal(3, this.currentFrame.stackItems[numberOfStackItems - 1]);
435         this.currentFrame.numberOfStackItems--;
436     }
437 }
438 public void dsub() {
439     super.dsub();
440     if (this.currentFrame.numberOfStackItems >= 1) {
441         this.currentFrame.numberOfStackItems--;
442     }
443 }
444 public void dup() {
445     super.dup();
446     int numberOfStackItems = this.currentFrame.numberOfStackItems;
447     if (numberOfStackItems >= 1) {
448         this.currentFrame.addStackItem(this.currentFrame.stackItems[numberOfStackItems - 1]);
449     }
450 }
451 public void dup_x1() {
452     super.dup_x1();
453     int numberOfStackItems = this.currentFrame.numberOfStackItems;
454     if (numberOfStackItems >= 2) {
455         VerificationTypeInfo info = this.currentFrame.stackItems[numberOfStackItems - 1];
456         this.currentFrame.numberOfStackItems--;
457         VerificationTypeInfo info2 = this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1];
458         this.currentFrame.numberOfStackItems--;
459         this.currentFrame.addStackItem(info);
460         this.currentFrame.addStackItem(info2);
461         this.currentFrame.addStackItem(info);
462     }
463 }
464 public void dup_x2() {
465     super.dup_x2();
466     int numberOfStackItems = this.currentFrame.numberOfStackItems;
467     if (numberOfStackItems >= 2) {
468         VerificationTypeInfo info = this.currentFrame.stackItems[numberOfStackItems - 1];
469         this.currentFrame.numberOfStackItems--;
470         VerificationTypeInfo info2 = this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1];
471         this.currentFrame.numberOfStackItems--;
472         switch(info2.id()) {
473             case TypeIds.T_long :
474             case TypeIds.T_double :
475                 this.currentFrame.addStackItem(info);
476                 this.currentFrame.addStackItem(info2);
477                 this.currentFrame.addStackItem(info);
478                 break;
479             default:
480                 numberOfStackItems = this.currentFrame.numberOfStackItems;
481                 if (numberOfStackItems >= 1) {
482                     VerificationTypeInfo info3 = this.currentFrame.stackItems[numberOfStackItems - 1];
483                     this.currentFrame.numberOfStackItems--;
484                     this.currentFrame.addStackItem(info);
485                     this.currentFrame.addStackItem(info3);
486                     this.currentFrame.addStackItem(info2);
487                     this.currentFrame.addStackItem(info);
488                 }
489         }
490     }
491 }
492 public void dup2() {
493     super.dup2();
494     int numberOfStackItems = this.currentFrame.numberOfStackItems;
495     if (numberOfStackItems >= 1) {
496         VerificationTypeInfo info = this.currentFrame.stackItems[numberOfStackItems - 1];
497         this.currentFrame.numberOfStackItems--;
498         switch(info.id()) {
499             case TypeIds.T_double :
500             case TypeIds.T_long :
501                 this.currentFrame.addStackItem(info);
502                 this.currentFrame.addStackItem(info);
503                 break;
504             default:
505                 numberOfStackItems = this.currentFrame.numberOfStackItems;
506                 if (numberOfStackItems >= 1) {
507                     VerificationTypeInfo info2 = this.currentFrame.stackItems[numberOfStackItems - 1];
508                     this.currentFrame.numberOfStackItems--;
509                     this.currentFrame.addStackItem(info2);
510                     this.currentFrame.addStackItem(info);
511                     this.currentFrame.addStackItem(info2);
512                     this.currentFrame.addStackItem(info);
513                 }
514         }
515     }
516 }
517 public void dup2_x1() {
518     super.dup2_x1();
519     int numberOfStackItems = this.currentFrame.numberOfStackItems;
520     if (numberOfStackItems >= 2) {
521         VerificationTypeInfo info = this.currentFrame.stackItems[numberOfStackItems - 1];
522         this.currentFrame.numberOfStackItems--;
523         VerificationTypeInfo info2 = this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1];
524         this.currentFrame.numberOfStackItems--;
525         switch(info.id()) {
526             case TypeIds.T_double :
527             case TypeIds.T_long :
528                 this.currentFrame.addStackItem(info);
529                 this.currentFrame.addStackItem(info2);
530                 this.currentFrame.addStackItem(info);
531                 break;
532             default:
533                 numberOfStackItems = this.currentFrame.numberOfStackItems;
534                 if (numberOfStackItems >= 1) {
535                     VerificationTypeInfo info3 = this.currentFrame.stackItems[numberOfStackItems - 1];
536                     this.currentFrame.numberOfStackItems--;
537                     this.currentFrame.addStackItem(info2);
538                     this.currentFrame.addStackItem(info);
539                     this.currentFrame.addStackItem(info3);
540                     this.currentFrame.addStackItem(info2);
541                     this.currentFrame.addStackItem(info);
542                 }
543         }
544     }
545 }
546 public void dup2_x2() {
547     super.dup2_x2();
548     int numberOfStackItems = this.currentFrame.numberOfStackItems;
549     if (numberOfStackItems >= 2) {
550         VerificationTypeInfo info = this.currentFrame.stackItems[numberOfStackItems - 1];
551         this.currentFrame.numberOfStackItems--;
552         VerificationTypeInfo info2 = this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1];
553         this.currentFrame.numberOfStackItems--;
554         switch(info.id()) {
555             case TypeIds.T_long :
556             case TypeIds.T_double :
557                 switch(info2.id()) {
558                     case TypeIds.T_long :
559                     case TypeIds.T_double :
560                         // form 4
561
this.currentFrame.addStackItem(info);
562                         this.currentFrame.addStackItem(info2);
563                         this.currentFrame.addStackItem(info);
564                         break;
565                     default:
566                         // form 2
567
numberOfStackItems = this.currentFrame.numberOfStackItems;
568                         if (numberOfStackItems >= 1) {
569                             VerificationTypeInfo info3 = this.currentFrame.stackItems[numberOfStackItems - 1];
570                             this.currentFrame.numberOfStackItems--;
571                             this.currentFrame.addStackItem(info);
572                             this.currentFrame.addStackItem(info3);
573                             this.currentFrame.addStackItem(info2);
574                             this.currentFrame.addStackItem(info);
575                         }
576                 }
577                 break;
578             default:
579                 numberOfStackItems = this.currentFrame.numberOfStackItems;
580                 if (numberOfStackItems >= 1) {
581                     VerificationTypeInfo info3 = this.currentFrame.stackItems[numberOfStackItems - 1];
582                     this.currentFrame.numberOfStackItems--;
583                     switch(info3.id()) {
584                         case TypeIds.T_long :
585                         case TypeIds.T_double :
586                             // form 3
587
this.currentFrame.addStackItem(info2);
588                             this.currentFrame.addStackItem(info);
589                             this.currentFrame.addStackItem(info3);
590                             this.currentFrame.addStackItem(info2);
591                             this.currentFrame.addStackItem(info);
592                             break;
593                         default:
594                             // form 1
595
numberOfStackItems = this.currentFrame.numberOfStackItems;
596                             if (numberOfStackItems >= 1) {
597                                 VerificationTypeInfo info4 = this.currentFrame.stackItems[numberOfStackItems - 1];
598                                 this.currentFrame.numberOfStackItems--;
599                                 this.currentFrame.addStackItem(info2);
600                                 this.currentFrame.addStackItem(info);
601                                 this.currentFrame.addStackItem(info4);
602                                 this.currentFrame.addStackItem(info3);
603                                 this.currentFrame.addStackItem(info2);
604                                 this.currentFrame.addStackItem(info);
605                             }
606                     }
607                 }
608         }
609     }
610 }
611 public void exitUserScope(BlockScope currentScope) {
612     int index = this.visibleLocalsCount - 1;
613     while (index >= 0) {
614         LocalVariableBinding visibleLocal = visibleLocals[index];
615         if (visibleLocal == null) {
616             index--;
617             continue;
618         }
619         if (visibleLocal.declaringScope != currentScope) // left currentScope
620
break;
621
622         // there may be some preserved locals never initialized
623
if (visibleLocal.initializationCount > 0){
624             this.currentFrame.removeLocals(visibleLocal.resolvedPosition);
625         }
626         index--;
627     }
628     if (currentScope != null) {
629         int localIndex = currentScope.localIndex;
630         if (localIndex != 0) {
631             for (int i = 0; i < localIndex; i++) {
632                 LocalVariableBinding variableBinding = currentScope.locals[i];
633                 if (variableBinding != null && variableBinding.useFlag == LocalVariableBinding.USED && variableBinding.resolvedPosition != -1) {
634                     this.currentFrame.removeLocals(variableBinding.resolvedPosition);
635                 }
636             }
637         }
638     }
639     super.exitUserScope(currentScope);
640 }
641 public void exitUserScope(BlockScope currentScope, LocalVariableBinding binding) {
642     int index = this.visibleLocalsCount - 1;
643     while (index >= 0) {
644         LocalVariableBinding visibleLocal = visibleLocals[index];
645         if (visibleLocal == null || visibleLocal == binding) {
646             index--;
647             continue;
648         }
649         if (visibleLocal.declaringScope != currentScope) // left currentScope
650
break;
651
652         // there may be some preserved locals never initialized
653
if (visibleLocal.initializationCount > 0){
654             this.currentFrame.removeLocals(visibleLocal.resolvedPosition);
655         }
656         index--;
657     }
658     if (currentScope != null) {
659         int localIndex = currentScope.localIndex;
660         if (localIndex != 0) {
661             for (int i = 0; i < localIndex; i++) {
662                 LocalVariableBinding variableBinding = currentScope.locals[i];
663                 if (variableBinding != null && variableBinding != binding && variableBinding.useFlag == LocalVariableBinding.USED && variableBinding.resolvedPosition != -1) {
664                     this.currentFrame.removeLocals(variableBinding.resolvedPosition);
665                 }
666             }
667         }
668     }
669     this.storeStackMapFrame();
670     super.exitUserScope(currentScope, binding);
671 }
672 public void f2d() {
673     super.f2d();
674     int numberOfStackItems = this.currentFrame.numberOfStackItems;
675     if (numberOfStackItems >= 1) {
676         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.DOUBLE);
677     }
678 }
679 public void f2i() {
680     super.f2i();
681     int numberOfStackItems = this.currentFrame.numberOfStackItems;
682     if (numberOfStackItems >= 1) {
683         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.INT);
684     }
685 }
686 public void f2l() {
687     super.f2l();
688     int numberOfStackItems = this.currentFrame.numberOfStackItems;
689     if (numberOfStackItems >= 1) {
690         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.LONG);
691     }
692 }
693 public void fadd() {
694     super.fadd();
695     if (this.currentFrame.numberOfStackItems >= 1) {
696         this.currentFrame.numberOfStackItems--;
697     }
698 }
699 public void faload() {
700     super.faload();
701     if (this.currentFrame.numberOfStackItems >= 2) {
702         this.currentFrame.numberOfStackItems--;
703         this.currentFrame.replaceWithElementType();
704     }
705 }
706 public void fastore() {
707     super.fastore();
708     if (this.currentFrame.numberOfStackItems >= 3) {
709         this.currentFrame.numberOfStackItems-=3;
710     }
711 }
712 public void fcmpg() {
713     super.fcmpg();
714     if (this.currentFrame.numberOfStackItems >= 2) {
715         this.currentFrame.numberOfStackItems-=2;
716         this.currentFrame.addStackItem(TypeBinding.INT);
717     }
718 }
719 public void fcmpl() {
720     super.fcmpl();
721     if (this.currentFrame.numberOfStackItems >= 2) {
722         this.currentFrame.numberOfStackItems-=2;
723         this.currentFrame.addStackItem(TypeBinding.INT);
724     }
725 }
726 public void fconst_0() {
727     super.fconst_0();
728     this.currentFrame.addStackItem(TypeBinding.FLOAT);
729 }
730 public void fconst_1() {
731     super.fconst_1();
732     this.currentFrame.addStackItem(TypeBinding.FLOAT);
733 }
734 public void fconst_2() {
735     super.fconst_2();
736     this.currentFrame.addStackItem(TypeBinding.FLOAT);
737 }
738 public void fdiv() {
739     super.fdiv();
740     if (this.currentFrame.numberOfStackItems >= 1) {
741         this.currentFrame.numberOfStackItems--;
742     }
743 }
744 public void fload(int iArg) {
745     super.fload(iArg);
746     this.currentFrame.addStackItem(getLocal(iArg, this.currentFrame));
747 }
748 public void fload_0() {
749     super.fload_0();
750     this.currentFrame.addStackItem(getLocal(0, this.currentFrame));
751 }
752 public void fload_1() {
753     super.fload_1();
754     this.currentFrame.addStackItem(getLocal(1, this.currentFrame));
755 }
756 public void fload_2() {
757     super.fload_2();
758     this.currentFrame.addStackItem(getLocal(2, this.currentFrame));
759 }
760 public void fload_3() {
761     super.fload_3();
762     this.currentFrame.addStackItem(getLocal(3, this.currentFrame));
763 }
764 public void fmul() {
765     super.fmul();
766     if (this.currentFrame.numberOfStackItems >= 1) {
767         this.currentFrame.numberOfStackItems--;
768     }
769 }
770 public void frem() {
771     super.frem();
772     if (this.currentFrame.numberOfStackItems >= 1) {
773         this.currentFrame.numberOfStackItems--;
774     }
775 }
776 public void freturn() {
777     super.freturn();
778     if (this.currentFrame.numberOfStackItems >= 1) {
779         this.currentFrame.numberOfStackItems--;
780     }
781     this.framePositions.add(new Integer JavaDoc(this.position));
782 }
783 public void fstore(int iArg) {
784     super.fstore(iArg);
785     int numberOfStackItems = this.currentFrame.numberOfStackItems;
786     if (numberOfStackItems >= 1) {
787         this.currentFrame.putLocal(iArg, this.currentFrame.stackItems[numberOfStackItems - 1]);
788         this.currentFrame.numberOfStackItems--;
789     }
790 }
791 public void fstore_0() {
792     super.fstore_0();
793     int numberOfStackItems = this.currentFrame.numberOfStackItems;
794     if (numberOfStackItems >= 1) {
795         this.currentFrame.putLocal(0, this.currentFrame.stackItems[numberOfStackItems - 1]);
796         this.currentFrame.numberOfStackItems--;
797     }
798 }
799 public void fstore_1() {
800     super.fstore_1();
801     int numberOfStackItems = this.currentFrame.numberOfStackItems;
802     if (numberOfStackItems >= 1) {
803         this.currentFrame.putLocal(1, this.currentFrame.stackItems[numberOfStackItems - 1]);
804         this.currentFrame.numberOfStackItems--;
805     }
806 }
807 public void fstore_2() {
808     super.fstore_2();
809     int numberOfStackItems = this.currentFrame.numberOfStackItems;
810     if (numberOfStackItems >= 1) {
811         this.currentFrame.putLocal(2, this.currentFrame.stackItems[numberOfStackItems - 1]);
812         this.currentFrame.numberOfStackItems--;
813     }
814 }
815 public void fstore_3() {
816     super.fstore_3();
817     int numberOfStackItems = this.currentFrame.numberOfStackItems;
818     if (numberOfStackItems >= 1) {
819         this.currentFrame.putLocal(3, this.currentFrame.stackItems[numberOfStackItems - 1]);
820         this.currentFrame.numberOfStackItems--;
821     }
822 }
823 public void fsub() {
824     super.fsub();
825     if (this.currentFrame.numberOfStackItems >= 1) {
826         this.currentFrame.numberOfStackItems--;
827     }
828 }
829 public void generateBoxingConversion(int unboxedTypeID) {
830     super.generateBoxingConversion(unboxedTypeID);
831     VerificationTypeInfo info = null;
832     switch (unboxedTypeID) {
833         case TypeIds.T_byte :
834             info = new VerificationTypeInfo(TypeIds.T_JavaLangByte, ConstantPool.JavaLangByteConstantPoolName);
835             break;
836         case TypeIds.T_short :
837             info = new VerificationTypeInfo(TypeIds.T_JavaLangShort, ConstantPool.JavaLangShortConstantPoolName);
838             break;
839         case TypeIds.T_char :
840                info = new VerificationTypeInfo(TypeIds.T_JavaLangCharacter, ConstantPool.JavaLangCharacterConstantPoolName);
841            break;
842         case TypeIds.T_int :
843                info = new VerificationTypeInfo(TypeIds.T_JavaLangInteger, ConstantPool.JavaLangIntegerConstantPoolName);
844             break;
845         case TypeIds.T_long :
846                info = new VerificationTypeInfo(TypeIds.T_JavaLangLong, ConstantPool.JavaLangLongConstantPoolName);
847             break;
848         case TypeIds.T_float :
849                info = new VerificationTypeInfo(TypeIds.T_JavaLangFloat, ConstantPool.JavaLangFloatConstantPoolName);
850             break;
851         case TypeIds.T_double :
852                info = new VerificationTypeInfo(TypeIds.T_JavaLangDouble, ConstantPool.JavaLangDoubleConstantPoolName);
853             break;
854         case TypeIds.T_boolean :
855                info = new VerificationTypeInfo(TypeIds.T_JavaLangBoolean, ConstantPool.JavaLangBooleanConstantPoolName);
856     }
857     int numberOfStackItems = this.currentFrame.numberOfStackItems;
858     if (info != null && (numberOfStackItems >= 1)) {
859         this.currentFrame.stackItems[numberOfStackItems - 1] = info;
860     }
861 }
862 public void generateOuterAccess(Object JavaDoc[] mappingSequence, ASTNode invocationSite, Binding target, Scope scope) {
863     if (mappingSequence == null) {
864         if (target instanceof LocalVariableBinding) {
865             scope.problemReporter().needImplementation(); //TODO (philippe) should improve local emulation failure reporting
866
} else {
867             scope.problemReporter().noSuchEnclosingInstance((ReferenceBinding)target, invocationSite, false);
868             this.currentFrame.addStackItem((ReferenceBinding)target);
869         }
870         return;
871     }
872     if (mappingSequence == BlockScope.NoEnclosingInstanceInConstructorCall) {
873         scope.problemReporter().noSuchEnclosingInstance((ReferenceBinding)target, invocationSite, true);
874         this.currentFrame.addStackItem((ReferenceBinding)target);
875         return;
876     } else if (mappingSequence == BlockScope.NoEnclosingInstanceInStaticContext) {
877         scope.problemReporter().noSuchEnclosingInstance((ReferenceBinding)target, invocationSite, false);
878         this.currentFrame.addStackItem((ReferenceBinding)target);
879         return;
880     }
881
882     if (mappingSequence == BlockScope.EmulationPathToImplicitThis) {
883         this.aload_0();
884         return;
885     } else if (mappingSequence[0] instanceof FieldBinding) {
886         FieldBinding fieldBinding = (FieldBinding) mappingSequence[0];
887         this.aload_0();
888         this.getfield(fieldBinding);
889     } else {
890         load((LocalVariableBinding) mappingSequence[0]);
891     }
892     for (int i = 1, length = mappingSequence.length; i < length; i++) {
893         if (mappingSequence[i] instanceof FieldBinding) {
894             FieldBinding fieldBinding = (FieldBinding) mappingSequence[i];
895             this.getfield(fieldBinding);
896         } else {
897             this.invokestatic((MethodBinding) mappingSequence[i]);
898         }
899     }
900 }
901 public void generateUnboxingConversion(int unboxedTypeID) {
902     super.generateUnboxingConversion(unboxedTypeID);
903     VerificationTypeInfo info = null;
904     switch (unboxedTypeID) {
905         case TypeIds.T_byte :
906             info = new VerificationTypeInfo(TypeBinding.BYTE);
907             break;
908         case TypeIds.T_short :
909             info = new VerificationTypeInfo(TypeBinding.SHORT);
910             break;
911         case TypeIds.T_char :
912             info = new VerificationTypeInfo(TypeBinding.CHAR);
913             break;
914         case TypeIds.T_int :
915             info = new VerificationTypeInfo(TypeBinding.INT);
916             break;
917         case TypeIds.T_long :
918             info = new VerificationTypeInfo(TypeBinding.LONG);
919             break;
920         case TypeIds.T_float :
921             info = new VerificationTypeInfo(TypeBinding.FLOAT);
922             break;
923         case TypeIds.T_double :
924             info = new VerificationTypeInfo(TypeBinding.DOUBLE);
925             break;
926         case TypeIds.T_boolean :
927             info = new VerificationTypeInfo(TypeBinding.BOOLEAN);
928     }
929     int numberOfStackItems = this.currentFrame.numberOfStackItems;
930     if (info != null && (numberOfStackItems >= 1)) {
931         this.currentFrame.stackItems[numberOfStackItems - 1] = info;
932     }
933 }
934 public void getBaseTypeValue(int baseTypeID) {
935     super.getBaseTypeValue(baseTypeID);
936     VerificationTypeInfo info = null;
937     switch (baseTypeID) {
938         case TypeIds.T_byte :
939             info = new VerificationTypeInfo(TypeBinding.BYTE);
940             break;
941         case TypeIds.T_short :
942             info = new VerificationTypeInfo(TypeBinding.SHORT);
943             break;
944         case TypeIds.T_char :
945             info = new VerificationTypeInfo(TypeBinding.CHAR);
946             break;
947         case TypeIds.T_int :
948             info = new VerificationTypeInfo(TypeBinding.INT);
949             break;
950         case TypeIds.T_long :
951             info = new VerificationTypeInfo(TypeBinding.LONG);
952             break;
953         case TypeIds.T_float :
954             info = new VerificationTypeInfo(TypeBinding.FLOAT);
955             break;
956         case TypeIds.T_double :
957             info = new VerificationTypeInfo(TypeBinding.DOUBLE);
958             break;
959         case TypeIds.T_boolean :
960             info = new VerificationTypeInfo(TypeBinding.BOOLEAN);
961     }
962     int numberOfStackItems = this.currentFrame.numberOfStackItems;
963     if (info != null && (numberOfStackItems >= 1)) {
964         this.currentFrame.stackItems[numberOfStackItems - 1] = info;
965     }
966 }
967 public void getfield(FieldBinding fieldBinding) {
968     super.getfield(fieldBinding);
969     int numberOfStackItems = this.currentFrame.numberOfStackItems;
970     if (numberOfStackItems >= 1) {
971         this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(fieldBinding.type);
972     }
973 }
974 private VerificationTypeInfo getLocal(int resolvedPosition, StackMapFrame frame) {
975     VerificationTypeInfo verificationTypeInfo = frame.locals[resolvedPosition];
976
977     if (verificationTypeInfo == null) {
978         return null;
979     }
980     try {
981         if (verificationTypeInfo.tag == VerificationTypeInfo.ITEM_UNINITIALIZED_THIS
982                 || verificationTypeInfo.tag == VerificationTypeInfo.ITEM_UNINITIALIZED) {
983             return verificationTypeInfo;
984         }
985         return (VerificationTypeInfo) verificationTypeInfo.clone();
986     } catch (CloneNotSupportedException JavaDoc e) {
987         return verificationTypeInfo;
988     }
989 }
990 protected int getPosition() {
991     // need to record a new stack frame at this position
992
int pos = super.getPosition();
993     this.framePositions.add(new Integer JavaDoc(this.position));
994     storeStackMapFrame();
995     return pos;
996 }
997 public void getstatic(FieldBinding fieldBinding) {
998     super.getstatic(fieldBinding);
999     this.currentFrame.addStackItem(fieldBinding.type);
1000}
1001public void getTYPE(int baseTypeID) {
1002    super.getTYPE(baseTypeID);
1003    this.currentFrame.addStackItem(new VerificationTypeInfo(TypeIds.T_JavaLangClass, ConstantPool.JavaLangClassConstantPoolName));
1004}
1005/**
1006 * We didn't call it goto, because there is a conflit with the goto keyword
1007 */

1008public void goto_(BranchLabel label) {
1009    super.goto_(label);
1010    this.framePositions.add(new Integer JavaDoc(this.position));
1011}
1012public void goto_w(BranchLabel label) {
1013    super.goto_w(label);
1014    this.framePositions.add(new Integer JavaDoc(this.position));
1015}
1016public void i2b() {
1017    super.i2b();
1018    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1019    if (numberOfStackItems >= 1) {
1020        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.BYTE);
1021    }
1022}
1023public void i2c() {
1024    super.i2c();
1025    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1026    if (numberOfStackItems >= 1) {
1027        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.CHAR);
1028    }
1029}
1030public void i2d() {
1031    super.i2d();
1032    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1033    if (numberOfStackItems >= 1) {
1034        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.DOUBLE);
1035    }
1036}
1037public void i2f() {
1038    super.i2f();
1039    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1040    if (numberOfStackItems >= 1) {
1041        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.FLOAT);
1042    }
1043}
1044public void i2l() {
1045    super.i2l();
1046    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1047    if (numberOfStackItems >= 1) {
1048        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.LONG);
1049    }
1050}
1051public void i2s() {
1052    super.i2s();
1053    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1054    if (numberOfStackItems >= 1) {
1055        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.SHORT);
1056    }
1057}
1058public void iadd() {
1059    super.iadd();
1060    if (this.currentFrame.numberOfStackItems >= 1) {
1061        this.currentFrame.numberOfStackItems--;
1062    }
1063}
1064public void iaload() {
1065    super.iaload();
1066    if (this.currentFrame.numberOfStackItems >= 1) {
1067        this.currentFrame.numberOfStackItems--;
1068        this.currentFrame.replaceWithElementType();
1069    }
1070}
1071public void iand() {
1072    super.iand();
1073    if (this.currentFrame.numberOfStackItems >= 1) {
1074        this.currentFrame.numberOfStackItems--;
1075    }
1076}
1077public void iastore() {
1078    super.iastore();
1079    if (this.currentFrame.numberOfStackItems >= 3) {
1080        this.currentFrame.numberOfStackItems-=3;
1081    }
1082}
1083public void iconst_0() {
1084    super.iconst_0();
1085    this.currentFrame.addStackItem(TypeBinding.INT);
1086}
1087public void iconst_1() {
1088    super.iconst_1();
1089    this.currentFrame.addStackItem(TypeBinding.INT);
1090}
1091public void iconst_2() {
1092    super.iconst_2();
1093    this.currentFrame.addStackItem(TypeBinding.INT);
1094}
1095public void iconst_3() {
1096    super.iconst_3();
1097    this.currentFrame.addStackItem(TypeBinding.INT);
1098}
1099public void iconst_4() {
1100    super.iconst_4();
1101    this.currentFrame.addStackItem(TypeBinding.INT);
1102}
1103public void iconst_5() {
1104    super.iconst_5();
1105    this.currentFrame.addStackItem(TypeBinding.INT);
1106}
1107public void iconst_m1() {
1108    super.iconst_m1();
1109    this.currentFrame.addStackItem(TypeBinding.INT);
1110}
1111public void idiv() {
1112    super.idiv();
1113    if (this.currentFrame.numberOfStackItems >= 1) {
1114        this.currentFrame.numberOfStackItems--;
1115    }
1116}
1117public void if_acmpeq(BranchLabel lbl) {
1118    super.if_acmpeq(lbl);
1119    if (this.currentFrame.numberOfStackItems >= 2) {
1120        this.currentFrame.numberOfStackItems-=2;
1121    }
1122}
1123public void if_acmpne(BranchLabel lbl) {
1124    super.if_acmpne(lbl);
1125    if (this.currentFrame.numberOfStackItems >= 2) {
1126        this.currentFrame.numberOfStackItems-=2;
1127    }
1128}
1129public void if_icmpeq(BranchLabel lbl) {
1130    super.if_icmpeq(lbl);
1131    if (this.currentFrame.numberOfStackItems >= 2) {
1132        this.currentFrame.numberOfStackItems-=2;
1133    }
1134}
1135public void if_icmpge(BranchLabel lbl) {
1136    super.if_icmpge(lbl);
1137    if (this.currentFrame.numberOfStackItems >= 2) {
1138        this.currentFrame.numberOfStackItems-=2;
1139    }
1140}
1141public void if_icmpgt(BranchLabel lbl) {
1142    super.if_icmpgt(lbl);
1143    if (this.currentFrame.numberOfStackItems >= 2) {
1144        this.currentFrame.numberOfStackItems-=2;
1145    }
1146}
1147public void if_icmple(BranchLabel lbl) {
1148    super.if_icmple(lbl);
1149    if (this.currentFrame.numberOfStackItems >= 2) {
1150        this.currentFrame.numberOfStackItems-=2;
1151    }
1152}
1153public void if_icmplt(BranchLabel lbl) {
1154    super.if_icmplt(lbl);
1155    if (this.currentFrame.numberOfStackItems >= 2) {
1156        this.currentFrame.numberOfStackItems-=2;
1157    }
1158}
1159public void if_icmpne(BranchLabel lbl) {
1160    super.if_icmpne(lbl);
1161    if (this.currentFrame.numberOfStackItems >= 2) {
1162        this.currentFrame.numberOfStackItems-=2;
1163    }
1164}
1165public void ifeq(BranchLabel lbl) {
1166    super.ifeq(lbl);
1167    if (this.currentFrame.numberOfStackItems >= 1) {
1168        this.currentFrame.numberOfStackItems--;
1169    }
1170}
1171public void ifge(BranchLabel lbl) {
1172    super.ifge(lbl);
1173    if (this.currentFrame.numberOfStackItems >= 1) {
1174        this.currentFrame.numberOfStackItems--;
1175    }
1176}
1177public void ifgt(BranchLabel lbl) {
1178    super.ifgt(lbl);
1179    if (this.currentFrame.numberOfStackItems >= 1) {
1180        this.currentFrame.numberOfStackItems--;
1181    }
1182}
1183public void ifle(BranchLabel lbl) {
1184    super.ifle(lbl);
1185    if (this.currentFrame.numberOfStackItems >= 1) {
1186        this.currentFrame.numberOfStackItems--;
1187    }
1188}
1189public void iflt(BranchLabel lbl) {
1190    super.iflt(lbl);
1191    if (this.currentFrame.numberOfStackItems >= 1) {
1192        this.currentFrame.numberOfStackItems--;
1193    }
1194}
1195public void ifne(BranchLabel lbl) {
1196    super.ifne(lbl);
1197    if (this.currentFrame.numberOfStackItems >= 1) {
1198        this.currentFrame.numberOfStackItems--;
1199    }
1200}
1201public void ifnonnull(BranchLabel lbl) {
1202    super.ifnonnull(lbl);
1203    if (this.currentFrame.numberOfStackItems >= 1) {
1204        this.currentFrame.numberOfStackItems--;
1205    }
1206}
1207public void ifnull(BranchLabel lbl) {
1208    super.ifnull(lbl);
1209    if (this.currentFrame.numberOfStackItems >= 1) {
1210        this.currentFrame.numberOfStackItems--;
1211    }
1212}
1213public void iload(int iArg) {
1214    super.iload(iArg);
1215    this.currentFrame.addStackItem(getLocal(iArg, this.currentFrame));
1216}
1217public void iload_0() {
1218    super.iload_0();
1219    this.currentFrame.addStackItem(getLocal(0, this.currentFrame));
1220}
1221public void iload_1() {
1222    super.iload_1();
1223    this.currentFrame.addStackItem(getLocal(1, this.currentFrame));
1224}
1225public void iload_2() {
1226    super.iload_2();
1227    this.currentFrame.addStackItem(getLocal(2, this.currentFrame));
1228}
1229public void iload_3() {
1230    super.iload_3();
1231    this.currentFrame.addStackItem(getLocal(3, this.currentFrame));
1232}
1233public void imul() {
1234    super.imul();
1235    if (this.currentFrame.numberOfStackItems >= 1) {
1236        this.currentFrame.numberOfStackItems--;
1237    }
1238}
1239public boolean inlineForwardReferencesFromLabelsTargeting(BranchLabel targetLabel, int gotoLocation) {
1240    if (targetLabel.delegate != null) return false; // already inlined
1241
int chaining = L_UNKNOWN;
1242
1243    boolean removeFrame = true;
1244    for (int i = this.countLabels - 1; i >= 0; i--) {
1245        BranchLabel currentLabel = labels[i];
1246        if (currentLabel.position != gotoLocation) break;
1247        if (currentLabel == targetLabel) {
1248            chaining |= L_CANNOT_OPTIMIZE;
1249            continue;
1250        }
1251        if (currentLabel.isStandardLabel()) {
1252            if (currentLabel.delegate != null) continue;
1253            chaining |= L_OPTIMIZABLE;
1254            if (currentLabel.forwardReferenceCount() == 0 && ((currentLabel.tagBits & BranchLabel.USED) != 0)) {
1255                removeFrame = false;
1256            }
1257            continue;
1258        }
1259        // case label
1260
removeFrame = false;
1261        chaining |= L_CANNOT_OPTIMIZE;
1262    }
1263    if ((chaining & L_OPTIMIZABLE) != 0) {
1264        for (int i = this.countLabels - 1; i >= 0; i--) {
1265            BranchLabel currentLabel = labels[i];
1266            if (currentLabel.position != gotoLocation) break;
1267            if (currentLabel == targetLabel) continue;
1268            if (currentLabel.isStandardLabel()) {
1269                if (currentLabel.delegate != null) continue;
1270                targetLabel.becomeDelegateFor(currentLabel);
1271                // we should remove the frame corresponding to otherLabel position in order to prevent unused stack frame
1272
if (removeFrame) {
1273                    currentLabel.tagBits &= ~BranchLabel.USED;
1274                    this.removeStackFrameFor(gotoLocation);
1275                }
1276            }
1277        }
1278    }
1279    return (chaining & (L_OPTIMIZABLE|L_CANNOT_OPTIMIZE)) == L_OPTIMIZABLE; // check was some standards, and no case/recursive
1280
}
1281
1282public void init(ClassFile targetClassFile) {
1283    super.init(targetClassFile);
1284    this.frames = null;
1285    this.currentFrame = null;
1286}
1287public void initializeMaxLocals(MethodBinding methodBinding) {
1288    super.initializeMaxLocals(methodBinding);
1289    StackMapFrame frame = new StackMapFrame();
1290    frame.pc = -1;
1291
1292    if (this.maxLocals != 0) {
1293        int resolvedPosition = 0;
1294        // take into account enum constructor synthetic name+ordinal
1295
final boolean isConstructor = methodBinding.isConstructor();
1296        if (isConstructor) {
1297            frame.putLocal(resolvedPosition, new VerificationTypeInfo(VerificationTypeInfo.ITEM_UNINITIALIZED_THIS, methodBinding.declaringClass));
1298            resolvedPosition++;
1299        } else if (!methodBinding.isStatic()) {
1300            frame.putLocal(resolvedPosition, new VerificationTypeInfo(VerificationTypeInfo.ITEM_OBJECT, methodBinding.declaringClass));
1301            resolvedPosition++;
1302        }
1303
1304        if (isConstructor) {
1305            if (methodBinding.declaringClass.isEnum()) {
1306                frame.putLocal(resolvedPosition, new VerificationTypeInfo(TypeIds.T_JavaLangString, ConstantPool.JavaLangStringConstantPoolName));
1307                resolvedPosition++;
1308                frame.putLocal(resolvedPosition, new VerificationTypeInfo(TypeBinding.INT));
1309                resolvedPosition++;
1310            }
1311
1312            // take into account the synthetic parameters
1313
if (methodBinding.declaringClass.isNestedType()) {
1314                ReferenceBinding enclosingInstanceTypes[];
1315                if ((enclosingInstanceTypes = methodBinding.declaringClass.syntheticEnclosingInstanceTypes()) != null) {
1316                    for (int i = 0, max = enclosingInstanceTypes.length; i < max; i++) {
1317                         // an enclosingInstanceType can only be a reference binding. It cannot be
1318
// LongBinding or DoubleBinding
1319
frame.putLocal(resolvedPosition, new VerificationTypeInfo(enclosingInstanceTypes[i]));
1320                        resolvedPosition++;
1321                    }
1322                }
1323
1324                TypeBinding[] arguments;
1325                if ((arguments = methodBinding.parameters) != null) {
1326                    for (int i = 0, max = arguments.length; i < max; i++) {
1327                        final TypeBinding typeBinding = arguments[i];
1328                        frame.putLocal(resolvedPosition, new VerificationTypeInfo(typeBinding));
1329                        switch(typeBinding.id) {
1330                            case TypeIds.T_double :
1331                            case TypeIds.T_long :
1332                                resolvedPosition += 2;
1333                                break;
1334                            default:
1335                                resolvedPosition++;
1336                        }
1337                    }
1338                }
1339
1340                SyntheticArgumentBinding syntheticArguments[];
1341                if ((syntheticArguments = methodBinding.declaringClass.syntheticOuterLocalVariables()) != null) {
1342                    for (int i = 0, max = syntheticArguments.length; i < max; i++) {
1343                        final TypeBinding typeBinding = syntheticArguments[i].type;
1344                        frame.putLocal(resolvedPosition, new VerificationTypeInfo(typeBinding));
1345                        switch(typeBinding.id) {
1346                            case TypeIds.T_double :
1347                            case TypeIds.T_long :
1348                                resolvedPosition+=2;
1349                                break;
1350                            default:
1351                                resolvedPosition++;
1352                        }
1353                    }
1354                }
1355            } else {
1356                TypeBinding[] arguments;
1357                if ((arguments = methodBinding.parameters) != null) {
1358                    for (int i = 0, max = arguments.length; i < max; i++) {
1359                        final TypeBinding typeBinding = arguments[i];
1360                        frame.putLocal(resolvedPosition, new VerificationTypeInfo(typeBinding));
1361                        switch(typeBinding.id) {
1362                            case TypeIds.T_double :
1363                            case TypeIds.T_long :
1364                                resolvedPosition += 2;
1365                                break;
1366                            default:
1367                                resolvedPosition++;
1368                        }
1369                    }
1370                }
1371            }
1372        } else {
1373            TypeBinding[] arguments;
1374            if ((arguments = methodBinding.parameters) != null) {
1375                for (int i = 0, max = arguments.length; i < max; i++) {
1376                    final TypeBinding typeBinding = arguments[i];
1377                    frame.putLocal(resolvedPosition, new VerificationTypeInfo(typeBinding));
1378                    switch(typeBinding.id) {
1379                        case TypeIds.T_double :
1380                        case TypeIds.T_long :
1381                            resolvedPosition += 2;
1382                            break;
1383                        default:
1384                            resolvedPosition++;
1385                    }
1386                }
1387            }
1388        }
1389    }
1390    try {
1391        this.frames = new ArrayList JavaDoc();
1392        this.frames.add(frame.clone());
1393    } catch (CloneNotSupportedException JavaDoc e) {
1394        e.printStackTrace();
1395    }
1396    this.currentFrame = frame;
1397    this.framePositions = new HashSet JavaDoc();
1398    this.variablesModificationsPositions = new ArrayList JavaDoc();
1399}
1400public void instance_of(TypeBinding typeBinding) {
1401    super.instance_of(typeBinding);
1402    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1403    if (numberOfStackItems >= 1) {
1404        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.INT);
1405    }
1406}
1407protected void invokeAccessibleObjectSetAccessible() {
1408    super.invokeAccessibleObjectSetAccessible();
1409    if (this.currentFrame.numberOfStackItems >= 2) {
1410        this.currentFrame.numberOfStackItems-=2;
1411    }
1412}
1413protected void invokeArrayNewInstance() {
1414    super.invokeArrayNewInstance();
1415    if (this.currentFrame.numberOfStackItems >= 2) {
1416        this.currentFrame.numberOfStackItems--;
1417        this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangObject, ConstantPool.JavaLangObjectConstantPoolName);
1418    }
1419}
1420public void invokeClassForName() {
1421    super.invokeClassForName();
1422    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1423    if (numberOfStackItems >= 1) {
1424        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangClass, ConstantPool.JavaLangClassConstantPoolName);
1425    }
1426}
1427protected void invokeClassGetDeclaredConstructor() {
1428    super.invokeClassGetDeclaredConstructor();
1429    if (this.currentFrame.numberOfStackItems >= 2) {
1430        this.currentFrame.numberOfStackItems--;
1431        this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangReflectConstructor, ConstantPool.JavaLangReflectConstructorConstantPoolName);
1432    }
1433}
1434protected void invokeClassGetDeclaredField() {
1435    super.invokeClassGetDeclaredField();
1436    if (this.currentFrame.numberOfStackItems >= 2) {
1437        this.currentFrame.numberOfStackItems--;
1438        this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangReflectField, ConstantPool.JAVALANGREFLECTFIELD_CONSTANTPOOLNAME);
1439    }
1440}
1441protected void invokeClassGetDeclaredMethod() {
1442    super.invokeClassGetDeclaredMethod();
1443    if (this.currentFrame.numberOfStackItems >= 3) {
1444        this.currentFrame.numberOfStackItems-=2;
1445        this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangReflectMethod, ConstantPool.JAVALANGREFLECTMETHOD_CONSTANTPOOLNAME);
1446    }
1447}
1448public void invokeEnumOrdinal(char[] enumTypeConstantPoolName) {
1449    super.invokeEnumOrdinal(enumTypeConstantPoolName);
1450    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1451    if (numberOfStackItems >= 1) {
1452        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.INT);
1453    }
1454}
1455public void invokeinterface(MethodBinding methodBinding) {
1456    super.invokeinterface(methodBinding);
1457    int argCount = 1;
1458    argCount += methodBinding.parameters.length;
1459    if (this.currentFrame.numberOfStackItems >= argCount) {
1460        this.currentFrame.numberOfStackItems -= argCount;
1461    }
1462    if (methodBinding.returnType != TypeBinding.VOID) {
1463        this.currentFrame.addStackItem(methodBinding.returnType);
1464    }
1465}
1466public void invokeJavaLangAssertionErrorConstructor(int typeBindingID) {
1467    // invokespecial: java.lang.AssertionError.<init>(typeBindingID)V
1468
super.invokeJavaLangAssertionErrorConstructor(typeBindingID);
1469    if (this.currentFrame.numberOfStackItems >= 2) {
1470        this.currentFrame.numberOfStackItems--;
1471        this.currentFrame.initializeReceiver();
1472        this.currentFrame.numberOfStackItems--; // remove the top of stack
1473
}
1474}
1475public void invokeJavaLangAssertionErrorDefaultConstructor() {
1476    super.invokeJavaLangAssertionErrorDefaultConstructor();
1477    if (this.currentFrame.numberOfStackItems >= 1) {
1478        this.currentFrame.initializeReceiver();
1479        this.currentFrame.numberOfStackItems--; // remove the top of stack
1480
}
1481}
1482public void invokeJavaLangClassDesiredAssertionStatus() {
1483    // invokevirtual: java.lang.Class.desiredAssertionStatus()Z;
1484
super.invokeJavaLangClassDesiredAssertionStatus();
1485    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1486    if (numberOfStackItems >= 1) {
1487        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.BOOLEAN);
1488    }
1489}
1490public void invokeJavaLangEnumvalueOf(ReferenceBinding binding) {
1491    // invokestatic: java.lang.Enum.valueOf(Class,String)
1492
super.invokeJavaLangEnumvalueOf(binding);
1493    if (this.currentFrame.numberOfStackItems >= 2) {
1494        this.currentFrame.numberOfStackItems -= 2;
1495        this.currentFrame.addStackItem(binding);
1496    }
1497}
1498public void invokeJavaLangEnumValues(TypeBinding enumBinding, ArrayBinding arrayBinding) {
1499    super.invokeJavaLangEnumValues(enumBinding, arrayBinding);
1500    this.currentFrame.addStackItem(arrayBinding);
1501}
1502public void invokeJavaLangErrorConstructor() {
1503    super.invokeJavaLangErrorConstructor();
1504    if (this.currentFrame.numberOfStackItems >= 2) {
1505        this.currentFrame.numberOfStackItems --;
1506        this.currentFrame.initializeReceiver();
1507        this.currentFrame.numberOfStackItems--; // remove the top of stack
1508
}
1509}
1510public void invokeJavaLangReflectConstructorNewInstance() {
1511    super.invokeJavaLangReflectConstructorNewInstance();
1512    if (this.currentFrame.numberOfStackItems >= 2) {
1513        this.currentFrame.numberOfStackItems--;
1514        this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangObject, ConstantPool.JavaLangObjectConstantPoolName);
1515    }
1516}
1517protected void invokeJavaLangReflectFieldGetter(int typeID) {
1518    super.invokeJavaLangReflectFieldGetter(typeID);
1519    VerificationTypeInfo info = null;
1520    switch (typeID) {
1521        case TypeIds.T_int :
1522            info = new VerificationTypeInfo(TypeBinding.INT);
1523            break;
1524        case TypeIds.T_byte :
1525            info = new VerificationTypeInfo(TypeBinding.BYTE);
1526            break;
1527        case TypeIds.T_short :
1528            info = new VerificationTypeInfo(TypeBinding.SHORT);
1529            break;
1530        case TypeIds.T_long :
1531            info = new VerificationTypeInfo(TypeBinding.LONG);
1532            break;
1533        case TypeIds.T_float :
1534            info = new VerificationTypeInfo(TypeBinding.FLOAT);
1535            break;
1536        case TypeIds.T_double :
1537            info = new VerificationTypeInfo(TypeBinding.DOUBLE);
1538            break;
1539        case TypeIds.T_char :
1540            info = new VerificationTypeInfo(TypeBinding.CHAR);
1541            break;
1542        case TypeIds.T_boolean :
1543            info = new VerificationTypeInfo(TypeBinding.BOOLEAN);
1544            break;
1545        default :
1546            info = new VerificationTypeInfo(TypeIds.T_JavaLangObject, ConstantPool.JavaLangObjectConstantPoolName);
1547            break;
1548    }
1549    if (this.currentFrame.numberOfStackItems >= 2) {
1550        this.currentFrame.numberOfStackItems--;
1551        this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1] = info;
1552    }
1553}
1554protected void invokeJavaLangReflectFieldSetter(int typeID) {
1555    super.invokeJavaLangReflectFieldSetter(typeID);
1556    if (this.currentFrame.numberOfStackItems >= 2) {
1557        this.currentFrame.numberOfStackItems -= 2;
1558    }
1559}
1560public void invokeJavaLangReflectMethodInvoke() {
1561    super.invokeJavaLangReflectMethodInvoke();
1562    if (this.currentFrame.numberOfStackItems >= 3) {
1563        this.currentFrame.numberOfStackItems -= 3;
1564    }
1565}
1566public void invokeJavaUtilIteratorHasNext() {
1567    super.invokeJavaUtilIteratorHasNext();
1568    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1569    if (numberOfStackItems >= 1) {
1570        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.BOOLEAN);
1571    }
1572}
1573public void invokeJavaUtilIteratorNext() {
1574    // invokeinterface java.util.Iterator.next()java.lang.Object
1575
super.invokeJavaUtilIteratorNext();
1576    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1577    if (numberOfStackItems >= 1) {
1578        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangObject, ConstantPool.JavaLangObjectConstantPoolName);
1579    }
1580}
1581public void invokeNoClassDefFoundErrorStringConstructor() {
1582    super.invokeNoClassDefFoundErrorStringConstructor();
1583    if (this.currentFrame.numberOfStackItems >= 2) {
1584        this.currentFrame.numberOfStackItems --;
1585        this.currentFrame.initializeReceiver();
1586        this.currentFrame.numberOfStackItems--; // remove the top of stack
1587
}
1588}
1589public void invokeObjectGetClass() {
1590    super.invokeObjectGetClass();
1591    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1592    if (numberOfStackItems >= 1) {
1593        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangClass, ConstantPool.JavaLangClassConstantPoolName);
1594    }
1595}
1596public void invokespecial(MethodBinding methodBinding) {
1597    super.invokespecial(methodBinding);
1598    // initialize to 0 since we will manually remove 'this'
1599
int argCount = 0;
1600    if (methodBinding.isConstructor()) {
1601        final ReferenceBinding declaringClass = methodBinding.declaringClass;
1602        if (declaringClass.isNestedType()) {
1603            // enclosing instances
1604
TypeBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
1605            if (syntheticArgumentTypes != null) {
1606                argCount += syntheticArgumentTypes.length;
1607            }
1608            // outer local variables
1609
SyntheticArgumentBinding[] syntheticArguments = declaringClass.syntheticOuterLocalVariables();
1610            if (syntheticArguments != null) {
1611                argCount += syntheticArguments.length;
1612            }
1613        }
1614        if (declaringClass.isEnum()) {
1615            argCount += 2;
1616        }
1617        argCount += methodBinding.parameters.length;
1618        if (this.currentFrame.numberOfStackItems >= (argCount + 1)) {
1619            this.currentFrame.numberOfStackItems -= argCount;
1620            this.currentFrame.initializeReceiver();
1621            this.currentFrame.numberOfStackItems--; // remove the top of stack
1622
}
1623    } else {
1624        argCount = 1;
1625        argCount += methodBinding.parameters.length;
1626        if (this.currentFrame.numberOfStackItems >= argCount) {
1627            this.currentFrame.numberOfStackItems -= argCount;
1628        }
1629        if (methodBinding.returnType != TypeBinding.VOID) {
1630            this.currentFrame.addStackItem(methodBinding.returnType);
1631        }
1632    }
1633}
1634public void invokestatic(MethodBinding methodBinding) {
1635    super.invokestatic(methodBinding);
1636    int parametersLength = methodBinding.parameters.length;
1637    if (this.currentFrame.numberOfStackItems >= parametersLength) {
1638        this.currentFrame.numberOfStackItems -= parametersLength;
1639    }
1640    if (methodBinding.returnType != TypeBinding.VOID) {
1641        this.currentFrame.addStackItem(methodBinding.returnType);
1642    }
1643}
1644public void invokeStringConcatenationAppendForType(int typeID) {
1645    super.invokeStringConcatenationAppendForType(typeID);
1646    if (this.currentFrame.numberOfStackItems >= 1) {
1647        this.currentFrame.numberOfStackItems--;
1648    }
1649}
1650public void invokeStringConcatenationDefaultConstructor() {
1651    // invokespecial: java.lang.StringBuffer.<init>()V
1652
super.invokeStringConcatenationDefaultConstructor();
1653    if (this.currentFrame.numberOfStackItems >= 1) {
1654        this.currentFrame.initializeReceiver();
1655        this.currentFrame.numberOfStackItems--; // remove the top of stack
1656
}
1657}
1658public void invokeStringConcatenationStringConstructor() {
1659    super.invokeStringConcatenationStringConstructor();
1660    if (this.currentFrame.numberOfStackItems >= 2) {
1661        this.currentFrame.numberOfStackItems--; // remove argument
1662
this.currentFrame.initializeReceiver();
1663        this.currentFrame.numberOfStackItems--; // remove the top of stack
1664
}
1665}
1666public void invokeStringConcatenationToString() {
1667    super.invokeStringConcatenationToString();
1668    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1669    if (numberOfStackItems >= 1) {
1670        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangString, ConstantPool.JavaLangStringConstantPoolName);
1671    }
1672}
1673public void invokeStringValueOf(int typeID) {
1674    super.invokeStringValueOf(typeID);
1675    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1676    if (numberOfStackItems >= 1) {
1677        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangString, ConstantPool.JavaLangStringConstantPoolName);
1678    }
1679}
1680public void invokeSystemArraycopy() {
1681    super.invokeSystemArraycopy();
1682    if (this.currentFrame.numberOfStackItems >= 5) {
1683        this.currentFrame.numberOfStackItems -= 5;
1684    }
1685}
1686public void invokeThrowableGetMessage() {
1687    super.invokeThrowableGetMessage();
1688    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1689    if (numberOfStackItems >= 1) {
1690        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangString, ConstantPool.JavaLangStringConstantPoolName);
1691    }
1692}
1693public void invokevirtual(MethodBinding methodBinding) {
1694    super.invokevirtual(methodBinding);
1695    int argCount = 1;
1696    argCount += methodBinding.parameters.length;
1697    if (this.currentFrame.numberOfStackItems >= argCount) {
1698        this.currentFrame.numberOfStackItems -= argCount;
1699    }
1700    if (methodBinding.returnType != TypeBinding.VOID) {
1701        this.currentFrame.addStackItem(methodBinding.returnType);
1702    }
1703}
1704public void ior() {
1705    super.ior();
1706    if (this.currentFrame.numberOfStackItems >= 1) {
1707        this.currentFrame.numberOfStackItems--;
1708    }
1709}
1710public void irem() {
1711    super.irem();
1712    if (this.currentFrame.numberOfStackItems >= 1) {
1713        this.currentFrame.numberOfStackItems--;
1714    }
1715}
1716public void ireturn() {
1717    super.ireturn();
1718    if (this.currentFrame.numberOfStackItems >= 1) {
1719        this.currentFrame.numberOfStackItems--;
1720    }
1721    this.framePositions.add(new Integer JavaDoc(this.position));
1722}
1723public void ishl() {
1724    super.ishl();
1725    if (this.currentFrame.numberOfStackItems >= 1) {
1726        this.currentFrame.numberOfStackItems--;
1727    }
1728}
1729public void ishr() {
1730    super.ishr();
1731    if (this.currentFrame.numberOfStackItems >= 1) {
1732        this.currentFrame.numberOfStackItems--;
1733    }
1734}
1735public void istore(int iArg) {
1736    super.istore(iArg);
1737    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1738    if (numberOfStackItems >= 1) {
1739        this.currentFrame.putLocal(iArg, this.currentFrame.stackItems[numberOfStackItems - 1]);
1740        this.currentFrame.numberOfStackItems--;
1741    }
1742}
1743public void istore_0() {
1744    super.istore_0();
1745    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1746    if (numberOfStackItems >= 1) {
1747        this.currentFrame.putLocal(0, this.currentFrame.stackItems[numberOfStackItems - 1]);
1748        this.currentFrame.numberOfStackItems--;
1749    }
1750}
1751public void istore_1() {
1752    super.istore_1();
1753    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1754    if (numberOfStackItems >= 1) {
1755        this.currentFrame.putLocal(1, this.currentFrame.stackItems[numberOfStackItems - 1]);
1756        this.currentFrame.numberOfStackItems--;
1757    }
1758}
1759public void istore_2() {
1760    super.istore_2();
1761    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1762    if (numberOfStackItems >= 1) {
1763        this.currentFrame.putLocal(2, this.currentFrame.stackItems[numberOfStackItems - 1]);
1764        this.currentFrame.numberOfStackItems--;
1765    }
1766}
1767public void istore_3() {
1768    super.istore_3();
1769    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1770    if (numberOfStackItems >= 1) {
1771        this.currentFrame.putLocal(3, this.currentFrame.stackItems[numberOfStackItems - 1]);
1772        this.currentFrame.numberOfStackItems--;
1773    }
1774}
1775public void isub() {
1776    super.isub();
1777    if (this.currentFrame.numberOfStackItems >= 1) {
1778        this.currentFrame.numberOfStackItems--;
1779    }
1780}
1781public void iushr() {
1782    super.iushr();
1783    if (this.currentFrame.numberOfStackItems >= 1) {
1784        this.currentFrame.numberOfStackItems--;
1785    }
1786}
1787public void ixor() {
1788    super.ixor();
1789    if (this.currentFrame.numberOfStackItems >= 1) {
1790        this.currentFrame.numberOfStackItems--;
1791    }
1792}
1793public void l2d() {
1794    super.l2d();
1795    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1796    if (numberOfStackItems >= 1) {
1797        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.DOUBLE);
1798    }
1799}
1800public void l2f() {
1801    super.l2f();
1802    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1803    if (numberOfStackItems >= 1) {
1804        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.FLOAT);
1805    }
1806}
1807public void l2i() {
1808    super.l2i();
1809    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1810    if (numberOfStackItems >= 1) {
1811        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.INT);
1812    }
1813}
1814public void ladd() {
1815    super.ladd();
1816    if (this.currentFrame.numberOfStackItems >= 1) {
1817        this.currentFrame.numberOfStackItems--;
1818    }
1819}
1820public void laload() {
1821    super.laload();
1822    if (this.currentFrame.numberOfStackItems >= 2) {
1823        this.currentFrame.numberOfStackItems--;
1824        this.currentFrame.replaceWithElementType();
1825    }
1826}
1827public void land() {
1828    super.land();
1829    if (this.currentFrame.numberOfStackItems >= 1) {
1830        this.currentFrame.numberOfStackItems--;
1831    }
1832}
1833public void lastore() {
1834    super.lastore();
1835    if (this.currentFrame.numberOfStackItems >= 3) {
1836        this.currentFrame.numberOfStackItems -= 3;
1837    }
1838}
1839public void lcmp() {
1840    super.lcmp();
1841    if (this.currentFrame.numberOfStackItems >= 2) {
1842        this.currentFrame.numberOfStackItems--;
1843        this.currentFrame.stackItems[this.currentFrame.numberOfStackItems - 1] = new VerificationTypeInfo(TypeBinding.INT);
1844    }
1845}
1846public void lconst_0() {
1847    super.lconst_0();
1848    this.currentFrame.addStackItem(TypeBinding.LONG);
1849}
1850public void lconst_1() {
1851    super.lconst_1();
1852    this.currentFrame.addStackItem(TypeBinding.LONG);
1853}
1854public void ldc(float constant) {
1855    super.ldc(constant);
1856    this.currentFrame.addStackItem(TypeBinding.FLOAT);
1857}
1858public void ldc(int constant) {
1859    super.ldc(constant);
1860    this.currentFrame.addStackItem(TypeBinding.INT);
1861}
1862public void ldc(TypeBinding typeBinding) {
1863    super.ldc(typeBinding);
1864    this.currentFrame.addStackItem(typeBinding);
1865}
1866public void ldc2_w(double constant) {
1867    super.ldc2_w(constant);
1868    this.currentFrame.addStackItem(TypeBinding.DOUBLE);
1869}
1870public void ldc2_w(long constant) {
1871    super.ldc2_w(constant);
1872    this.currentFrame.addStackItem(TypeBinding.LONG);
1873}
1874public void ldcForIndex(int index, char[] constant) {
1875    super.ldcForIndex(index, constant);
1876    this.currentFrame.addStackItem(new VerificationTypeInfo(TypeIds.T_JavaLangString, ConstantPool.JavaLangStringConstantPoolName));
1877}
1878public void ldiv() {
1879    super.ldiv();
1880    if (this.currentFrame.numberOfStackItems >= 1) {
1881        this.currentFrame.numberOfStackItems--;
1882    }
1883}
1884public void lload(int iArg) {
1885    super.lload(iArg);
1886    this.currentFrame.addStackItem(getLocal(iArg, this.currentFrame));
1887}
1888public void lload_0() {
1889    super.lload_0();
1890    this.currentFrame.addStackItem(getLocal(0, this.currentFrame));
1891}
1892public void lload_1() {
1893    super.lload_1();
1894    this.currentFrame.addStackItem(getLocal(1, this.currentFrame));
1895}
1896public void lload_2() {
1897    super.lload_2();
1898    this.currentFrame.addStackItem(getLocal(2, this.currentFrame));
1899}
1900public void lload_3() {
1901    super.lload_3();
1902    this.currentFrame.addStackItem(getLocal(3, this.currentFrame));
1903}
1904public void lmul() {
1905    super.lmul();
1906    if (this.currentFrame.numberOfStackItems >= 1) {
1907        this.currentFrame.numberOfStackItems--;
1908    }
1909}
1910public void lookupswitch(CaseLabel defaultLabel, int[] keys, int[] sortedIndexes, CaseLabel[] casesLabel) {
1911    super.lookupswitch(defaultLabel, keys, sortedIndexes, casesLabel);
1912    if (this.currentFrame.numberOfStackItems >= 1) {
1913        this.currentFrame.numberOfStackItems--;
1914    }
1915}
1916public void lor() {
1917    super.lor();
1918    if (this.currentFrame.numberOfStackItems >= 1) {
1919        this.currentFrame.numberOfStackItems--;
1920    }
1921}
1922public void lrem() {
1923    super.lrem();
1924    if (this.currentFrame.numberOfStackItems >= 1) {
1925        this.currentFrame.numberOfStackItems--;
1926    }
1927}
1928public void lreturn() {
1929    super.lreturn();
1930    if (this.currentFrame.numberOfStackItems >= 1) {
1931        this.currentFrame.numberOfStackItems--;
1932    }
1933    this.framePositions.add(new Integer JavaDoc(this.position));
1934}
1935public void lshl() {
1936    super.lshl();
1937    if (this.currentFrame.numberOfStackItems >= 1) {
1938        this.currentFrame.numberOfStackItems--;
1939    }
1940}
1941public void lshr() {
1942    super.lshr();
1943    if (this.currentFrame.numberOfStackItems >= 1) {
1944        this.currentFrame.numberOfStackItems--;
1945    }
1946}
1947public void lstore(int iArg) {
1948    super.lstore(iArg);
1949    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1950    if (numberOfStackItems >= 1) {
1951        this.currentFrame.putLocal(iArg, this.currentFrame.stackItems[numberOfStackItems - 1]);
1952        this.currentFrame.numberOfStackItems--;
1953    }
1954}
1955public void lstore_0() {
1956    super.lstore_0();
1957    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1958    if (numberOfStackItems >= 1) {
1959        this.currentFrame.putLocal(0, this.currentFrame.stackItems[numberOfStackItems - 1]);
1960        this.currentFrame.numberOfStackItems--;
1961    }
1962}
1963public void lstore_1() {
1964    super.lstore_1();
1965    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1966    if (numberOfStackItems >= 1) {
1967        this.currentFrame.putLocal(1, this.currentFrame.stackItems[numberOfStackItems - 1]);
1968        this.currentFrame.numberOfStackItems--;
1969    }
1970}
1971public void lstore_2() {
1972    super.lstore_2();
1973    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1974    if (numberOfStackItems >= 1) {
1975        this.currentFrame.putLocal(2, this.currentFrame.stackItems[numberOfStackItems - 1]);
1976        this.currentFrame.numberOfStackItems--;
1977    }
1978}
1979public void lstore_3() {
1980    super.lstore_3();
1981    int numberOfStackItems = this.currentFrame.numberOfStackItems;
1982    if (numberOfStackItems >= 1) {
1983        this.currentFrame.putLocal(3, this.currentFrame.stackItems[numberOfStackItems - 1]);
1984        this.currentFrame.numberOfStackItems--;
1985    }
1986}
1987public void lsub() {
1988    super.lsub();
1989    if (this.currentFrame.numberOfStackItems >= 1) {
1990        this.currentFrame.numberOfStackItems--;
1991    }
1992}
1993public void lushr() {
1994    super.lushr();
1995    if (this.currentFrame.numberOfStackItems >= 1) {
1996        this.currentFrame.numberOfStackItems--;
1997    }
1998}
1999public void lxor() {
2000    super.lxor();
2001    if (this.currentFrame.numberOfStackItems >= 1) {
2002        this.currentFrame.numberOfStackItems--;
2003    }
2004}
2005public void monitorenter() {
2006    super.monitorenter();
2007    if (this.currentFrame.numberOfStackItems >= 1) {
2008        this.currentFrame.numberOfStackItems--;
2009    }
2010}
2011public void monitorexit() {
2012    super.monitorexit();
2013    if (this.currentFrame.numberOfStackItems >= 1) {
2014        this.currentFrame.numberOfStackItems--;
2015    }
2016}
2017public void multianewarray(TypeBinding typeBinding, int dimensions) {
2018    super.multianewarray(typeBinding, dimensions);
2019    if (this.currentFrame.numberOfStackItems >= dimensions) {
2020        this.currentFrame.numberOfStackItems -= dimensions;
2021    }
2022    char[] brackets = new char[dimensions];
2023    for (int i = dimensions - 1; i >= 0; i--) brackets[i] = '[';
2024    char[] constantPoolName = CharOperation.concat(brackets, typeBinding.constantPoolName());
2025    this.currentFrame.addStackItem(new VerificationTypeInfo(typeBinding.id, constantPoolName));
2026}
2027// We didn't call it new, because there is a conflit with the new keyword
2028
public void new_(TypeBinding typeBinding) {
2029    int pc = this.position;
2030    super.new_(typeBinding);
2031    final VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(VerificationTypeInfo.ITEM_UNINITIALIZED, typeBinding);
2032    verificationTypeInfo.offset = pc;
2033    this.currentFrame.addStackItem(verificationTypeInfo);
2034}
2035public void newarray(int array_Type) {
2036    super.newarray(array_Type);
2037    char[] constantPoolName = null;
2038    switch (array_Type) {
2039        case ClassFileConstants.INT_ARRAY :
2040            constantPoolName = new char[] { '[', 'I' };
2041            break;
2042        case ClassFileConstants.BYTE_ARRAY :
2043            constantPoolName = new char[] { '[', 'B' };
2044            break;
2045        case ClassFileConstants.BOOLEAN_ARRAY :
2046            constantPoolName = new char[] { '[', 'Z' };
2047            break;
2048        case ClassFileConstants.SHORT_ARRAY :
2049            constantPoolName = new char[] { '[', 'S' };
2050            break;
2051        case ClassFileConstants.CHAR_ARRAY :
2052            constantPoolName = new char[] { '[', 'C' };
2053            break;
2054        case ClassFileConstants.LONG_ARRAY :
2055            constantPoolName = new char[] { '[', 'J' };
2056            break;
2057        case ClassFileConstants.FLOAT_ARRAY :
2058            constantPoolName = new char[] { '[', 'F' };
2059            break;
2060        case ClassFileConstants.DOUBLE_ARRAY :
2061            constantPoolName = new char[] { '[', 'D' };
2062            break;
2063    }
2064    int numberOfStackItems = this.currentFrame.numberOfStackItems;
2065    if (numberOfStackItems >= 1) {
2066        this.currentFrame.stackItems[numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangObject, constantPoolName);
2067    }
2068}
2069public void newJavaLangAssertionError() {
2070    int pc = this.position;
2071    super.newJavaLangAssertionError();
2072    final VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangAssertionError, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangAssertionErrorConstantPoolName);
2073    verificationTypeInfo.offset = pc;
2074    this.currentFrame.addStackItem(verificationTypeInfo);
2075}
2076public void newJavaLangError() {
2077    int pc = this.position;
2078    super.newJavaLangError();
2079    final VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangError, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangErrorConstantPoolName);
2080    verificationTypeInfo.offset = pc;
2081    this.currentFrame.addStackItem(verificationTypeInfo);
2082}
2083public void newNoClassDefFoundError() {
2084    int pc = this.position;
2085    super.newNoClassDefFoundError();
2086    final VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangNoClassDefError, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangNoClassDefFoundErrorConstantPoolName);
2087    verificationTypeInfo.offset = pc;
2088    this.currentFrame.addStackItem(verificationTypeInfo);
2089}
2090public void newStringContatenation() {
2091    int pc = this.position;
2092    super.newStringContatenation();
2093    // in 1.6, string concatenation uses StringBuilder
2094
final VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangStringBuilder, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangStringBuilderConstantPoolName);
2095    verificationTypeInfo.offset = pc;
2096    this.currentFrame.addStackItem(verificationTypeInfo);
2097}
2098public void newWrapperFor(int typeID) {
2099    int pc = this.position;
2100    super.newWrapperFor(typeID);
2101    VerificationTypeInfo verificationTypeInfo = null;
2102    switch (typeID) {
2103        case TypeIds.T_int : // new: java.lang.Integer
2104
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangInteger, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangIntegerConstantPoolName);
2105            this.currentFrame.addStackItem(verificationTypeInfo);
2106            break;
2107        case TypeIds.T_boolean : // new: java.lang.Boolean
2108
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangBoolean, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangBooleanConstantPoolName);
2109            this.currentFrame.addStackItem(verificationTypeInfo);
2110            break;
2111        case TypeIds.T_byte : // new: java.lang.Byte
2112
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangByte, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangByteConstantPoolName);
2113            this.currentFrame.addStackItem(verificationTypeInfo);
2114            break;
2115        case TypeIds.T_char : // new: java.lang.Character
2116
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangCharacter, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangCharacterConstantPoolName);
2117            this.currentFrame.addStackItem(verificationTypeInfo);
2118            break;
2119        case TypeIds.T_float : // new: java.lang.Float
2120
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangFloat, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangFloatConstantPoolName);
2121            this.currentFrame.addStackItem(verificationTypeInfo);
2122            break;
2123        case TypeIds.T_double : // new: java.lang.Double
2124
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangDouble, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangDoubleConstantPoolName);
2125            this.currentFrame.addStackItem(verificationTypeInfo);
2126            break;
2127        case TypeIds.T_short : // new: java.lang.Short
2128
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangShort, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangShortConstantPoolName);
2129            this.currentFrame.addStackItem(verificationTypeInfo);
2130            break;
2131        case TypeIds.T_long : // new: java.lang.Long
2132
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangLong, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangLongConstantPoolName);
2133            this.currentFrame.addStackItem(verificationTypeInfo);
2134            break;
2135        case TypeIds.T_void : // new: java.lang.Void
2136
verificationTypeInfo = new VerificationTypeInfo(TypeIds.T_JavaLangVoid, VerificationTypeInfo.ITEM_UNINITIALIZED, ConstantPool.JavaLangVoidConstantPoolName);
2137            this.currentFrame.addStackItem(verificationTypeInfo);
2138    }
2139    if (verificationTypeInfo != null) {
2140        verificationTypeInfo.offset = pc;
2141    }
2142}
2143public void optimizeBranch(int oldPosition, BranchLabel lbl) {
2144    super.optimizeBranch(oldPosition, lbl);
2145    int frameIndex = this.frames.size() - 1;
2146    loop: while(frameIndex > 0) {
2147        StackMapFrame frame = (StackMapFrame) this.frames.get(frameIndex);
2148        if (frame.pc == oldPosition) {
2149            if (this.framePositions.remove(new Integer JavaDoc(oldPosition))) {
2150                this.framePositions.add(new Integer JavaDoc(this.position));
2151            }
2152            if (this.variablesModificationsPositions.remove(new Integer JavaDoc(oldPosition))) {
2153                this.variablesModificationsPositions.add(new Integer JavaDoc(this.position));
2154            }
2155            frame.pc = this.position;
2156            StackMapFrame previousFrame = (StackMapFrame) this.frames.get(frameIndex - 1);
2157            if (previousFrame.pc == this.position) {
2158                // remove the current frame
2159
this.frames.set(frameIndex - 1, frame);
2160                this.frames.remove(frameIndex);
2161            }
2162            break loop;
2163        } else if (frame.pc > oldPosition) {
2164            return;
2165        }
2166        frameIndex--;
2167    }
2168}
2169public void pop() {
2170    super.pop();
2171    if (this.currentFrame.numberOfStackItems >= 1) {
2172        this.currentFrame.numberOfStackItems--;
2173    }
2174}
2175public void pop2() {
2176    super.pop2();
2177    int numberOfStackItems = this.currentFrame.numberOfStackItems;
2178    if (numberOfStackItems >= 1) {
2179        switch(this.currentFrame.stackItems[numberOfStackItems - 1].id()) {
2180            case TypeIds.T_long :
2181            case TypeIds.T_double :
2182                this.currentFrame.numberOfStackItems--;
2183                break;
2184            default:
2185                if (numberOfStackItems >= 2) {
2186                    this.currentFrame.numberOfStackItems -= 2;
2187                }
2188        }
2189    }
2190}
2191public void popStateIndex() {
2192    this.stateIndexesCounter--;
2193}
2194public void pushOnStack(TypeBinding binding) {
2195    super.pushOnStack(binding);
2196    this.currentFrame.addStackItem(binding);
2197}
2198public void putfield(FieldBinding fieldBinding) {
2199    super.putfield(fieldBinding);
2200    if (this.currentFrame.numberOfStackItems >= 2) {
2201        this.currentFrame.numberOfStackItems -= 2;
2202    }
2203}
2204
2205public void pushStateIndex(int naturalExitMergeInitStateIndex) {
2206    if (this.stateIndexes == null) {
2207        this.stateIndexes = new int[3];
2208    }
2209    int length = this.stateIndexes.length;
2210    if (length == this.stateIndexesCounter) {
2211        // resize
2212
System.arraycopy(this.stateIndexes, 0, (this.stateIndexes = new int[length * 2]), 0, length);
2213    }
2214    this.stateIndexes[this.stateIndexesCounter++] = naturalExitMergeInitStateIndex;
2215}
2216public void putstatic(FieldBinding fieldBinding) {
2217    super.putstatic(fieldBinding);
2218    if (this.currentFrame.numberOfStackItems >= 1) {
2219        this.currentFrame.numberOfStackItems--;
2220    }
2221}
2222public void recordExpressionType(TypeBinding typeBinding) {
2223    super.recordExpressionType(typeBinding);
2224    this.currentFrame.setTopOfStack(typeBinding);
2225}
2226public void removeVariable(LocalVariableBinding localBinding) {
2227    this.currentFrame.removeLocals(localBinding.resolvedPosition);
2228    super.removeVariable(localBinding);
2229}
2230public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
2231    int index = this.visibleLocalsCount;
2232    loop : for (int i = 0; i < index; i++) {
2233        LocalVariableBinding localBinding = visibleLocals[i];
2234        if (localBinding != null && localBinding.initializationCount > 0) {
2235            boolean isDefinitelyAssigned = isDefinitelyAssigned(scope, initStateIndex, localBinding);
2236            if (!isDefinitelyAssigned) {
2237                if (this.stateIndexes != null) {
2238                    for (int j = 0, max = this.stateIndexesCounter; j < max; j++) {
2239                        if (isDefinitelyAssigned(scope, this.stateIndexes[j], localBinding)) {
2240                            continue loop;
2241                        }
2242                    }
2243                }
2244                this.currentFrame.removeLocals(localBinding.resolvedPosition);
2245                localBinding.recordInitializationEndPC(position);
2246            }
2247        }
2248    }
2249    Integer JavaDoc newValue = new Integer JavaDoc(this.position);
2250    if (this.variablesModificationsPositions.size() == 0 || !this.variablesModificationsPositions.get(this.variablesModificationsPositions.size() - 1).equals(newValue)) {
2251        this.variablesModificationsPositions.add(newValue);
2252    }
2253    storeStackMapFrame();
2254}
2255public void storeStackMapFrame() {
2256    int frameSize = this.frames.size();
2257    StackMapFrame mapFrame = null;
2258    try {
2259        mapFrame = (StackMapFrame) this.currentFrame.clone();
2260        mapFrame.pc = this.position;
2261    } catch(CloneNotSupportedException JavaDoc e) {
2262        // ignore
2263
}
2264    if (frameSize == 0) {
2265            this.frames.add(mapFrame);
2266    } else {
2267        StackMapFrame lastFrame = (StackMapFrame) this.frames.get(frameSize - 1);
2268        if (lastFrame.pc == this.position) {
2269            this.frames.set(frameSize - 1, mapFrame);
2270        } else {
2271            this.frames.add(mapFrame);
2272        }
2273    }
2274}
2275public void return_() {
2276    super.return_();
2277    this.framePositions.add(new Integer JavaDoc(this.position));
2278}
2279public void saload() {
2280    super.saload();
2281    if (this.currentFrame.numberOfStackItems >= 2) {
2282        this.currentFrame.numberOfStackItems--;
2283        this.currentFrame.replaceWithElementType();
2284    }
2285}
2286public void sastore() {
2287    super.sastore();
2288    if (this.currentFrame.numberOfStackItems >= 3) {
2289        this.currentFrame.numberOfStackItems -= 3;
2290    }
2291}
2292public void sipush(int s) {
2293    super.sipush(s);
2294    this.currentFrame.addStackItem(TypeBinding.INT);
2295}
2296public void store(LocalVariableBinding localBinding, boolean valueRequired) {
2297    super.store(localBinding, valueRequired);
2298    final TypeBinding typeBinding = localBinding.type;
2299    switch(typeBinding.id) {
2300        default:
2301            // Reference object
2302
this.currentFrame.locals[localBinding.resolvedPosition] = new VerificationTypeInfo(typeBinding);
2303    }
2304}
2305public void swap() {
2306    super.swap();
2307    int numberOfStackItems = this.currentFrame.numberOfStackItems;
2308    if (numberOfStackItems >= 2) {
2309        try {
2310            VerificationTypeInfo info = (VerificationTypeInfo) this.currentFrame.stackItems[numberOfStackItems - 1].clone();
2311            VerificationTypeInfo info2 = (VerificationTypeInfo) this.currentFrame.stackItems[numberOfStackItems - 2].clone();
2312            this.currentFrame.stackItems[numberOfStackItems - 1] = info2;
2313            this.currentFrame.stackItems[numberOfStackItems - 2] = info;
2314        } catch (CloneNotSupportedException JavaDoc e) {
2315            // ignore
2316
}
2317    }
2318}
2319public void tableswitch(CaseLabel defaultLabel, int low, int high, int[] keys, int[] sortedIndexes, CaseLabel[] casesLabel) {
2320    super.tableswitch(defaultLabel, low, high, keys, sortedIndexes, casesLabel);
2321    if (this.currentFrame.numberOfStackItems >= 1) {
2322        this.currentFrame.numberOfStackItems--;
2323    }
2324}
2325public void throwAnyException(LocalVariableBinding anyExceptionVariable) {
2326    this.currentFrame.putLocal(anyExceptionVariable.resolvedPosition, new VerificationTypeInfo(VerificationTypeInfo.ITEM_OBJECT, anyExceptionVariable.type));
2327    super.throwAnyException(anyExceptionVariable);
2328    this.currentFrame.removeLocals(anyExceptionVariable.resolvedPosition);
2329}
2330public void removeStackFrameFor(int pos) {
2331    // TODO (olivier) need to see how to get rid of some unnecessary frames
2332
}
2333public void reset(ClassFile givenClassFile) {
2334    super.reset(givenClassFile);
2335    this.frames = null;
2336    this.currentFrame = null;
2337    this.framePositions = null;
2338    this.variablesModificationsPositions = null;
2339}
2340protected void writePosition(BranchLabel label) {
2341    super.writePosition(label);
2342    framePositions.add(new Integer JavaDoc(label.position));
2343}
2344protected void writeWidePosition(BranchLabel label) {
2345    super.writeWidePosition(label);
2346    framePositions.add(new Integer JavaDoc(label.position));
2347}
2348protected void writePosition(BranchLabel label, int forwardReference) {
2349    super.writePosition(label, forwardReference);
2350    framePositions.add(new Integer JavaDoc(label.position));
2351}
2352}
2353
Popular Tags