Snippets

Michael Eichberg [OPAL - 0.8.15] Transforming all methods of all class files of a JAR to a 3-address representation

You are viewing an old version of this snippet. View the current version.
Revised by Michael Eichberg d9da96f
 import org.opalj.io.write
 import org.opalj.tac._
 import org.opalj.util.PerformanceEvaluation.time
 val f = new java.io.File("/Users/eichberg/Downloads/presto-verifier-0.147-executable.zip")
 val p = org.opalj.br.analyses.Project(f)
 var i = 0
 time {
 p.parForeachMethodWithBody(parallelizationLevel=32){ mi => 
   
   // Create representation
   val (code,_) = org.opalj.tac.AsQuadruples(mi.method,p.classHierarchy)
   
   // Convert to JavaLike text based representation
   val tac = ToJavaLike(code)
   val fileNamePrefix = mi.classFile.thisType.toJava+"."+mi.method.name
   val file = write(tac, fileNamePrefix, ".tac.txt")
   
   i+= 1
   println(i+":"+file)
 }
 }(t => println("Analysis time: "+t.toSeconds))
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.