[Soot-list] ClassCastException while reading in fop class

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Mon Nov 2 16:27:42 EST 2009


I think I was able to track this down a bit. The bug seems to be not
in the code of any of the type assigners but rather in the code that
re-associates local variables with their names. For instance, the
variable "temp" gets mistakenly broken down into two different
variables. The resulting Jimple code initializes the one variable and
then uses the other. When the type assigner hits the use of the second
variable, it therefore finds this variable undefined (bottom type).

Eric

--
Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



2009/11/2 David Mohr <dmohr at cs.unm.edu>:
> On Mon, Nov 2, 2009 at 10:50 AM, Eric Bodden
> <bodden at st.informatik.tu-darmstadt.de> wrote:
>> Thanks David.
>>
>> I am now able to reproduce the problem. Interestingly, the older type
>> assigner (enabled via "-p jb.tr use-older-type-assigner") fails on
>> this class, too. I had a look at the code and it seems to be using
>> lots of bit shifting and arrays. It may be the combination of both
>> that confuses the type assigner:
>>
>> http://kickjava.com/src/org/apache/fop/image/BmpImage.java.htm
>>
>> What cofuses me is that I have used Soot before to processed DaCapo
>> and I have never seen this problem before. Apparently, it is only
>> caused by that particular version of the benchmark.
>
> I compiled that version of the benchmark myself, but from unmodified
> sources. I just tested it with the official binary jar, which does
> indeed work without throwing an exception.
>
> I don't really have enough knowledge of the Soot internals to figure
> this out, but if anyone wants to have a go at it, I've added some
> additional info at
>  http://digamma.cs.unm.edu/~dmohr/soot-bmpimage/
> Like the javap -c output of both versions of the class, the original
> .class file, and the source file from which my version was compiled.
>
> The javap output of both classes is quite different, which made it
> difficult to compare for me.
>
> ~David
>
>> Eric
>>
>> --
>> Eric Bodden
>> Software Technology Group, Technische Universität Darmstadt, Germany
>> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
>> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>>
>>
>>
>> 2009/11/2 David Mohr <dmohr at cs.unm.edu>:
>>> On Wed, Oct 28, 2009 at 1:33 AM, Eric Bodden
>>> <bodden at st.informatik.tu-darmstadt.de> wrote:
>>>> Thanks David for the error report. Would it be possible to still send
>>>> us a link to the exact fop JAR file that you are using? (the TAR only
>>>> contains the support JARs from what I can see)
>>>
>>> Yes, of course.
>>>
>>> You can grab the dacapo jar at:
>>>  http://digamma.cs.unm.edu/~dmohr/dacapo-20081126.jar
>>> and again the url for the support classes:
>>>  http://digamma.cs.unm.edu/~dmohr/fop-support.tar
>>>
>>> I then ran soot like this:
>>> CLASSPATH=dacapo-20081126.jar:JimiProClasses.zip:ant.jar:jai-core-1.1.3-alpha.jar:jai_codec-1.1.3-alpha.jar:$SOOT_CP
>>> \
>>> soot.Main -pp -p jb use-original-names -f J org.apache.fop.image.BmpImage
>>>
>>> While playing around with this, I noticed that the exception only gets
>>> thrown when I specify use-original-names.
>>>
>>> ~David
>>>
>>>> Thanks,
>>>> Eric
>>>>
>>>> --
>>>> Eric Bodden
>>>> Software Technology Group, Technische Universität Darmstadt, Germany
>>>> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
>>>> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>>>>
>>>>
>>>>
>>>> 2009/10/27 David Mohr <dmohr at cs.unm.edu>:
>>>>> Hi,
>>>>> I'm trying to run fop through soot 2.3.0, but I'm getting a
>>>>> ClassCastException. I narrowed it down to the
>>>>> org.apache.fop.image.BmpImage class.
>>>>>
>>>>> ---SNIP---
>>>>> Soot started on Tue Oct 27 11:11:58 MDT 2009
>>>>> Exception in thread "main" java.lang.ClassCastException:
>>>>> soot.jimple.toolkits.typing.fast.BottomType cannot be cast to
>>>>> soot.ArrayType
>>>>>       at soot.jimple.toolkits.typing.fast.UseChecker.caseAssignStmt(UseChecker.java:156)
>>>>>       at soot.jimple.internal.JAssignStmt.apply(JAssignStmt.java:221)
>>>>>       at soot.jimple.toolkits.typing.fast.UseChecker.check(UseChecker.java:55)
>>>>>       at soot.jimple.toolkits.typing.fast.TypeResolver.insertCasts(TypeResolver.java:345)
>>>>>       at soot.jimple.toolkits.typing.fast.TypeResolver.minCasts(TypeResolver.java:355)
>>>>>       at soot.jimple.toolkits.typing.fast.TypeResolver.inferTypes(TypeResolver.java:116)
>>>>>       at soot.jimple.toolkits.typing.TypeAssigner.internalTransform(TypeAssigner.java:93)
>>>>>       at soot.BodyTransformer.transform(BodyTransformer.java:51)
>>>>>       at soot.Transform.apply(Transform.java:104)
>>>>>       at soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:66)
>>>>>       at soot.JimpleBodyPack.internalApply(JimpleBodyPack.java:89)
>>>>>       at soot.Pack.apply(Pack.java:124)
>>>>>       at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:117)
>>>>>       at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:82)
>>>>>       at soot.SootMethod.retrieveActiveBody(SootMethod.java:329)
>>>>>       at soot.PackManager.retrieveAllBodies(PackManager.java:966)
>>>>>       at soot.PackManager.runPacks(PackManager.java:333)
>>>>>       at soot.Main.run(Main.java:202)
>>>>>       at soot.Main.main(Main.java:145)
>>>>> ---SNAP---
>>>>>
>>>>> I have the support jars on the classpath, and run soot with '-pp -p jb
>>>>> use-original-names -f J'. I used fop from the dacapo benchmark, and to
>>>>> save anyone who wants to try this time, the support jars can be found
>>>>> at http://digamma.cs.unm.edu/~dmohr/fop-support.tar .
>>>>>
>>>>> Does anyone have an idea why this is happening?
>>>>>
>>>>> Thanks,
>>>>> ~David
>>>>> _______________________________________________
>>>>> Soot-list mailing list
>>>>> Soot-list at sable.mcgill.ca
>>>>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>>>>
>>>>
>>>
>>
>


More information about the Soot-list mailing list