Skip to content

Commit

Permalink
Sharing of an IR at multiple places is common. Only detect cases when…
Browse files Browse the repository at this point in the history
… FrameAnalysisMeta is different.
  • Loading branch information
JaroslavTulach committed Dec 14, 2024
1 parent 46e21af commit 41162aa
Showing 1 changed file with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,36 @@ case object FramePointerAnalysis extends IRPass {
ir: IR,
newMeta: FrameAnalysisMeta
): Unit = {

def toString(ir: IR): String = {
ir.getClass().getName() + "@" + Integer.toHexString(
System.identityHashCode(ir)
)
}

ir match {
case ca: CallArgument
if ca.location.isDefined && ca.location.orNull.start == 1946 && ca.location.orNull.end == 1950 =>
val ex = new Exception("Assigning ca: " + ca)
ex.setStackTrace(ex.getStackTrace().slice(0, 20))
ex.printStackTrace()
case _ =>
}
ir.passData().get(this) match {
case None =>
ir.passData()
.update(this, newMeta)
case Some(meta) =>
val ex = new IllegalStateException(
"Unexpected FrameAnalysisMeta associated with IR " + ir + "\nOld: " + meta + " new " + newMeta
)
ex.setStackTrace(ex.getStackTrace().slice(0, 10))
throw ex
if (meta != newMeta) {
val ex = new IllegalStateException(
"Unexpected FrameAnalysisMeta associated with IR " + toString(
ir
) + "\n" + ir + "\nOld: " + meta + " new " + newMeta
)
ex.setStackTrace(ex.getStackTrace().slice(0, 10))
ex.printStackTrace()
// throw ex
}
}
}

Expand Down

0 comments on commit 41162aa

Please sign in to comment.