-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Java: Improve a couple of join-orders #20127
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
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 |
---|---|---|
|
@@ -348,6 +348,16 @@ predicate expectsContent(Node n, ContentSet c) { | |
FlowSummaryImpl::Private::Steps::summaryExpectsContent(n.(FlowSummaryNode).getSummaryNode(), c) | ||
} | ||
|
||
pragma[nomagic] | ||
private predicate numericRepresentative(RefType t) { | ||
t.(BoxedType).getPrimitiveType().getName() = "double" | ||
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. May as well change the type of 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. True, I guess. Although there's a slight point in making the type |
||
} | ||
|
||
pragma[nomagic] | ||
private predicate booleanRepresentative(RefType t) { | ||
t.(BoxedType).getPrimitiveType().getName() = "boolean" | ||
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. Same. |
||
} | ||
|
||
/** | ||
* Gets a representative (boxed) type for `t` for the purpose of pruning | ||
* possible flow. A single type is used for all numeric types to account for | ||
|
@@ -356,10 +366,10 @@ predicate expectsContent(Node n, ContentSet c) { | |
RefType getErasedRepr(Type t) { | ||
exists(Type e | e = t.getErasure() | | ||
if e instanceof NumericOrCharType | ||
then result.(BoxedType).getPrimitiveType().getName() = "double" | ||
then numericRepresentative(result) | ||
else | ||
if e instanceof BooleanType | ||
then result.(BoxedType).getPrimitiveType().getName() = "boolean" | ||
then booleanRepresentative(result) | ||
else result = e | ||
) | ||
or | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,24 +214,35 @@ private predicate relevantNode(ObjNode n) { | |
exists(ObjNode mid | relevantNode(mid) and objStep(mid, n) and relevantNodeBack(n)) | ||
} | ||
|
||
pragma[noinline] | ||
private predicate objStepPruned(ObjNode n1, ObjNode n2) { | ||
objStep(n1, n2) and relevantNode(n1) and relevantNode(n2) | ||
private newtype TObjFlowNode = | ||
aschackmull marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TObjNode(ObjNode n) { relevantNode(n) } or | ||
TObjType(RefType t) { source(t, _) } | ||
|
||
private predicate objStepPruned(TObjFlowNode node1, TObjFlowNode node2) { | ||
exists(ObjNode n1, ObjNode n2 | | ||
node1 = TObjNode(n1) and | ||
node2 = TObjNode(n2) and | ||
objStep(n1, n2) | ||
) | ||
or | ||
exists(RefType t, ObjNode n | | ||
node1 = TObjType(t) and | ||
node2 = TObjNode(n) and | ||
source(t, n) | ||
) | ||
} | ||
|
||
private predicate stepPlus(Node n1, Node n2) = fastTC(objStepPruned/2)(n1, n2) | ||
private predicate flowSrc(TObjFlowNode src) { src instanceof TObjType } | ||
|
||
private predicate flowSink(TObjFlowNode sink) { exists(ObjNode n | sink = TObjNode(n) and sink(n)) } | ||
|
||
private predicate stepPlus(TObjFlowNode n1, TObjFlowNode n2) = | ||
doublyBoundedFastTC(objStepPruned/2, flowSrc/1, flowSink/1)(n1, n2) | ||
|
||
/** | ||
* Holds if the qualifier `n` of an `Object.toString()` call might have type `t`. | ||
*/ | ||
pragma[noopt] | ||
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. Very nice to get rid of this. |
||
private predicate objType(ObjNode n, RefType t) { | ||
exists(ObjNode n2 | | ||
sink(n) and | ||
(stepPlus(n2, n) or n2 = n) and | ||
source(t, n2) | ||
) | ||
} | ||
private predicate objType(ObjNode n, RefType t) { stepPlus(TObjType(t), TObjNode(n)) } | ||
|
||
private VirtualMethodCall objectToString(ObjNode n) { | ||
result.getQualifier() = n.asExpr() and sink(n) | ||
|
Uh oh!
There was an error while loading. Please reload this page.