use JDT again
[eclipsethinslicer.git] / Svelte / log
blob8153164b9c8e5e0749ab419e39d1bf685cbd6443
1 #!/bin/bash
2 if [ -e ~/.log.lock ]
3 then
4 echo ~/.log.lock exists :\(
5 exit
6 else
7 touch ~/.log.lock && nano +99999 ~/log && rm ~/.log.lock && exit
8 fi
10 ---------------------------------------------------------------------
12 CHANGED
13 IRTests.java
14 JavaIRTests.java
16 2007-10-29
17 * Figured out how to get line # from SSA index, Bytecode index
18 * Tried "thin slicing" -- regular slicing with "NO_BASE_PTRS".
19 Didn't really work, put in extra line.
20 * Talked to Bodik, he suggested understanding more about the IR,
21 and possibly thinking of prospective tools that could be useful
22 in understanding the API
23 * Tried some simple examples (THE GLORIOUS MAIN()) to see what
24 IR code it made
25 * Learned about variable numbers & uses and defs, Java method
26 descriptors, some specific IR instructions from above
27 * Tried getting all functions to work (one CallGraph with all
28 functions, without too much luck.) Can choose one function, hackily.
29 * Thought of idea for "tree-view" tool to show where all these
30 objects come from in one particular instance -- what method
31 created them, etc. For example, slice =
32 Slicer.computerBackwardSlice -- show where those args came
33 from, where the args to those methods came from, etc.
34 builder.getPointerAnalysis and builder.makeCallGraph would
35 point down to the same "builder"...
36 * In order to understand more, upon Bodik's suggestion looked
37 for Constant Propagation w/o luck. Found
38 DeadAssignmentElimination and learned about phi instructions,
39 dead phi removal, etc.
41 Misc notes: Ask Bodik if he is aware of Indus, Kaveri
43 2007-10-30
44 * Worked on Arbolico (tree-view tool) to learn more about instructions,
45 analyses. Just looked for get invokespecial instructions (new) and
46 invokevirtual instructions that define something, and added edges to
47 generate a dot graph from that. (A better way is probably to use
48 Eclipse libraries to analyze the source). Kinda worked for simple
49 example, not so good for real-life WALA stuff. Learned a bit
50 about instructions, defs, uses, etc. anyway.
51 * Put slicing test & print instruction in same program
52 to compare, learn more about purpose of FakeRootClass.
53 FakeRootClass sets up constants? (strings?), calls main.
54 arraystore?
55 * Tried to understand how Slicer works. Got lost in
56 SDG/PDG stuff. Read some papers on it, didn't understand
57 much.
58 * Switched gears and tried to learn up on Eclipse plugins
59 (lost/tired...)
60 * Read up a bit on overall Eclipse & Java terms and concepts.
62 2007-10-31
63 * Compared results using "ThinSlicer" against regular slicer and
64 regular size with NO_BASE_PTRS. Same in latter case, but
65 ThinSlicer doesn't get FakeRootClasses.
66 * Reread paper. Realized ThinSlicer is the context-insensitive
67 variant
68 * Running CISlicer, looked at the CISDG and SDG by getting the
69 graph and using dot. The graphs have a lot of extra nodes / edges
70 in them but I pruned it down by grepping for ManusTSlice.
71 It's hard to see what's going on because there are no more variable
72 names -- in fact, statements like w=x and z=x have been optimized
73 out completely.
74 In addition, invokevirtual calls from the new() calls appear
75 to be one node because the names are too short for
76 dot to distinguished (clipped by the dot writer in Wala).
77 Anyway, the problem with thin slicing is that there is an edge
78 in the CISDG from x = new A() to w.f = y (which is really x.f = y,
79 since w, x, and z have been merged to variable '3' in the SSA).
80 Since the statements w=x and z=x no longer exist, this could mean
81 we are following base pointer data dependences (TODO: try more
82 to verify ALL base pointer data dependences are made), even though
83 we are using the options NO_BASE_NO_HEAP (results are the same, at least
84 for the final slice, with just NO_HEAP, which was in ThinSlicer.java
85 originally). For thin slicing with the regular context-sensitive slicer
86 and with CISlicer, slice results are same -- x = new A() is included,
87 but w == z is not, suggesting that at least control dependences are not
88 followed.
89 * Looked at SDG of context-sensitive slice with NO_BASE_PTRS. There is no edge from
90 x = new A() to putfield (GOOD), but there is an edge from x = new A() to
91 getfield (BAD). There is no edge from the conditional branch to v=x.f (GOOD).
92 * Looked at SDG of traditional slice. Lots of interprocedural stuff. But also,
93 edges from x = new A() to putfield (w.f = y, effectively x.f = y) and also from
94 w == z to get v = z.f (effectively x == x and v = x.f). OK.
95 * Looked where ignoreBasePtrs flag is used: in building the PDG.
96 Thought maybe the check wasn't working, but indeed it doesn't add an
97 edge there between the x=new A() and v=x.f (getfield) statements if
98 ignoreBasePtrs is on.
99 * Overrode PDG.addEdge() and looked for the offending edge, but it isn't being
100 added in the PDG evidently. Done after creating the SDG?
102 @Override
103 public void addEdge(Statement src, Statement dst) throws IllegalArgumentException {
104 //if ( dst.getDef() == 7 && dst instanceof SSAGetInstruction ) { System.out.println("oops!"+ dOptions.isIgnoreBasePtrs()); }
105 if ( dst instanceof NormalStatement ) {
106 SSAInstruction use = ((NormalStatement) dst).getInstruction();
107 if ( use.getDef() == 7 && use instanceof SSAGetInstruction ) { System.out.println("oops!"+ dOptions.isIgnoreBasePtrs()); }
110 super.addEdge(src,dst);
113 * Saved SDG graph in CISlicer right after calling SDG().
114 At this stage, the line connecting x=new A() and v=x.f is absent
115 if NO_BASE is included (good) and present if NO_BASE is not included
116 (traditional-like slice, also good). So it seems that in the case of
117 CISlicer the errant arrow is added AFTER this (mod/ref stuff? getfield
118 and putfield not linked before this, maybe this does the pointer analysis
119 stuff, context-insensitively in this case). Maybe this is because
120 ThinSlicer was meant to be used with NO_HEAP, not NO_BASE_NO_HEAP?
121 But why doesn't NO_BASE work with context-sensitive slicer?
122 I really think I should do more testing to see if these are always
123 followed.
125 * Tried weird example:
126 class Main {
127 public static void main ( String args[] ) {
128 A x;
129 x = new A();
130 x.f = new B();
131 WeirdContainer c = new WeirdContainer(x);
132 A a2 = c.getA();
133 System.out.println(a2.f); // seed for now
136 Slice is "x = new A();", "x.f = new B();", and the seed. OK except for x = new A()...
137 Hmm... maybe not so many problems as I thought.
138 * Read about Eclipse plug-in framework.
140 2007-11-01
141 * Wrote summary email to Prof Bodik.
142 * Read some more about Eclipse plugins. Created a plugin
143 with a toolbar action of readme files but I couldn't use the
144 TextSelection class (error about loading it).
145 * Switch gears: investigate more Arbolico
146 * Back to eclipse: figured out TextSelection stuff. Now I want
147 to make it show up on a JavaEditor. Yay! it works!
148 Just like readme example but action is org.eclipse.jdt.ui.internal.
149 * Got back to the ICompilationUnit, thanks to Prospector.
150 * GOt to slide 40 on Reps' presentation (cis.upenn.edu)
152 2007-11-02
153 * Read more of presentation, up to where it seemed irrelevant.
154 * Used JavaSketch to look for ways to get String data out of
155 an editor (given offset and length) w/o much success.
156 String (ICompilationUnit e) {(int), @call 1 ~[org.eclipse.jdt.ui]}
157 -> text is messed up, can't see
158 -> giving int arguments doesn't do anything (?)
159 -> can I restrict by parameter names/types (I want it to use
160 an int offset)?
161 -> I can right click and exclude a method, but it would be
162 useful to exclude a CLASS (in the case of a static call)
163 -> Bug: try
164 String (org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor cue) {(int), @call 1 ~[org.eclipse.jdt.ui]} @(internal)
165 then right click -> exclude constructor
166 DeleteNextSubWordAction everywhere ($ causing problems)
167 -> Try
168 String (org.eclipse.ui.texteditor.AbstractTextEditor cue) {(int)}
169 Gives me all this preference stuff. Can I exclude text from
170 ANYWHERE in the query?
171 * These APIs are too compliated. I never have this many problems
172 doing something this simple in GTK.
173 * Studying JavaSketch Eclipse/UI-related code to learn more
174 about writing Eclipse plugins with use Java source files.
175 * FINALLY found answer to JavaSketch query, just happened upon
176 compilationunit.getSource() in JavaSketch source:
177 String s = cu.getSource().substring(start,end);
179 * Installed cast.java, cast.js. Couldn't get java JUnit tests to work
180 due to java.lang.ClassNotFoundException: com.ibm.wala.cast.java.test.SyncDuplicatorTest
181 * Tried out wala_output/cislictest. The CISlicer did get the
182 extra call that didn't come from y, but two things I don't
183 understand:
184 * Why did the CS thick slicer get stuff related to x?
185 * Why did the CS thick slicer get the calls themselves
186 y=cube(y), etc., whereas the other two didn't? Do
187 these only have control dependencies?
189 public static int cube(int a) {
190 return a*a*a; // all (CS thin, CI thin, CS thick)
193 public static void main(String args[]) {
194 int x = 2;
195 x = x * x; // CI thin slicer, CS thick slicer
196 x = cube(x); // CS thick slicer
197 int y = 7;
198 y = y * y; // all
199 y = cube(y); // CS thick slicer
200 System.out.println(y); // seed
201 y = y+x;
204 2007-11-05
205 * Put a couple things on the wiki (from ir to source line
206 numbers, example slicing code)
207 * Unable to get CAst or Eclipse to work, so trying to look out
208 where opts happenning so we can cut 'em off.
209 * Unable to do that. Posted to wala-wala. Got response:
210 happens in SSABuilder, but impossible to disable
211 because SSAInstruction doesn't support assigments. Updated wiki.
212 If this is the only problem, perhaps we could change SSA?
213 After all, assignment is a simple instruction which really does
214 nothing. It just has one use and one def.
215 * Dave explained to me workings of mods, refs, pointer analysis with
216 regards to SDG creating (links thru the heap), that this is what is
217 being done at second stage of creation in CISDG, hotplugging in the
218 modifications to all abstract objects used to a node to determine
219 predecessor nodes.
220 * Looked up a few more papers describing this; will read them fully later.
221 UsingHeapFlowPointsTo0.ps
222 HeapFlowPointsToInSlicing-HorwitzNew.pdf
223 somewhat:
224 JavaPointsToAnalysis.pdf
225 * Tried to get CAst & Eclipse things working again in a new workspace,
226 drowning in dependencies, then noticed it had no errors on
227 old workspace, magically enough. JUnit test semi-crashed the
228 system, and now CAst & Eclipse projects magically don't work
229 again, but fixed on new workspace ~/walacastwork
230 * Started browsing cast stuff to see how slicing could possibly
231 be done thru this. (Haven't heard from Hsiu-fan yet since I
232 just emailed him this morning).
233 * Made a test case in JavaIRTest.java, but it failed with out
234 of heap space error.
236 2007-11-06
237 * Tried again to get Java CAst IR tests to work w/o success.
238 * Tried reading "Effect Whole-Program Analysis Paper", didn't
239 follow too long, unsure if relevant.
240 * By hijacking JUnit tests, got it to show me the IR thru CAst
241 from a Java file, but that's about it. Tried to do a slice but
242 it didn't work for unknown reason (tried catching all
243 exceptions but that didn't work. Just dies in the middle w/o
244 saying anything.)
245 * Figured out how to get an AST node given length, offset from
246 Eclipse plugin.
247 * Looked at Kaveri code, from this figured out a bit about
248 annotations. Got my eclipse plug-in to annotate some
249 text (e.g. selected text, or parent AST node), by typical
250 error annotations, or by highlighting it in yellow.
252 2007-11-07
253 * Got annotations to come up green on the right bar ("overview
254 ruler"), and with my own icon of the left bar ("vertical
255 ruler"). Need to learn about Eclipse Image managing/disposal.
256 That's good enough for annotations for now (also I should read
257 FAQ book)
258 * Talked to Hsiu-Fan about slicing with CAst. Not too much
259 progress so far, although his CISlicer copies should prove
260 useful once I figure out how to do CS slices.
261 * Posted to newsgroup about using CAst to get a slice.
262 * Was going to try to get CAst to print IR, then find an
263 instruction and take a slice using the instr. index.
264 But then everything hanged -- Simple1 AND MiniaturSliceBug!
265 * Reset computer and tried again, MiniaturSliceBug worked for
266 2 runs but hanged on third, after adding couple lines to
267 test source file... Is test source file too big? Accdng to top,
268 all memory (1GB) used. Probably swapping very slowly?
269 * Rebooted again, no luck. Reduced MiniaturSliceBug.java to
270 a very small trivial program (Hello World), but it STILL hangs.
271 Works for some small programs, but seems to hang with anything
272 with System.out.println() in it.
273 * CI-Thin-Sliced a small program by first getting the
274 instruction index or the seed statement and then going from
275 there. Even got the line numbers in source!
276 * Made an independent project MyFunFunWalaCastSlicingTest,
277 with getStatementFromLineNumber (only works if line
278 number is in the CGNode passed, e.g. main) working.
279 * Copied HelloWorld plugin over into Operation Chao. Getting
280 ready to copy over stuff to make first thin slicing eclipse
281 plugin!
283 2007-11-08
284 * Slicing plug-in works! Kinda.
285 * Switched to Hsiu-Fan's CISlicer to handle problems with
286 ModRef visitors (wouldn't work interprocedurally).
287 * Investigated hanging problem in JavaIRTests. It seems many
288 system library functions (System.out.println,
289 Integer.toHexString) causes problems. Took some stack traces,
290 emailed the newsgroup about it.
291 * Trying to figure out how to get the method of the selected
292 statement -- more precisely, the method descriptor.
293 Getting nowhere on that front.
294 * Get position, including start and end of columns, not just
295 line num, and make annotation with that.
296 * All right, it KINDA works for whatever method you're in now.
297 Just looks thru all CGNodes in the call graph until it finds
298 out with the source position covering the line number.
299 Problems with different files, though...
301 2007-11-09
302 * Updated to latest SVN (Java 6.0 exclusions -- don't hang on
303 CAst analysis).
304 * Couldn't find the exclusions file when running as a plugin.
305 Looked for info on ClassLoader resources, where it's looking
306 for the files, but haven't found anything. Copied exclusions
307 files into the bin directory of the plugin and it worked.
308 * Figure out what class & package you're using for the slice,
309 instead of assuming "Main".
310 * Fix bug including null IR statements in seed statements,
311 causing crash.
312 * Met with Bodik & Hsiu-Fan after lunch.
313 * Looking into why in this case
314 cube(a) {
315 return a*a*a;
318 y = cube(y);
319 System.out.println(y)
320 a*a*a is in the slice but y = cube(y) is not.
321 Don't know why it doesn't look at that, but per Bodik's
322 suggestion I am now looking at what CS Slicer does.
323 * Trying CS slicer with CAst. Have to use AstJavaModRef (?) stuff.
324 * Action buttons for CI Thin, CS Thin, or CS Thick slicing.
325 * Discovered that the reason CS Thick slicing gets too much
326 is probably because of exceptional edges (control may never
327 even reach that point). Just putting a try/catch around stuff
328 makes it kosher. Should definitely be a user-option to ignore
329 exceptional edges (except maybe really "exceptional" cases),
330 probably even a default.
331 * Realized that thick slicing doesn't really get y=cube(y) either,
332 it's just getting it 'cos of the exceptional control edge. This
333 can be seen by adding a try/catch block around "y=cube(y)".
334 Shouldn't y=cube(y) add a data dependency node to anything that
335 uses y? That line definitely affects the value of y...
336 * Found that by changing createScalarDataDependenceEdges in PDG.java
337 if we get rid of this
338 if (!(statement instanceof SSAAbstractInvokeInstruction)) {
339 we can draw data dependencies directly. But then x = f(y) makes it
340 like x depends on y ALWAYS. Even if f(y) doesn't depend on y (e.g.
341 is a constant). Maybe they add another statement to account for this,
342 like that HEAP_PARAM_CALLEE stuff, and just make that define on the var
343 "x", and anything the uses x will add an edge but that will only add an edge
344 back to y thru the function call f so depending on f x may not depend on y.
345 Actually that's gotta be what they do. So the best thing to do is notice
346 the CALLEE stuff and find the function call and add a notation by hand.
347 see pdg-sdg-calls-not-given-in-slice.png on desktop
349 2007-11-13
350 * Get used calls:
351 CI thin slicing: slice contains PARAM_CALLER and PARAM_CALLEE statements.
352 PARAM_CALLER statements have a getCall() method which gives the
353 instruction with the call which needs to be in the slice,
354 which seems to be sufficient to get needed calls.
355 Also have NORMAL_RET_CALLER and NORMAL_RET_CALLEE statements
356 CS thin slicing: slice contains HEAP_PARAM_CALLEE, HEAP_PARAM_CALLER,
357 HEAP_RET_CALLER, HEAP_RET_CALLEE. HEAP_RET_CALLER is sufficient
358 to get call.
359 CS thick slicing: has everything, both PARAM_CALLER and
360 HEAP_RET_CALLER statements.
361 * Added a source to get an inter-compilationunit example running.
362 much work remains to figure out which sources to add.
363 * Check source filename to select lines only in source file. In the future we'd
364 like to keep track of these and add annotations when switching editors.
365 * Tried adding BinaryDirectoryTreeModule for bin directory with class files in. Works.
366 * Looking at EclipseProjectSourceAnalysisEngine in WALA Eclipse stuff.
367 Spent a while doing this, figuring out about engines. Didn't get far.
368 * Went back to using BinaryDirectoryTreeModule only to find it doesn't work
369 (polyglot error). Took a long time to figure out you NEED the exclude line
370 in the exclusions file for it to work (it had mysteriously vanished
371 from the OperationChao/bin directory)
372 * Tried running it on OperationChao, but it opens all WALA files as Java
373 source files and opens too many files.
374 * Fixed this (maybe) by using binary class files for WALA and adding to exclusion
375 file, but now it won't work because Polyglot only supports Java 1.4 and generics
376 (Java 1.5) are heavily used in WALA / my slicer plugin (Operation Chao)
378 2007-11-14
379 * Polyglot5 won't compile with newest polyglot -- looks for classes that
380 no longer exist (API completely changed)
381 * Won't compile if file uses binary nested classes (Bla$Foo.class)
382 * This can be gotten around by importing only base class (Bla) and
383 referring to Foo as Bla.Foo
384 * Now I have the problem "can't find superclass" for the class I'm analyzing
385 * Included that class as source. Now it can't find main in the class.
386 This takes some thinking. Slicing depends on an entrypoint.
387 The entrypoint in real life would probably be something far
388 away. Like in the slicer plugin code. But this is being ignored
389 in the callgraph right now due to the exclusions file. But we must have
390 this exclusions file for binary class files or we get an error (cast from
391 shrike to polyglot or something). So our options are
392 1) do everything from source.
393 would require:
394 2a) converting <generic> stuff before giving to polyglot
395 2b) porting polyglot5 to polyglot 2.3 or porting polyglot 1.3 to WALA
396 2) investigate more and try to use binary classes in call graph alongside CAst
397 3) forget CAst and use shrike
398 4) forget WALA and do our own analyses.
399 Time for some new practice data.
400 * JavaSketch, Kaveri also require Java 5. Let's slice Polyglot 2.3.0.
401 * Running on Polyglot causes stack overflow. Try something (slightly) smaller: gpsylon
402 * Gpslyon causes strange error:
403 com.ibm.wala.util.debug.UnimplementedError: getCAstTypeFor() passed type that is not primitive, array, or class?
404 * Enough of this, I'm looking at JavaSketch code to try & understand some things, such as background processing.
405 * Changed hello world plugin to make a simple job.
406 * Read Reps 90 quite thoroughly up to page 12.
408 2007-11-15
409 * Check filename when looking for method by line number.
410 Probably got wrong method when testing before. Retested
411 GPSylon: stack overflow.
412 * Used binary class files. After adding all the exclusions
413 I finally get an error:
414 com.ibm.wala.util.debug.UnimplementedError: Cannot find super class for <src-class: Lorg/dinopolis/gpstool/Gpsylon$ScaleAction(within Lorg/dinopolis/gpstool/Gpsylon)> in [Ljavax/swing/AbstractAction]
415 I worked around a similar error before by including the superclass .java file in the sources,
416 but this isn't going to work for javax.swing.* classes.
417 This may be worth asking on the mailing list, if we decided to actually use polyglot.
418 * Read up to pg ~18 or 19 in Reps 90. Lost me with the TDP
419 creation stuff.
420 * The three major problems with using Polyglot:
421 1) Only for <= Java 1.4
422 2) Cannot find super class for <src-class: Lcom/example/delmenow/Main> in [Ljavax/swing/AbstractAction]
423 We can't include javax.swing because it's too big.
424 -> Maybe we can get around this -- don't really need/want to look at super class. Talk to Ras -- why would want to look in it
425 for slice? super() / this() calls?
426 3) Stack overflow (for polyglot)
427 -> Investigate. Maybe it's a bug with only one file. Or maybe it's because it's too many files.
428 or for gpsylon:
429 com.ibm.wala.util.debug.UnimplementedError: getCAstTypeFor() passed type that is not primitive, array, or class?
430 -> ???
431 * For 2) found out that we actually CAN include javax.swing and java.awt. Took these out of exclusion file.
432 Tried to slice gpsylon again, but now I get a very strange "error"
434 com.ibm.wala.util.debug.UnimplementedError: found [<Primordial,Ljava/beans/PropertyChangeListener>] interfaces for [Ljava/lang/Object,
435 Ljava/beans/PropertyChangeListener, Lorg/dinopolis/gpstool/GpsylonKeyConstants, Lorg/dinopolis/gpstool/hook/MapNavigationHook,
436 Lorg/dinopolis/gpstool/hook/StatusHook, Lorg/dinopolis/gpstool/util/Positionable] for <src-class: Lorg/dinopolis/gpstool/Gpsylon>
438 is there an error here?
439 * OK, so I investigated this and this is basically a "can't find implemented interface" (like "can't find superclass"). It couldn't
440 find the interfaces not mentioned in the first array. (Why it found one still, I don't know...) So I have to get out
441 org/dinopolis/gpstool of the exclusion file.
442 * Note: ignore 'org\/.*" ignores subpackages
443 * Of course, we all know what happens when we exclude binary files...
444 java.lang.ClassCastException: com.ibm.wala.classLoader.ShrikeClass cannot be cast to com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl$JavaClass
445 * SOLVED! This means it loaded the class whose file we're analyzing not just from source, but also from binary class file.
446 Add it to the exclusions file and we're good.
447 * IT MADE A CALL GRAPH! AND FOUND THE SEED STATEMENTS!! Next error:
448 CI thin slice:
449 java.lang.IllegalArgumentException: I is null
450 at com.ibm.wala.ipa.modref.DelegatingExtendedHeapModel.getPointerKeyForArrayContents(DelegatingExtendedHeapModel.java:71)
451 at com.ibm.wala.ipa.modref.ModRef$ModVisitor.visitNew(ModRef.java:276)
452 at com.ibm.wala.ssa.SSANewInstruction.visit(SSANewInstruction.java:99)
453 at com.ibm.wala.ipa.modref.ModRef.getMod(ModRef.java:340)
454 at com.ibm.wala.cast.java.ipa.slicer.CISlicer.scanForMod(CISlicer.java:100)
455 at com.ibm.wala.cast.java.ipa.slicer.CISlicer.<init>(CISlicer.java:73)
456 at com.ibm.wala.cast.java.ipa.slicer.ThinSlicer.<init>(ThinSlicer.java:39)
457 at com.ibm.wala.cast.java.ipa.slicer.ThinSlicer.<init>(ThinSlicer.java:35)
458 at operationchao.MyFunFunWalaCastSlicingTest.getPositionsOfThinSliceForLineNumInMain(MyFunFunWalaCastSlicingTest.java:427)
459 CS thin slice:
460 java.lang.IllegalArgumentException: I is null
461 at com.ibm.wala.ipa.modref.DelegatingExtendedHeapModel.getPointerKeyForArrayContents(DelegatingExtendedHeapModel.java:71)
462 at com.ibm.wala.ipa.modref.ModRef$ModVisitor.visitNew(ModRef.java:276)
463 at com.ibm.wala.ssa.SSANewInstruction.visit(SSANewInstruction.java:99)
464 at com.ibm.wala.ipa.modref.ModRef.scanNodeForMod(ModRef.java:164)
465 at com.ibm.wala.ipa.modref.ModRef.scanForMod(ModRef.java:131)
466 at com.ibm.wala.ipa.modref.ModRef.computeMod(ModRef.java:72)
467 at com.ibm.wala.ipa.slicer.SDG.<init>(SDG.java:127)
468 * This seems to happen while visiting this instruction:
469 56 = new <Primordial,[Lsun/util/calendar/Era>@352 dims: 1
470 Problem statement is java.util.JapaneseImperialCalendar.<clinit>()V:56 = new <Primordial,[Lsun/util/calendar/Era>@352 dims: 1
471 I love Java. Sure libraries may be big, but all that useful stuff. What would I do with Japanese Imperial Calendar support?
472 Was going to try a test case with just using JapaneseImperialCalendar, but it's a private class. grepped whole workspace for
473 'calendar'... northing. Don't know where this is coming from. Dead end.
474 * Was going to investigate stack overflow but realized it's a DIFFERENT error for gpsylon using all sources...
475 This is crazy. I've seen tens of different kinds of errors. I scratch my head, dig around for a really long time and manage
476 to figure out what they really mean and how to get around (but not really solve) the problem. Then I get another error.
477 The CAst-based slicer works on a stupid tiny test program but it's never going to work on real code. The problem of
478 disappearing "x=y" type things in Shrike is insignificant compared to trying to actually get CAst work on something useful
479 -- much less the fact that it only works for Java <= 1.4.
481 2007-11-16
482 GPSYLON BINARY:
483 * Gives the JapaneseImperialCalendar error wherever I seed the slice from ANYWHERE the Gpsylon class.
484 * Searched source for "calendar", there is some code in other .class files (not the .java file being
485 analyzed) that uses a calendar. Added code to use calendars how they are used there (create them,
486 get the date, set fields) and added to delmenow/Main.java (analyzed) and delmenow/Olvidao.java
487 (in a function used by Main.java / in the slice, included as binary). But slicing this works...
488 POLYGLOT BINARY:
489 * Since I've figured out things since I last tried it (ShrikeClass cast thing), I tried polyglot again
490 using Main.java source but other polyglot files as binaries. This time I get an "out of memory" error.
491 * I somehow got it to make a slice in the main function with added x=x+8 type code!
492 * Trying on some real code isn't working ... can't find seed statement (although it finds the method).
493 Seems to be nondeterministic. If the array it makes to hold the statements is too small (I don't see
494 how that could be because it counts the statements it will take and then takes them), it gets fine to
495 that point. If I make the array bigger, it won't even get to that point, but will be unable to find
496 the seed statements! (I think it's just random.) Finally I made it not add elements to the array if
497 it's not big enough. Then I got a slice (!!!), but it seems to be practically the whole file...
498 * Talked with Ras
499 * Talked with Hsiu-fan about problem with plugin with Windows,
500 JDT AST instead of Polyglot?
501 * Use ArrayList instead of calculating number of slices used then getting them (2 loops)
502 * Talked more with Hsiu-fan. Setting up git repository & installing git.
503 * Talked in again with Ras. Will look up why extra things are getting in the slice.
505 2007-11-19
506 * Analyzing SDGs to figure out what is wrong with the CI slicer.
507 Maybe I don't fully understand the algorithm.
508 In scanForMod(), what does it mean to modify a pointer key?
509 * Learned a bit about git, set up git repository, uploaded stuff.
510 * Dave set up my username on cobol.cs.berkeley.edu CVS server,
511 so I downloaded the packages Manu mentioned. Looking at
512 SDGThinSlicerDriver.java, BugTestInfo.java
513 * (Distacted by Dave's Mozilla compiling issues)
514 * Back to investigating CI Slicer, why it gets the extra
515 "x=new Foo()" line. What does it mean to mod a pointer key?
516 * Realized there is a InstanceFieldKey representing not an
517 abstract object but an abstract object's field.
519 2007-11-20
520 * OK, so I think the issue is that a = new Foo() sets up all the
521 instance field keys and by default modifies all of them.
522 Because after all, it initializes them by creating them (even
523 if it gives them an undefined value). However if they really
524 are initialized in some other way ("int d = 7" in the class
525 definition, or in a constructor, etc.) this is also
526 highlighted already. So Making the a=new Foo() statement
527 modify it is really redundant.
528 * Oops, pointer keys are actually the abstraction of "variables",
529 whereas INSTANCE keys are the abstraction of objects. Makes a
530 bit more sense now. A pointer key is a variable or field of an
531 abstract object.
532 * Thought I found the cause in ModRef.java:286 -- for "new"
533 instructions, it adds all instance field keys as pointer keys
534 that the instructions "mods" or "writes". This can be disabled
535 directly or by setting PDG.IGNORE_ALLOC_HEAP_DEFS to true (may
536 have other side effects in PDG.java) This fixes it for the CS
537 slicer but something more sinister seems to be happening in the
538 CI slicer, in fact, slicing from x.y.z, x = new Foo() is in the
539 slice!
540 * CHANGED in PDG.java:77
541 * It looks like the problem with the CI slicer only happens with
542 the CAst representation... Oops, forgot to change from NO_HEAP
543 to NO_BASE_NO_HEAP in the CAst CISlicer.
544 * Timed the CISlicer. Making the call graph (and I assume also
545 pointer analysis took 5.455 seconds, while *everything* else
546 took 0.237 seconds. Another: CG 5.894, Other 0.203, Total 6.097
547 test code (foo has one bar called f, bar has integers b,c,d):
548 Foo p = new Foo();
549 Foo p2 = p;
550 Bar r = new Bar();
551 p.f = r;
552 Bar z = p2.f;
553 p2.f.d = 3;
555 p2.f.c = 4;
556 z.b = 6;
558 z.d=6;
559 z.d=7;
560 z.d=8;
561 z.d=9;
563 System.out.println(z.d);
564 * CS Thin Slicer: 6.697, 6.993
565 CS Full Slicer: 7.605, 8.004
566 some random variation but call graph always takes up 90%+ of time
567 * Tracing what the call graph builder does.
568 CallGraphBuilder is a
569 com.ibm.wala.cast.java.ipa.callgraph.AstJavaZeroXCFABuilder
570 * Class hierarchy takes 4.730s, buildCallGraph() 1.797
571 Class hierarchy takes 3.600s, buildCallGraph() 1.629
572 * Spent some time trying to get TPTP Eclipse profiler to work...
573 No luck...
574 * Class hierarchy stuff done in
575 JavaSourceAnalysisEngine.buildClassHierarchy()
576 probably loading classes and reading files, other stuff
577 building analyses?
578 Question -- how much of that time is using Polyglot to
579 parse that file?
580 * Ran hprof but that didn't give me much useful...
581 I want something which gives times of every function.
582 I.e. it should show main as 100%.
583 * Ran JIP and got some interesting results (see
584 ~/home/evan/walacastwork/OperationChao/profile.txt,
585 try viewing w/ grep -v '0.. |' profile.txt |less
586 Summary: issues in JavaSourceAnalysisEngine:buildClassHierarchy:
587 * Most of this in ClassLoaderImpl:init (thru PolyglotClassLoaderFactory:makeNewClassLoader)
588 * At least half of this from ClassLoaderImpl:loadAllClasses / ShrikeClass<init> -- loading system .jars etc. I assume.
589 Issues in AbstractAnalysisEngine:buildCallGraph:
590 * All from StandardSolver:solve -> SSAPropagationCallGraphBuilder:unconditionallyAddConstraintsFromNode
591 The profiler is giving me different relative numbers than my own tests gave me
592 (slicing itself is taking longer than the rest!), but I think it is fair so say that both loading
593 the classes and doing the pointer analysis are quite significant bottlenecks.
594 * Working on cleaning up / reorganizing useful parts of slicer plugin
595 to make it more readable/usable/maintainable.
597 2007-11-21
598 * Cleaned up a bit more, reorganized into edu.berkeley.cs.bodik.svelte packages.
599 * Looked back at the Polyglot from source issue. Found out about using 'jlc' in
600 the polyglot distribution to test files. Tested the Grm.java file with this --
601 still gave StackOverFlow error. Narrowed down the problem to big list of
602 concatenated strings ("bla" + "bla" + "bla" + "bla" ...). Passed Java VM arg
603 -Xss1024k to change stack size and jlc worked. 512k, maybe even smaller, ok
604 * Now I have the same problem as I did with analyzing the gpsylon source (full stack trace)
605 !ENTRY org.eclipse.ui 4 0 2007-11-21 13:54:25.099
606 !MESSAGE Unhandled event loop exception
607 !STACK 0
608 com.ibm.wala.util.debug.UnimplementedError: getCAstTypeFor() passed type that is not primitive, array, or class?but type(null)
609 at com.ibm.wala.util.debug.Assertions.UNREACHABLE(Assertions.java:87)
610 at com.ibm.wala.cast.java.translator.polyglot.PolyglotTypeDictionary.getCAstTypeFor(PolyglotTypeDictionary.java:97)
611 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator$JavaTranslatingVisitorImpl.visit(PolyglotJava2CAstTranslator.java:665)
612 at com.ibm.wala.cast.java.translator.polyglot.ASTTraverser.visit(ASTTraverser.java:116)
613 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkNodes(PolyglotJava2CAstTranslator.java:2621)
614 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator$JavaTranslatingVisitorImpl.visit(PolyglotJava2CAstTranslator.java:614)
615 at com.ibm.wala.cast.java.translator.polyglot.ASTTraverser.visit(ASTTraverser.java:112)
616 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkNodes(PolyglotJava2CAstTranslator.java:2621)
617 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator$JavaTranslatingVisitorImpl.visit(PolyglotJava2CAstTranslator.java:1220)
618 at com.ibm.wala.cast.java.translator.polyglot.ASTTraverser.visit(ASTTraverser.java:190)
619 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkNodes(PolyglotJava2CAstTranslator.java:2621)
620 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator$JavaTranslatingVisitorImpl.visit(PolyglotJava2CAstTranslator.java:956)
621 at com.ibm.wala.cast.java.translator.polyglot.ASTTraverser.visit(ASTTraverser.java:162)
622 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkNodes(PolyglotJava2CAstTranslator.java:2621)
623 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator$JavaTranslatingVisitorImpl.visit(PolyglotJava2CAstTranslator.java:280)
624 at com.ibm.wala.cast.java.translator.polyglot.ASTTraverser.visit(ASTTraverser.java:88)
625 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkNodes(PolyglotJava2CAstTranslator.java:2621)
626 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkEntity(PolyglotJava2CAstTranslator.java:2549)
627 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.processClassMembers(PolyglotJava2CAstTranslator.java:2440)
628 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkEntity(PolyglotJava2CAstTranslator.java:2524)
629 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.walkEntity(PolyglotJava2CAstTranslator.java:2516)
630 at com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.translate(PolyglotJava2CAstTranslator.java:2359)
631 at com.ibm.wala.cast.java.translator.Java2IRTranslator.translate(Java2IRTranslator.java:57)
632 at com.ibm.wala.cast.java.translator.polyglot.JavaIRPass.run(JavaIRPass.java:37)
633 at polyglot.frontend.Scheduler.runPass(Scheduler.java:596)
634 at polyglot.frontend.Scheduler.runGoal(Scheduler.java:499)
635 at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:440)
636 at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:412)
637 at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:364)
638 at polyglot.frontend.Scheduler.runToCompletion(Scheduler.java:297)
639 at com.ibm.wala.cast.java.translator.polyglot.PolyglotFrontEnd.compile(PolyglotFrontEnd.java:72)
640 at com.ibm.wala.cast.java.translator.polyglot.PolyglotSourceModuleTranslator.loadAllSources(PolyglotSourceModuleTranslator.java:114)
641 at com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.loadAllSources(JavaSourceLoaderImpl.java:400)
642 at com.ibm.wala.classLoader.ClassLoaderImpl.init(ClassLoaderImpl.java:367)
643 at com.ibm.wala.cast.java.translator.polyglot.PolyglotClassLoaderFactory.makeNewClassLoader(PolyglotClassLoaderFactory.java:40)
644 at com.ibm.wala.classLoader.ClassLoaderFactoryImpl.getLoader(ClassLoaderFactoryImpl.java:66)
645 at com.ibm.wala.classLoader.ClassLoaderFactoryImpl.getLoader(ClassLoaderFactoryImpl.java:64)
646 at com.ibm.wala.ipa.cha.ClassHierarchy.<init>(ClassHierarchy.java:185)
647 at com.ibm.wala.ipa.cha.ClassHierarchy.<init>(ClassHierarchy.java:145)
648 at com.ibm.wala.ipa.cha.ClassHierarchy.make(ClassHierarchy.java:1118)
649 at com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine.buildClassHierarchy(JavaSourceAnalysisEngine.java:151)
650 at com.ibm.wala.client.impl.AbstractAnalysisEngine.defaultCallGraphBuilder(AbstractAnalysisEngine.java:331)
651 at com.ibm.wala.client.impl.AbstractAnalysisEngine.buildDefaultCallGraph(AbstractAnalysisEngine.java:343)
652 at edu.berkeley.cs.bodik.svelte.TempSlicingDriver.getPositionsOfThinSliceForLineNumInMain(TempSlicingDriver.java:257)
653 In this function getCAstTypeFor, polyglotType seems to be null (or .toString() is null?)
654 The last entity walked is "final public polyglot.ast.Branch Break(...)", a function in AbstractNodeFactory_c.java
655 This seems to be the same.
656 * This happens even if I replace the source directory tree module with many
657 Source file modules.
658 * I can't include files as .class files (some error mentioning polyglot, not a .jar or .java file), but
659 I can add some class files to a jar, load the jar and not load the .java file. Doing this for AbstractNodeFactory_c.java
660 Seems to make problems with this files go away. We should still get slice results from this file, but they will not have
661 column information, only line number information.
662 * Now it takes a LONG time to run... I'm killing it... It could be working.
663 * Simplified a test case in which polyglot example fails.
665 2007-11-26 (note: wired ethernet doesn't work, using laptop for online stuff)
666 * Debugged latest Polyglot source test... never stops running.
667 Stopped and found that it was printing a cast node for an assert
668 debugging statement... calculating a string that never gets
669 printed. Many iterations of CAstPrinter.printTo() but it's not
670 a stack overflow / infinite recursion... just takes a long time.
671 Modified assert statement to not call CAstPrinter.print()
672 (...wala.cast.ir.translator.AstTranslator.java:2623
673 * Now I get a stack overflow... increasing to 2048k, now 8192k.
674 * Now I get the same problem as before ... "getCAstTypeFor() passed type that is not primitive, array, or class?"
675 * Adding class file to 'problem classes' jar file, and continuinug...
676 * NullPointerException on MyFunFunWalaCastSlicingTest.java:965 -- can't find the main method
677 * Oops, was using different location of the polyglot source library
678 * GOT A SLICE!!! Not half bad, either.
679 * Reorganizing code. After thinking a little bit, making class SvelteAnalysisEngine
680 * Changing everything to make plugin use SvelteAnalysisEngine. Now can't rind the regression file...
682 2007-11-27
683 * After figuring out bug with loading system jars, got slice of Polyglot with new svelte package.
684 * Get Hsiu-fan's auto-call-graph building from Git.
685 * After merging source bases, it seems the call graph is being build four times! That takes 4 minutes each for Polyglot...
686 * This seems to happen with Hsiu-fan's original version too. Static variables to stop this don't work.
687 * Got new computer today. Plugged in and ran ... need to set up w/ network first, can't have two computers on same network
688 port... I'll keep using this one until we decide which OSs to put on.
689 * Testing on old Main.java test to investigate rebuilding of call graph issue...
690 * Make Auto-cg button a check button
691 * Upload stuff to git
693 2007-11-28
694 * Fixed "one save, multiple resourceChanged callbacks" problem -- kind of -- still runs twice,
695 but does a System.currentTimeMillis() check to prevent building call graph twice.
696 * Tried out cached call graph slicing on Polyglot. Looks good. But now I have to solve the issue
697 of multiple files. Revisiting the issues of markers and annotation.
698 * Use marker with the annotation. No multiple files yet, and we have to delete this.
699 * The changing of markers due to the slicing operation is causing the CG to be rebuilt!
700 * Fixed this, and the earlier "one save, multiple resourceChanged callbacks" -- changed markers
701 were the culprit back then too (when a file is compiled, its markers change, setting off
702 a resource change event). Check that the CONTENT of a .java file has changed.
703 * Markers aren't as persistent as I thought... when I add an error marker it stays,
704 but when I subclass the error marker and make that it doesn't... how useless..
705 * Fixed -- markers now persistent. Using problem markers, but level "info". Shows up
706 in Problems view, under Infos. OK for now.
707 * Figured out how to get a path from a filename string and now multiple files works! Yay!
708 * Going to look at Manu's tests from the paper from SIR. Specifically, the jtopas FAULT_5 test
709 in v1 or jtopas (see jtopas/versions.alt/seeded/v1/src/de/susebox/java/util)
710 * Found the bug and all, but there is no main() ... have to find/look at the JUnit test for the entrypoints.
711 * Make a main which run testLinkParsing(). Change testLinkParsing() to read a test (test5.html for now).
713 2007-11-29
714 * Class hierarchy builds, but cannot find entrypoint AbstractTokenizer.main... oops, had it in wrong class.
715 * Slicing seems to work...
716 * Just noticed that this bug, JTOPAS_1 (jtopas v1 FAULT_5), seems to have the same "seed" and "bug" statements.
717 Trying JTOPAS_2 (jtopas v1 FAULT_6)
718 * Looks like it works as expected... This is kind of a "bug of omission" (setLength instead of setType in test4Normal,
719 then later we check if type==KEYWORD)... I'm not sure what Manu's target "bug" was, but this gets the setType() lexically close.
720 * Looked at EclipseProjectSourceAnalysisEngine, and IClasspasthEntry documentation
721 * Still not exactly sure the best way but wrote code to load analysis scope from Eclipse project class paths.
722 * Looked at nanoxml example... call graph builds nicely, but I don't feel like figuring out how the JUnit test works to make a main()
723 * ant example won't work, can't find import org.apache.bcel.classfile.* in org/apache/tools/ant/filters/util/JavaClassHelper.java (v7) ...
724 Manu's test .jar doesn't even have this file...
725 * Working on making my code general enough to support Shrike OR CAst. Slight problem: can't get source filename from a Shrike Method
726 (thus a statement in the slice). Will have to record class name and use something to get the source filename from that.
727 * Get filename from classname by looking thru sources for the presumed filename (Lcom/example/delmenow/Olvidao$Foo ->
728 com/example/delmenow/Olvidao.java) Cheap, but works. Need hashtable in future.
729 * Yay! Shrike OR CAst slicing from the plug-in!
731 2007-11-30
732 * Cache on a project basis. Now we can start slice from different file than main()
733 * Shrike or CAst button to switch off. Fix bug in CAst slicing that way.
734 * Seems like more statements in slices now with CAst...?
735 * Used git to go back and check.... Yea, less slices before. Investigating...
736 * Fixed bug -- conditionals and gotos can cover more than one line. So it was getting way more
737 statements in the seed (it looks for seed statements by comparing line numbers)
738 * Fixed bug in which cache not being rebuilt on re-save.
739 * Small test that slice from different file works and gets things in other files.
740 * Started "Call Graph in its own job" thing
742 2007-12-03
743 * Fix "Call Graph in its own job"
744 * Read up about launch configurations. We can use these to determine the entrypoint for building a call graph.
745 * If the Java file which induces the call graph building isn't mentioned as a main class in a launch configuration,
746 use a main class that is. I'd really like to do exactly what clicking on the run and debug buttons do, and get a
747 list of launch configurations equivalent to it's drop-down menu from the toolbar.
748 * Trying to slice with old version slicing plugin with Shrike. Didn't seem to give any errors
749 when not loading WALA libraries! Seems like it should, since they are used in the project. Gives slice,
750 but of course doesn't include any WALA code.
751 * Added code for Eclipse classpath project dependencies so bin/ directories of WALA would be incuded. Takes only 36 sec
752 to build class hierarchy, but then gives out of memory error later on in building call graph.
753 * Added Eclipse libs to exclusion file. Takes 12 sec to build class hierarchy. Call graph builds. Slice still doesn't
754 seem to take any WALA code into account. hmmm...
755 * Maybe I was chooisng a bad seed statement... Choosing a different got me a slice with over 65,000 statements (too
756 many to see with present marker code...)
757 * Changed slightly to get an intersting seed statement that works:
758 CallGraph cg = engine.buildDefaultCallGraph();
759 System.out.println(cg); // seed here
760 This gets a slice with 11 statements (many duplicates), in this file and 3 WALA files.
761 It correctly figures out that the CallGraphBulider is a PropagationCallGraphBuilder, traces
762 the flow of variable callgraph thru from the return statement of makeCallGraph() to its
763 assignment in the constructor, etc.
764 * Got line numbers for seed & bug statements of Manu's benchmarks by modifying his sanity check program,
765 but they are near useless because I don't have the source they came from... Tried just running cpp to
766 add the fault for jtopas, but the line number is off by 6 lines... Also, ant fault DF_HD_1 doesn't work:
767 com.ibm.wala.util.debug.UnimplementedError: couldn't find node for method Node: < Application, Lorg/apache/tools/ant/taskdefs/Definer, setName(Ljava/lang/String;)V > Context: Everywhere
768 * Decided to look a JTopas test a little closer using the Sanity Check program. Strangely, Manu's bug statement is
769 recorded as the conditional branch:
770 if (prop != null) {
771 // token.setType(Token.KEYWORD);
772 // FAULT_6
773 token.setLength(Token.KEYWORD);
774 } else {
775 token.setType(Token.NORMAL);
777 I wonder if he taught it to follow a control dependency back?
778 * Prevent multiple workspasce builds / resourceChanged calls by using a IWorkspaceRunnable to add all markers in 1 batch
779 * Looking more into converting line + col numbers into offset numbers. I think I want/need a ILineTracker.
780 It looks like when I add a marker with an offset it doesn't give me a line number in the list of "problems", just says
781 Location: Unknown. You can add a line number and i will show up but it doesn't have to match up with the offset
782 numbers. I wonder if compile errors use both line and offset numbers to show both line number and exact position?
783 * I think our basic options are:
784 1) show only line numbers (disappointing)
785 2) open every source file we want column/offset numbers for and use a line tracker (slow)
786 3) show only line numbers for the time being, but make a hook for when opening
787 a file, use the linetracker (aassuming it is created) and modify all the markers.
788 this is kind of a hack, but has the upside that in the future we may want to do
789 other things here, like link back to an eclipse AST node.
790 4) modify WALA/Polyglot? to give offsets instead of/as well as columns (might not be too bad)
791 -> hmm, can't find this in the code... all 2 of the anon classes "new AbstractSourcePosition() {}"
792 are unused (?!) and the other has identical first and last line/col.
794 2007-12-04
795 * Slicing itself in a job
796 * Looking up about cancelling. CancelException / MonitorUtil not used much throughout WALA yet.
797 * Updating WALA from SVN to see if CancelException used more now. No, not really. Doesn't look like it.
798 Maybe I should wait.
799 * Looking into locking of resources and issues related to concurrency.
800 * Slicing and call graph building now lock main project. Works, but more thinking may need to be done.
801 At least now I can't make a slice using a call graph for the project is being built.
802 * Don't show duplicate line numbers -- on slicing, make a hash table with (lineno + " " + filename)
803 * Looked into issue of getting back copies, like "y=x". Tried undoing copy propagation with with
804 SSAConversion.undoCopyPropagation(). This makes new variable numbers and adds assignment instructions
805 which use them into the IR... but slicing after this doesn't work (DefUse's uses[] variable isn't updated,
806 tries to access out of bounds index for newly created variable...) I added a hack which makes new DefUses
807 for the changed CGNodes... this doesn't stop the slicer from working right if the node's IR is unmodified,
808 but it still doesn't work (just null slice) when taking a slice after doing this after undoing copy prop.
809 * Changed saving to build once for each project in which files have changed... But it seems not to matter,
810 since "Save All" saves files one by one, individually, anyway.
811 * Trying to slice the int = pos.getFirstCol(); doesn't enter function getFirstCol -- why?
812 private static void addStatement(Statement s, int rv[][], int i)
814 if (s != null && s.getKind() == Statement.Kind.NORMAL && s.getNode().getMethod() instanceof ConcreteJavaMethod) {
815 // ignore special kinds of statements
816 int instructionIndex = ((NormalStatement) s).getInstructionIndex();
817 Position pos = ((ConcreteJavaMethod) s.getNode().getMethod()).getSourcePosition(instructionIndex);
818 rv[i][0] = pos.getFirstLine();
819 rv[i][1] = pos.getFirstCol();
820 rv[i][2] = pos.getLastLine();
821 rv[i][3] = pos.getLastCol();
822 int x = pos.getFirstCol();
823 System.out.println(x);
826 Was hoping it would shed light on where Position is coming from. Instead pretty much useless. gets a bunch of random stuff.
827 Doesn't include the function getFirstCol() in that actual class (PolyglotSourcePosition)
828 Going outside of function and slicing from "rv" brings up more junk. Taking slice from x = pos.getFirstCol() gives almost nothing (looking at just pos)
830 2007-12-05
831 * Changed Position and PolyglotSourcePosition to give an offset, but Polyglot isn't giving an offset!
832 (what did: just changed Position interface to have getFirstOffset() and getLastOffset() functions,
833 then fixed errors -- all classes that didn't implement it -- mostly just return -1, except PolyglotSourcePosition
834 should return p.offset() and p.endOffset())
835 * Changed Polyglot to give an offset. Had to change JFlex directive. In java.flex
836 --- java.flex.old 2007-12-05 10:03:25.000000000 -0800
837 +++ java.flex 2007-12-05 09:46:13.000000000 -0800
838 @@ -32,6 +32,7 @@
840 %line
841 %column
842 +%char
844 %state STRING, CHARACTER, TRADITIONAL_COMMENT, END_OF_LINE_COMMENT
846 @@ -113,7 +114,7 @@
848 private Position pos() {
849 return new Position(path, file, yyline+1, yycolumn, yyline+1,
850 - yycolumn + yytext().length());
851 + yycolumn + yytext().length(), yychar, yychar + yytext().length());
854 private Position pos(int len) {
855 * Move SvelteExclusions.xml to a dat/ directory. Hopefully it'll stay put here.
856 * Email Polyglot mailing list about patch.
857 * Change presentationLayer attribute to a higiher layer so occurence markers (grey highlight) won't cover up slice markers (in body & vertical ruler)
858 * Change default annotation to a box; don't remove duplicate per line for CAst (offset information)
859 * After a bit of thinking & investigating: for each invoke instruction used as a seed, don't use that instruction but use the return instruction corresponding to
860 that call site. Before, seeding a slice with something like "x = foo()" wouldn't bring up anything, because no variables are USED in the instruction.. Now it
861 the variable used is the output of the function (the same as x)
862 * Don't use source positions until the end... show more information in message for each slice statement -- whether seed or not, also full statement code