01: /* Soot - a J*va Optimization Framework
02: * Copyright (C) 1997-1999 Raja Vallee-Rai
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the
16: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17: * Boston, MA 02111-1307, USA.
18: */
19:
20: package soot.jbco.bafTransformations;
21:
22: import soot.jbco.IJbcoTransform;
23: import java.util.*;
24: import soot.tagkit.*;
25: import soot.*;
26: import soot.baf.*;
27:
28: public class BafLineNumberer extends BodyTransformer implements
29: IJbcoTransform {
30: public void outputSummary() {
31: }
32:
33: public String[] getDependancies() {
34: return new String[] { "bb.jbco_bln" };
35: }
36:
37: public String getName() {
38: return "bb.jbco_bln";
39: }
40:
41: protected void internalTransform(Body b, String phaseName,
42: Map options) {
43: int idx = 0;
44: PatchingChain units = b.getUnits();
45: Iterator it = units.iterator();
46: while (it.hasNext()) {
47: Inst i = (Inst) it.next();
48: List tags = i.getTags();
49: for (int k = 0; k < tags.size(); k++) {
50: Tag t = (Tag) tags.get(k);
51: if (t instanceof LineNumberTag) {
52: tags.remove(k);
53: break;
54: }
55: }
56: if (i instanceof IdentityInst)
57: continue;
58: i.addTag(new LineNumberTag(idx++));
59: }
60: }
61: }
|