-
Notifications
You must be signed in to change notification settings - Fork 3
Atualização da versão das dependências e melhorias #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Scala CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up JDK 11 | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: 'adopt' | ||
| java-version: '11' | ||
|
|
||
| - name: Cache SBT | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.ivy2/cache | ||
| ~/.sbt | ||
| key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-sbt- | ||
|
|
||
| - name: Run sbt tests | ||
| run: sbt test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,15 +2,13 @@ package br.ufpe.cin.soot.analysis.jimple | |
|
|
||
| import br.unb.cic.soot.graph.VisitedMethods | ||
| import br.unb.cic.soot.svfa.jimple.{AssignStmt, InvalidStmt, InvokeStmt, JSVFA, Statement} | ||
| import soot.PackManager | ||
| import soot.{Local, PackManager, Scene, SceneTransformer, SootMethod, Transform} | ||
| import soot.jimple._ | ||
| import soot.toolkits.graph.ExceptionalUnitGraph | ||
| import soot.toolkits.scalar.SimpleLocalDefs | ||
| import soot.{Local, Scene, SceneTransformer, SootMethod, Transform} | ||
|
|
||
| import java.io.{FileWriter, IOException} | ||
| import java.text.{DecimalFormat, NumberFormat} | ||
| import java.util | ||
| import scala.collection.convert.ImplicitConversions.`collection asJava` | ||
| import scala.collection.mutable.ListBuffer | ||
|
|
||
|
|
||
|
|
@@ -46,7 +44,7 @@ abstract class JDFP extends JSVFA{ | |
| class TransformerDFP extends SceneTransformer { | ||
| override def internalTransform(phaseName: String, options: util.Map[String, String]): scala.Unit = { | ||
| pointsToAnalysis = Scene.v().getPointsToAnalysis | ||
| Scene.v().getEntryPoints.forEach(method => { | ||
| getAnalysisEntryPoint().forEach(method => { | ||
| traverseDFP(method, new ListBuffer[VisitedMethods]()) | ||
| methods = methods + 1 | ||
| }) | ||
|
|
@@ -132,6 +130,10 @@ abstract class JDFP extends JSVFA{ | |
| val stmt = base.asInstanceOf[soot.jimple.ReturnStmt] | ||
| } | ||
|
|
||
| def getAnalysisEntryPoint(): util.List[SootMethod] = { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esse método foi feito pra usar em classes posteriores com overriden? |
||
| Scene.v().getEntryPoints | ||
| } | ||
|
|
||
|
|
||
| def traverse(stmt: ReturnStmt, method: SootMethod, defs: SimpleLocalDefs, visitedMethods: ListBuffer[VisitedMethods]) : scala.Unit = { | ||
| val op = stmt.stmt.getUseBoxes | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,6 @@ public class LocalDummy implements Local, ConvertToBaf { | |
| public LocalDummy(String name, Type type) { | ||
| setName(name); | ||
| setType(type); | ||
| Numberer<Local> numberer = Scene.v().getLocalNumberer(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Por que removeu isso? Isso é usado pra criar um dos nós do grafo de PDG e PDG. A exemplo, START e STOP.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (numberer != null) { | ||
| numberer.add(this); | ||
| } | ||
| } | ||
|
|
||
| /** Returns true if the given object is structurally equal to this one. */ | ||
|
|
@@ -78,6 +74,11 @@ public void setType(Type t) { | |
| this.type = t; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isStackLocal() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return getName(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package samples.PointerAnalysis; | ||
|
|
||
| public class Main { | ||
| public static void main(String[] ars) { | ||
| Report r = new ReportAdvanced(); | ||
| Text t = new Text(r); | ||
| t.generateReport(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package samples.PointerAnalysis; | ||
|
|
||
| public interface Report { | ||
|
|
||
|
|
||
| void countDupWords(); | ||
|
|
||
| void countDupWhiteSpace(); | ||
|
|
||
| void countComments(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package samples.PointerAnalysis; | ||
|
|
||
| public class ReportAdvanced implements Report { | ||
| int fixes = 0; | ||
|
|
||
| @Override | ||
| public void countDupWords() { | ||
| fixes++; | ||
| } | ||
|
|
||
| @Override | ||
| public void countDupWhiteSpace() { | ||
| int count = fixes; | ||
| //fixes = count; | ||
| } | ||
|
|
||
| @Override | ||
| public void countComments() { | ||
|
|
||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package samples.PointerAnalysis; | ||
|
|
||
| public class ReportSimple implements Report { | ||
| int dupWords = 0; | ||
| int dupWhiteSpace = 0; | ||
|
|
||
| @Override | ||
| public void countDupWords() { | ||
| dupWords++; | ||
| } | ||
|
|
||
| @Override | ||
| public void countDupWhiteSpace() { | ||
| dupWhiteSpace++; | ||
| } | ||
|
|
||
| @Override | ||
| public void countComments() { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package samples.PointerAnalysis; | ||
|
|
||
| public class Text { | ||
| private Report r; | ||
| Text(Report r) { | ||
| this.r = r; | ||
| } | ||
| void generateReport() { | ||
| r = new ReportSimple(); | ||
| //Text t = new Text(report); | ||
| r.countDupWords(); // LEFT | ||
| r.countComments(); | ||
| r.countDupWhiteSpace(); // RIGHT | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Po que tá usando essa versão?