-
Notifications
You must be signed in to change notification settings - Fork 80
refactor inlining code and add tests for it #987
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
refactor inlining code and add tests for it #987
Conversation
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.
Some feedback, let's discuss!!
inliner := SLInlinerStrategy new | ||
codeGenerator: self; | ||
yourself. |
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.
Ok so this PR already replaces the old one by the new one right?
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.
yes, but just because i wanted to see the CI for the new one
#name : 'SLInliner', | ||
#superclass : 'Object', | ||
#instVars : [ | ||
'codeGenerator', | ||
'currentMethod', | ||
'sLNodeAnnotatorVisitor' | ||
], | ||
#category : 'Slang', | ||
#package : 'Slang' |
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.
What's the difference between an inliner and an InlinerStrategy?
TStatementListNode >> removeFirst [ | ||
|
||
| first | | ||
first := self firstNonCommentStatement. | ||
statements := statements select: [ :e | e ~= first ] | ||
] |
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.
I don't particularly like the collection interface in the statement list...
Also, removeFirst
makes me think that it will remove the first, but it's removing the first non comment, right?
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.
yes, it needs a better name
@RenaudFondeur can you move to another PR the new tests that show regression bugs but that are not fixed in this PR? |
add test for inlining handle potential bug now that we have more generated comments
add a visitor to properly determine what is an expression and what is a statement add the tests for the visitor, it is not used yet
start to integrate the visitor in the inlining to get exitVar and direct return clean some code now unused add tests
…lly buggy hack change the code to fix it
add a test for a bug in both inlining strategy add handle of comments in one more checks
small refactor of inlining
…restore the tests for it + 2 other tests that shouldn't have been supress
…e bug with the non-necessary nil
Cleanup dead code and comments
eb7c214
to
bdda5f9
Compare
Thanks @RenaudFondeur ! |
We now have two ways to do inlining, accessible via their own strategy (SLInlinerStrategy or SLOldInlineStrategy) in doBasicInlining:.
The old inlining hasn't changed, it has currently 8 failing tests for existing bugs.
The refactored one has 6 failing tests.
I managed to solve some of the remaining bugs, but it ended up changing more things than expected so it will come in another PR.
I also couldn't exactly reproduce yet two differences in the generated code from the two strategies which appear close to existing test cases.