-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Avoid computing full fastTC
for AstNode::getParent
#10741
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIL before ``` /* AST::AstNode */ AST#87953007::Cached::TAstNode result) = fastTC(Module#fe82a56b::parent#1#ff/2) . Module#fe82a56b::enclosingModule#1#ff(/* AST::AstNode */ AST#87953007::Cached::TAstNode node, /* Module::ModuleBase */ AST#87953007::Cached::TAstNode result) :- exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#2 | Module#2a43f566::ModuleBase#f(result), project#AST#a6718388::AstNode::getAChild#1#dispred(result, call_result#2), ( node = call_result#2; #Module#fe82a56b::parent#1Plus#ff(node, call_result#2) ) ) . ``` DIL after ``` incremental Module#fe82a56b::enclosingModule#1#ff(/* AST::AstNode */ AST#87953007::Cached::TAstNode node, /* Module::ModuleBase */ AST#87953007::Cached::TAstNode result) :- ( Module#2a43f566::ModuleBase#f(result), exists(cached dontcare string _ | AST#a6718388::AstNode::getAChild#1#dispred(result, _, node) ) ); exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode mid | Module#2a43f566::ModuleBase#f(result), rec Module#fe82a56b::enclosingModule#1#ff(mid, result), not(Module#2a43f566::ModuleBase#f(mid)), not(Method#8b49e67f::Block#f(mid)), exists(cached dontcare string _ | AST#a6718388::AstNode::getAChild#1#dispred(mid, _, node) ) ) | [base_case] Module#2a43f566::ModuleBase#f(result), project#AST#a6718388::AstNode::getAChild#1#dispred(result, node) | [delta_order] exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode mid | Module#2a43f566::ModuleBase#f(result), delta previous rec Module#fe82a56b::enclosingModule#1#ff(mid, result), not(Module#2a43f566::ModuleBase#f(mid)), not(Method#8b49e67f::Block#f(mid)), project#AST#a6718388::AstNode::getAChild#1#dispred(mid, node) ), not(previous rec Module#fe82a56b::enclosingModule#1#ff(node, result)) | [delta_order_up_to_500000] exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode mid | delta previous rec Module#fe82a56b::enclosingModule#1#ff(mid, result), Module#2a43f566::ModuleBase#f(result), not(Module#2a43f566::ModuleBase#f(mid)), not(Method#8b49e67f::Block#f(mid)), project#AST#a6718388::AstNode::getAChild#1#dispred(mid, node) ), not(previous rec Module#fe82a56b::enclosingModule#1#ff(node, result)) . ```
DIL before ``` /* AST::AstNode */ AST#87953007::Cached::TAstNode result) = fastTC(AST#a6718388::AstNode::getAChild#0#dispred#ff/2) . Completion#445d5844::mayRaise#1#f(/* Call::Call */ unique AST#87953007::Cached::TAstNode c) :- exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#2 | exists(/* ControlFlowGraphImpl::Trees::BodyStmtTree */ AST#87953007::Cached::TAstNode bst | ( ( project#Expr#6fb2af19::BodyStmt::getRescue#1#dispred#fff(bst), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst) ); ( exists(/* Expr::StmtSequence */ dontcare AST#87953007::Cached::TAstNode _ | Expr#6fb2af19::BodyStmt::getEnsure#0#dispred#ff(bst, _) ), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst) ) ), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst), project#ControlFlowGraphImpl#288ae92e::Trees::StmtSequenceTree::getBodyChild#2#dispred#ffff(bst, call_result#2) ), ( (c = call_result#2, Call#841c84e8::Call#f(c)); ( #AST#a6718388::AstNode::getAChild#0#dispredPlus#ff(call_result#2, c), Call#841c84e8::Call#f(c) ) ) ) . ``` DIL after ``` incremental Completion#445d5844::getARescuableBodyChild#0#f(/* AST::AstNode */ unique AST#87953007::Cached::TAstNode result) :- exists(/* ControlFlowGraphImpl::Trees::BodyStmtTree */ AST#87953007::Cached::TAstNode bst | ( ( exists(dontcare int _, /* Expr::RescueClause */ dontcare AST#87953007::Cached::TAstNode _1 | Expr#6fb2af19::BodyStmt::getRescue#1#dispred#fff(bst, _, _1) ), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst) ); ( exists(/* Expr::StmtSequence */ dontcare AST#87953007::Cached::TAstNode _ | Expr#6fb2af19::BodyStmt::getEnsure#0#dispred#ff(bst, _) ), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst) ) ), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst), exists(boolean arg2, dontcare int _ | arg2 = true, ControlFlowGraphImpl#288ae92e::Trees::StmtSequenceTree::getBodyChild#2#dispred#ffff(bst, _, arg2, result) ) ); exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#5 | rec Completion#445d5844::getARescuableBodyChild#0#f(call_result#5), exists(cached dontcare string _ | AST#a6718388::AstNode::getAChild#1#dispred(call_result#5, _, result) ) ) | [base_case] exists(/* ControlFlowGraphImpl::Trees::BodyStmtTree */ AST#87953007::Cached::TAstNode bst | ( ( project#Expr#6fb2af19::BodyStmt::getRescue#1#dispred#fff(bst), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst) ); ( exists(/* Expr::StmtSequence */ dontcare AST#87953007::Cached::TAstNode _ | Expr#6fb2af19::BodyStmt::getEnsure#0#dispred#ff(bst, _) ), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst) ) ), ControlFlowGraphImpl#288ae92e::Trees::BodyStmtTree#class#f(bst), project#ControlFlowGraphImpl#288ae92e::Trees::StmtSequenceTree::getBodyChild#2#dispred#ffff(bst, result) ) | [delta_order] exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#5 | delta previous rec Completion#445d5844::getARescuableBodyChild#0#f(call_result#5), project#AST#a6718388::AstNode::getAChild#1#dispred(call_result#5, result) ), not(previous rec Completion#445d5844::getARescuableBodyChild#0#f(result)) . ```
DIL before ``` /* AST::AstNode */ AST#87953007::Cached::TAstNode result) = fastTC(AST#a6718388::AstNode::getAChild#0#dispred#ff/2) . Synthesis#d9ff06b1::isInDesugaredContext#1#f(/* AST::AstNode */ unique AST#87953007::Cached::TAstNode n) :- exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, n) ); exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#2 | exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, call_result#2) ), #AST#a6718388::AstNode::getAChild#0#dispredPlus#ff(call_result#2, n) ) . ``` DIL after ``` incremental Synthesis#d9ff06b1::isInDesugaredContext#1#f(/* AST::AstNode */ unique AST#87953007::Cached::TAstNode n) :- exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, n) ); exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode any#expr##2 | rec Synthesis#d9ff06b1::isInDesugaredContext#1#f(any#expr##2), exists(cached dontcare string _ | AST#a6718388::AstNode::getAChild#1#dispred(any#expr##2, _, n) ) ) | [base_case] exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, n) ) | [delta_order] exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode any#expr##2 | delta previous rec Synthesis#d9ff06b1::isInDesugaredContext#1#f(any#expr##2), project#AST#a6718388::AstNode::getAChild#1#dispred(any#expr##2, n) ), not(previous rec Synthesis#d9ff06b1::isInDesugaredContext#1#f(n)) . ``
DIL before ``` /* AST::AstNode */ AST#87953007::Cached::TAstNode result) = fastTC(AST#a6718388::AstNode::getAChild#0#dispred#ff/2) . Synthesis#d9ff06b1::Desugared::getADescendant#0#dispred#ff(/* Synthesis::Desugared */ AST#87953007::Cached::TAstNode this, /* AST::AstNode */ AST#87953007::Cached::TAstNode result) :- ( exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, this) ), result = this ); ( exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, this) ), #AST#a6718388::AstNode::getAChild#0#dispredPlus#ff(this, result) ) . ``` DIL after ``` incremental Synthesis#d9ff06b1::Desugared::getADescendant#ff(/* Synthesis::Desugared */ AST#87953007::Cached::TAstNode this, /* AST::AstNode */ AST#87953007::Cached::TAstNode result) :- ( exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, this) ), result = this ); exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#2 | exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, this) ), rec Synthesis#d9ff06b1::Desugared::getADescendant#ff(this, call_result#2), exists(cached dontcare string _ | AST#a6718388::AstNode::getAChild#1#dispred(call_result#2, _, result) ) ) | [base_case] exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, this) ), result = this | [delta_order] exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#2 | exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, this) ), delta previous rec Synthesis#d9ff06b1::Desugared::getADescendant#ff(this, call_result#2), project#AST#a6718388::AstNode::getAChild#1#dispred(call_result#2, result) ), not( previous rec Synthesis#d9ff06b1::Desugared::getADescendant#ff(this, result) ) | [delta_order_up_to_500000] exists(/* AST::AstNode */ AST#87953007::Cached::TAstNode call_result#2 | delta previous rec Synthesis#d9ff06b1::Desugared::getADescendant#ff(this, call_result#2), exists(int arg1, /* AST::AstNode */ dontcare AST#87953007::Cached::TAstNode _ | arg1 = -1, AST#87953007::Cached::getSynthChild#2(_, arg1, this) ), project#AST#a6718388::AstNode::getAChild#1#dispred(call_result#2, result) ), not( previous rec Synthesis#d9ff06b1::Desugared::getADescendant#ff(this, result) ) . ```
AstNode::getParent
fastTC
for AstNode::getParent
nickrolfe
approved these changes
Oct 10, 2022
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rewritten to use explicit recursion instead of (implicit)
fastTC
. See each commit for details.