[Soot-list] Jimplifying unreferenced methods
Martin Gade Hyldgaard
pb98 at mip.sdu.dk
Mon Aug 21 07:48:56 EDT 2006
Hello all,
I am trying to construct a Java to C compiler with focus on compiling to
embedded devices, using Jimple as an intermediate language. I am working
on Jimple through a SceneTransformer. In this work I am replacing some
classes (eg. java.lang.Object) with my own classes before translation. The
problem I have run into with this approach is that theese 'replacing
classes' are not reachable, and it seems as such Soot does not have a
Jimple Body for them.
I have forced inclusion of the package I need with '-dynamic-package'
argument, and used '-p cg.spark pre-jimplify' to make sure the bodies are
loaded.
This takes much longer than before though, and have recently given me some
new problems. For visualization of the program I made a small awt GUI, as
the embedded device I am currently working with flash some LEDs ect. This
GUI should not be translated. Using awt has given me errors when using the
pre-jimplify option though, and I have not found a way to skip analysis of
awt components altogether (tried '-x javax')
So: can I force Soot to jimplify methods in a package (but not the entire
program), even though they are not referenced from any method in the
program I work on?
Another question:
Can I place a SceneTransformer after all other optimizations have taken
place?
Or just get to work on the Scene after optimization, Soot seems to release
the method bodies when it is done with them. Right now my program does not
benefit from the optimizations done by Soot in the BodyTransformers.
-Martin
---- The Error I get when using pre-jimplification and awt components
(Soot release 2.2.3) ----
Exception in thread "main" java.lang.RuntimeException: This operation
requires resolving level HIERARCHY but java/awt/Component; is at resolving
level DANGLING
at soot.SootClass.checkLevel(SootClass.java:126)
at soot.FastHierarchy.canStoreClass(FastHierarchy.java:269)
at soot.FastHierarchy.canStoreType(FastHierarchy.java:204)
at soot.FastHierarchy.canStoreType(FastHierarchy.java:250)
at
soot.jimple.spark.internal.TypeManager.castNeverFails(TypeManager.java:115)
at
soot.jimple.spark.internal.TypeManager.makeTypeMask(TypeManager.java:94)
at
soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:60)
at soot.SceneTransformer.transform(SceneTransformer.java:39)
at soot.Transform.apply(Transform.java:89)
at soot.RadioScenePack.internalApply(RadioScenePack.java:60)
at
soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:40)
at soot.Pack.apply(Pack.java:110)
at soot.PackManager.runWholeProgramPacks(PackManager.java:375)
at soot.PackManager.runPacks(PackManager.java:321)
at soot.Main.run(Main.java:203)
at soot.Main.main(Main.java:146)
at j2c.test.main(test.java:55)
More information about the Soot-list
mailing list