Skip to content

Commit

Permalink
upgrade codegen, use new api (to minify flatgraph diff) (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpollmeier authored Jun 27, 2024
1 parent 41f6028 commit b9373b8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name := "codepropertygraph"

// parsed by project/Versions.scala, updated by updateDependencies.sh
val overflowdbVersion = "1.192"
val overflowdbCodegenVersion = "2.108a"
val overflowdbCodegenVersion = "2.110"

inThisBuild(
List(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ abstract class ForkJoinParallelCpgPass[T <: AnyRef](
var nDiff = -1
var nDiffT = -1
try {
val diffGraph = new DiffGraphBuilder
val diffGraph = Cpg.newDiffGraphBuilder
nParts = runWithBuilder(diffGraph)
nanosBuilt = System.nanoTime()
nDiff = diffGraph.size()
Expand Down Expand Up @@ -145,7 +145,7 @@ abstract class NewStyleCpgPassBase[T <: AnyRef] extends CpgPassBase {
val diff = stream.collect(
new Supplier[DiffGraphBuilder] {
override def get(): DiffGraphBuilder =
new DiffGraphBuilder
Cpg.newDiffGraphBuilder
},
new BiConsumer[DiffGraphBuilder, AnyRef] {
override def accept(builder: DiffGraphBuilder, part: AnyRef): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ abstract class ConcurrentWriterCpgPass[T <: AnyRef](
// todo: Verify that we get FIFO scheduling; otherwise, do something about it.
// if this e.g. used LIFO with 4 cores and 18 size of ringbuffer, then 3 cores may idle while we block on the front item.
completionQueue.append(Future.apply {
val builder = new DiffGraphBuilder
val builder = Cpg.newDiffGraphBuilder
runOnPart(builder, next.asInstanceOf[T])
builder.build()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CpgPassNewTests extends AnyWordSpec with Matchers {
val cpg = Cpg.empty
class MyPass(cpg: Cpg) extends SimpleCpgPass(cpg, "MyPass", keyPool) {
override def run(builder: DiffGraphBuilder): Unit = {
val builder2 = new DiffGraphBuilder
val builder2 = Cpg.newDiffGraphBuilder
builder.addNode(NewFile().name("foo"))
builder2.addNode(NewFile().name("bar"))
builder.absorb(builder2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ object Cpg {
case other => other
}

def newDiffGraphBuilder: DiffGraphBuilder = new DiffGraphBuilder
}

/** Domain-specific wrapper for graph, starting point for traversals.
Expand Down

0 comments on commit b9373b8

Please sign in to comment.