[Soot-list] Internal Transform in not called for some library methods

Eric Bodden eric.bodden at mail.mcgill.ca
Tue Nov 25 15:10:49 EST 2008


I have no idea what bytecode attributes are allowed for native
methods. In any case you won't be able to insert an annotation with a
BodyTransformer because that requires a body to be present.

Eric

2008/11/25 Manjiri Namjoshi <manjiri.namjoshi at googlemail.com>:
> Hi,
>
> Ok, yes .... thanks !
>
> So, we cannot really annotate native methods right ?
>
> Thank You.
>
> Sincerely,
> Manjiri
>
> 2008/11/25 Eric Bodden <eric.bodden at mail.mcgill.ca>
>>
>> I found the reason. currentTimeMillis is a native method (although its
>> JavaDoc does not show this):
>>
>> $ javap -c java.lang.System | grep native
>> public static native long currentTimeMillis();
>> public static native long nanoTime();
>> public static native void arraycopy(java.lang.Object, int,
>> java.lang.Object, int, int);
>> public static native int identityHashCode(java.lang.Object);
>> public static native java.lang.String mapLibraryName(java.lang.String);
>>
>> Obviously, there are no bodies for native methods which Soot could
>> invoke your transformer on.
>>
>> Eric
>>
>> 2008/11/25 Manjiri Namjoshi <manjiri.namjoshi at googlemail.com>:
>> > java AnnotateAllLoops --app -f c spec.benchmarks._202_jess.Main
>> > java.lang.System
>> >
>> > Then i print the sootMethod.getName() inside "internalTransform" and i
>> > observed that it never printed the method names currentTimeMillis and
>> > arraycopy.
>> >
>> > But, it printed all other method names of class java.lang.System
>> >
>> > Basically, instead of using -i java. i mentioned java.lang.System
>> > explicitly
>> > as a command line argument. So, it is considering it as an application
>> > class
>> > and transforming it too.
>> > But, 2 methods seem to be a problem and i cant figure out why !
>> >
>> > Thank You.
>> >
>> > Sincerely,
>> > Manjiri
>> >
>> >
>> > 2008/11/25 Eric Bodden <eric.bodden at mail.mcgill.ca>
>> >>
>> >> Manjiri, what's your full command line?
>> >>
>> >> Eric
>> >>
>> >> 2008/11/21 Manjiri Namjoshi <manjiri.namjoshi at googlemail.com>:
>> >> > Hello,
>> >> >
>> >> > I was just using java.lang.System as a command line argument.
>> >> > It calls internalTransform for other methods in java.lang.System
>> >> >
>> >> > Actually, i dont want to transform all the library classes and/or
>> >> > methods.
>> >> >
>> >> > Thank You.
>> >> >
>> >> > Sincerely,
>> >> > Manjiri
>> >> >
>> >> >
>> >> > 2008/11/21 Eric Bodden <eric.bodden at mail.mcgill.ca>
>> >> >>
>> >> >> You have to use "-i java." on the command line to include all java.*
>> >> >> packages.
>> >> >>
>> >> >> See http://www.sable.mcgill.ca/soot/tutorial/usage/index.html
>> >> >>
>> >> >> Eric
>> >> >>
>> >> >> 2008/11/21 Manjiri Namjoshi <manjiri.namjoshi at googlemail.com>:
>> >> >> > Hello,
>> >> >> >
>> >> >> > I was trying to transform a library class java.lang.System using
>> >> >> > SOOT.
>> >> >> > /* adds the transformer. */
>> >> >> >         PackManager.v().getPack("jtp").add(new
>> >> >> >                         Transform("jtp.annotexample",
>> >> >> >                   AnnotateHotMethods.v()));
>> >> >> >
>> >> >> >
>> >> >> > /* invokes Soot */
>> >> >> >         soot.Main.main(args);
>> >> >> >
>> >> >> > The Java API shows that java.lang.System contains a method named
>> >> >> > currentTimeMillis(). But, the "internalTransform" is not being
>> >> >> > called
>> >> >> > for
>> >> >> > it.
>> >> >> > (Same is the case for java.lang.System.arraycopy()).
>> >> >> >
>> >> >> > I want to annotate these methods.
>> >> >> > So, can anyone help me understand what is wrong ?
>> >> >> >
>> >> >> > Thank You.
>> >> >> >
>> >> >> > Sincerely,
>> >> >> > Manjiri
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Soot-list mailing list
>> >> >> > Soot-list at sable.mcgill.ca
>> >> >> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Eric Bodden
>> >> >> Sable Research Group, McGill University, Montréal, Canada
>> >> >> Got an interesting job offer? http://www.bodden.de/hire-me/
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Eric Bodden
>> >> Sable Research Group, McGill University, Montréal, Canada
>> >> Got an interesting job offer? http://www.bodden.de/hire-me/
>> >
>> >
>>
>>
>>
>> --
>> Eric Bodden
>> Sable Research Group, McGill University, Montréal, Canada
>> Got an interesting job offer? http://www.bodden.de/hire-me/
>
>



-- 
Eric Bodden
Sable Research Group, McGill University, Montréal, Canada
Got an interesting job offer? http://www.bodden.de/hire-me/


More information about the Soot-list mailing list