Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion csharp/ql/src/semmle/code/csharp/dispatch/Dispatch.qll
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ private module Internal {
result = this.getAStaticTarget()
or
result.getUnboundDeclaration() =
this.getASubsumedStaticTarget0(Gvn::getGlobalValueNumber(result.getDeclaringType()))
this.getASubsumedStaticTarget0(pragma[only_bind_out](Gvn::getGlobalValueNumber(result
.getDeclaringType())))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about instead changing

cached
GvnType getGlobalValueNumber(Type t) { ... }

to

cached
GvnType getGlobalValueNumberImpl(Type t) { ... }

pragma[inline]
GvnType getGlobalValueNumber(Type t) {
  result = pragma[only_bind_out](getGlobalValueNumberImpl(t))
}

in Unification.qll?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to break other code. Specifically typeConstraintUnifiable/typeConstraintSubsumes in Unification.qll where we rely on doing getGlobalValueNumber backwards and forcing the optimiser not to do that makes the code awful. It looks we avoid blowup in those cases due to how small TTypeConstraint is.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's get this in now, and then I can investigate the other approach in a follow-up PR.

}

/**
Expand Down