[Soot-list] what happens if you mix Scala ASTs with Jimple?

Garcia Gutierrez Miguel Alfredo miguelalfredo.garcia at epfl.ch
Fri Jul 1 05:50:07 EDT 2011



Eric,

those are fair points, and I haven't looked for examples on what can be done with Soot on Scala bytecode output.

Rather, I look at it from another angle:

  (a) Soot-style analyses running on the Jimple-like Scala ASTs could be shared between the JVM and .NET backends of the Scala compiler

  (b) implementing those analyses (or an analysis integrated in Soot, for that matter) with Scala should be more productive (with Parallel Collections [1] as one reason).

There are other points of contact (potential areas for collaboration?) between Soot and the Scala compiler, e.g. we also parse bytecode [2] as part of optimizing [3].
Currently, three compiler phases are into optimization (21 to 23 below) but more are possible.

Ideas are welcome.

prompt>scalac -Xshow-phases

   phase name  id  description
   ----------  --  -----------
       parser   1  parse source into ASTs, perform simple desugaring

              ...

      cleanup  19  platform-specific cleanups, generate reflective calls
        icode  20  generate portable intermediate code
      inliner  21  optimization: do inlining
     closelim  22  optimization: eliminate uncalled closures
          dce  23  optimization: eliminate dead code
          jvm  24  generate JVM bytecode


Miguel
http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded


[1] Scala Collections Library:
    http://www.scala-lang.org/docu/files/collections-api/collections-impl.html
    Parallel Collections library:
    http://infoscience.epfl.ch/record/165523/files/techrep.pdf

[2] ICodeReader,
    docu: http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.html
    source: http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src//compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala

[3] Compiling Scala for Performance,
    Dragos, Iulian ; Odersky, Martin (dir.).
    Ph.D. Thesis
    http://library.epfl.ch/theses/?nr=4820

--
Miguel Garcia
Swiss Federal Institute of Technology
EPFL - IC - LAMP1 - INR 328 - Station 14
CH-1015 Lausanne - Switzerland
http://lamp.epfl.ch/~magarcia/


________________________________________
From: eric.bodden at googlemail.com [eric.bodden at googlemail.com] on behalf of Eric Bodden [bodden at st.informatik.tu-darmstadt.de]
Sent: Friday, July 01, 2011 10:01 AM
To: Garcia Gutierrez Miguel Alfredo
Cc: soot-list at sable.mcgill.ca
Subject: Re: [Soot-list] what happens if you mix Scala ASTs with Jimple?

Thanks for the pointer Miguel, that looks like very interesting work.

Actually I wonder, though, why one would not just use Jimple directly
to optimize Scala. After all, Scala compiles to bytecode and Soot can
optimize bytecode. Do you have examples of cases where proposed IR
allows for more optimization potential than a Jimple IR on the same
code? That would be interesting for me to know.

Eric

On 30 June 2011 17:36, Garcia Gutierrez Miguel Alfredo
<miguelalfredo.garcia at epfl.ch> wrote:
>
> Hi,
> Not much, only that you get a stackless, 3-address-like, fully typed,
> representation.
> Hint: Perhaps an interoperation facility Soot-ScalaASTs can come out of
> this.
> And given that the conversion from an expression language into a Jimple-like
> language takes place within the compilation pipeline (which can be extended
> via compiler plugins) you've got at your disposal all the Scala compiler
> goodies you might need. Including the Parallel Collections framework [1]
> (no, really, just pass a closure and fork/join will kick in).
> Check it out!
> The PDF at
> http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/2011Q2/Moving3A.pdf
> is the technical documentation for the sources at
> http://lampsvn.epfl.ch/trac/scala/browser/scala-experimental/trunk/imp/src
> Compiler plugin stuff
> http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/
> If you want to use this plugin *today*, please notice [2] (that came to
> light during the development of this plugin). Alternatively, the plugin
> sources show how to workaround that.
>
> [1] http://infoscience.epfl.ch/record/165523/files/techrep.pdf
> [2] http://issues.scala-lang.org/browse/SI-4738
>
> --
> Miguel Garcia
> Swiss Federal Institute of Technology
> EPFL - IC - LAMP1 - INR 328 - Station 14
> CH-1015 Lausanne - Switzerland
> http://lamp.epfl.ch/~magarcia/
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>



--
Dr. Eric Bodden, http://bodden.de/
Principal Investigator in Secure Services at CASED
Coordinator of the CASED Advisory Board of Study Affairs
PostDoc at Software Technology Group, Technische Universität Darmstadt
Tel: +49 6151 16-5478 Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110701/05448aad/attachment-0001.html 


More information about the Soot-list mailing list