import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
import Analysis.CallGraph.CallGraph;
+import Analysis.Loops.GlobalFieldType;
import Analysis.Loops.LoopOptimize;
import Analysis.Loops.LoopTerminate;
import IR.AnnotationDescriptor;
import IR.Descriptor;
import IR.MethodDescriptor;
import IR.State;
+import IR.SymbolTable;
import IR.TypeUtil;
import IR.Flat.BuildFlat;
import IR.Flat.FlatMethod;
}
public void doCheck() {
- doMethodAnnotationCheck();
+ doMethodAnnotationCheck();
// computeLinearTypeCheckMethodSet();
// doLinearTypeCheck();
// if (state.SSJAVADEBUG) {
// parseLocationAnnotation();
// doFlowDownCheck();
// doDefinitelyWrittenCheck();
+ debugDoLoopCheck();
+ }
+
+ private void debugDoLoopCheck() {
+ GlobalFieldType gft = new GlobalFieldType(callgraph, state, tu.getMain());
+ LoopOptimize lo = new LoopOptimize(gft, tu);
+
+ SymbolTable classtable = state.getClassSymbolTable();
+
+ List<ClassDescriptor> toanalyzeList = new ArrayList<ClassDescriptor>();
+ List<MethodDescriptor> toanalyzeMethodList = new ArrayList<MethodDescriptor>();
+
+ toanalyzeList.addAll(classtable.getValueSet());
+ Collections.sort(toanalyzeList, new Comparator<ClassDescriptor>() {
+ public int compare(ClassDescriptor o1, ClassDescriptor o2) {
+ return o1.getClassName().compareTo(o2.getClassName());
+ }
+ });
+
+ for (int i = 0; i < toanalyzeList.size(); i++) {
+ ClassDescriptor cd = toanalyzeList.get(i);
+
+ SymbolTable methodtable = cd.getMethodTable();
+ toanalyzeMethodList.clear();
+ toanalyzeMethodList.addAll(methodtable.getValueSet());
+ Collections.sort(toanalyzeMethodList, new Comparator<MethodDescriptor>() {
+ public int compare(MethodDescriptor o1, MethodDescriptor o2) {
+ return o1.getSymbol().compareTo(o2.getSymbol());
+ }
+ });
+
+ for (int mdIdx = 0; mdIdx < toanalyzeMethodList.size(); mdIdx++) {
+ MethodDescriptor md = toanalyzeMethodList.get(mdIdx);
+ if (needTobeAnnotated(md)) {
+ lo.analyze(state.getMethodFlat(md));
+ doLoopTerminationCheck(lo, state.getMethodFlat(md));
+ }
+ }
+
+ }
+
}
public void addTrustMethod(MethodDescriptor md) {
}
public void doLoopTerminationCheck(LoopOptimize lo, FlatMethod fm) {
- LoopTerminate lt = new LoopTerminate(this,state);
+ LoopTerminate lt = new LoopTerminate(this, state);
if (needTobeAnnotated(fm.getMethod())) {
lt.terminateAnalysis(fm, lo.getLoopInvariant(fm));
}
tmp = -x;
else
tmp = x;
+ TERMINATE:
do {
tmp = tmp / 10;
length = length + 1;
} else
voffset = 0;
+ TERMINATE:
do {
chararray[--length + voffset] = (char) (x % 10 + '0');
x = x / 10;
tmp = -x;
else
tmp = x;
+
+ TERMINATE:
do {
tmp = tmp / 10;
length = length + 1;
} else
voffset = 0;
+ TERMINATE:
do {
chararray[--length + voffset] = (char) (x % 10 + '0');
x = x / 10;
\r
@LOC("THIS,BitReserve.BIT") int pos = buf_byte_idx;\r
if (pos + N < BUFSIZE) {\r
+ TERMINATE:\r
while (N-- > 0) {\r
val <<= 1;\r
val |= ((buf[pos++] != 0) ? 1 : 0);\r
}\r
} else {\r
+ TERMINATE:\r
while (N-- > 0) {\r
val <<= 1;\r
val |= ((buf[pos] != 0) ? 1 : 0);\r
m = 0;
for (@LOC("THIS,LayerIIIDecoder.NS") int i = 0; i < 4; i++) {
- for (@LOC("THIS,LayerIIIDecoder.NS") int j = 0; j < nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++) {
+ int jmax=nr_of_sfb_block[blocknumber][blocktypenumber][i];
+ for (@LOC("THIS,LayerIIIDecoder.NS") int j = 0; j < jmax; j++) {
scalefac_buffer[m] = (new_slen[i] == 0) ? 0 : br.hgetbits(new_slen[i]);
m++;
index = 0;
// Read bigvalues area
+ TERMINATE:
for (@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i +=
2) {
// h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];
num_bits = br.hsstell();
+ TERMINATE:
while ((num_bits < part2_3_end) && (index < 576)) {
huffcodetab.huffman_decoder(htIdx, x, y, v, w, br);
for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
@LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
sfbcnt = 2;
+ TERMINATE:
for (sfb = 12; sfb >= 3; sfb--) {
i = sfBandIndex[sfreq].s[sfb];
lines = sfBandIndex[sfreq].s[sfb + 1] - i;
i = (i << 2) - i + (j + 1) * lines - 1;
-
+ TERMINATE:
while (lines > 0) {
if (ro[1][i / 18][i % 18] != 0.0f) {
// MDM: in java, array access is very slow.
sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
i = (temp << 2) - temp + j * sb;
+ TERMINATE:
for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].s[j][sfb];
if (is_pos[i] != 7)
temp = sfBandIndex[sfreq].s[11];
sb = sfBandIndex[sfreq].s[12] - temp;
i = (temp << 2) - temp + j * sb;
-
+ TERMINATE:
for (; sb > 0; sb--) {
is_pos[i] = is_pos[sfb];
i = 2;
ss = 17;
sb = -1;
+ TERMINATE:
while (i >= 0) {
if (ro[1][i][ss] != 0.0f) {
sb = (i << 4) + (i << 1) + ss;
i = sfBandIndex[sfreq].l[i];
for (; sfb < 8; sfb++) {
sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
+ TERMINATE:
for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].l[sfb];
if (is_pos[i] != 7)
for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
@LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
sfbcnt = -1;
+ TERMINATE:
for (sfb = 12; sfb >= 0; sfb--) {
temp = sfBandIndex[sfreq].s[sfb];
lines = sfBandIndex[sfreq].s[sfb + 1] - temp;
i = (temp << 2) - temp + (j + 1) * lines - 1;
-
+ TERMINATE:
while (lines > 0) {
if (ro[1][i / 18][i % 18] != 0.0f) {
// MDM: in java, array access is very slow.
temp = sfBandIndex[sfreq].s[sfb];
sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
i = (temp << 2) - temp + j * sb;
+ TERMINATE:
for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].s[j][sfb];
if (is_pos[i] != 7)
sfb = (temp << 2) - temp + j * sb;
sb = sfBandIndex[sfreq].s[12] - temp2;
i = (temp2 << 2) - temp2 + j * sb;
-
+ TERMINATE:
for (; sb > 0; sb--) {
is_pos[i] = is_pos[sfb];
i = 31;
ss = 17;
sb = 0;
+ TERMINATE:
while (i >= 0) {
if (ro[1][i][ss] != 0.0f) {
sb = (i << 4) + (i << 1) + ss;
i = sfBandIndex[sfreq].l[i];
for (; sfb < 21; sfb++) {
sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
+ TERMINATE:
for (; sb > 0; sb--) {
is_pos[i] = scalefac[1].l[sfb];
if (is_pos[i] != 7)
}
}
sfb = sfBandIndex[sfreq].l[20];
+ TERMINATE:
for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0) && (i < 576); sb--) {
is_pos[i] = is_pos[sfb]; // error here : i >=576
@RETURNLOC("T")\r
public boolean play(@LOC("IN") int frames) throws JavaLayerException {\r
@LOC("T") boolean ret = true;\r
-\r
- SSJAVA: while (frames-- > 0 && ret) {\r
+ \r
+ int maxFrame=frames-1;\r
+ int count=0;\r
+ SSJAVA: while (count++ < maxFrame) {\r
ret = decodeFrame();\r
+ if(!ret){\r
+ break;\r
+ }\r
}\r
\r
/*\r
@LOC("C") int sum = 0;\r
@LOC("C") short[] outbuf = SampleBufferWrapper.getBuffer();\r
// short[] outbuf = output.getBuffer();\r
+ TERMINATE:\r
for (@LOC("C") int i = 0; i < SampleBufferWrapper.getBufferLength(); i++) {\r
// System.out.println(outbuf[i]);\r
sum += outbuf[i];\r
}\r
\r
public void input_samples(@LOC("IN") float[] s) {\r
+ TERMINATE:\r
for (@LOC("C") int i = 31; i >= 0; i--) {\r
samples[i] = s[i] * eq[i];\r
}\r
* \r
* int bits[] = bitbuf;\r
*/\r
- do {\r
+ TERMINATE: do {\r
if (ht[htIdx].val[point][0] == 0) { /* end of tree */\r
x[0] = ht[htIdx].val[point][1] >>> 4;\r
y[0] = ht[htIdx].val[point][1] & 0xf;\r
*/\r
// if (bits[bitIndex++]!=0)\r
if (br.hget1bit() != 0) {\r
- while (ht[htIdx].val[point][1] >= MXOFF)\r
+ TERMINATE: while (ht[htIdx].val[point][1] >= MXOFF)\r
point += ht[htIdx].val[point][1];\r
point += ht[htIdx].val[point][1];\r
} else {\r
- while (ht[htIdx].val[point][0] >= MXOFF)\r
+ TERMINATE: while (ht[htIdx].val[point][0] >= MXOFF)\r
point += ht[htIdx].val[point][0];\r
point += ht[htIdx].val[point][0];\r
}\r