Skip to content

Conversation

RenaudFondeur
Copy link
Collaborator

  • Move inlining to its own class to work on cleaner code.
  • Add tests for inlining in general and bugs/limitation that i have found.

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.

Copy link
Member

@guillep guillep left a 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!!

Comment on lines 1032 to 1033
inliner := SLInlinerStrategy new
codeGenerator: self;
yourself.
Copy link
Member

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?

Copy link
Collaborator Author

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

Comment on lines 2 to 8
#name : 'SLInliner',
#superclass : 'Object',
#instVars : [
'codeGenerator',
'currentMethod',
'sLNodeAnnotatorVisitor'
],
#category : 'Slang',
#package : 'Slang'
Copy link
Member

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?

Comment on lines 646 to 677
TStatementListNode >> removeFirst [

| first |
first := self firstNonCommentStatement.
statements := statements select: [ :e | e ~= first ]
]
Copy link
Member

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?

Copy link
Collaborator Author

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

guillep
guillep previously approved these changes Jul 11, 2025
@guillep
Copy link
Member

guillep commented Jul 11, 2025

@RenaudFondeur can you move to another PR the new tests that show regression bugs but that are not fixed in this PR?

@guillep guillep marked this pull request as ready for review July 18, 2025 12:00
RenaudFondeur and others added 19 commits July 18, 2025 14:00
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
add a test for a bug in both inlining strategy
add handle of comments in one more checks
small refactor of inlining
@guillep guillep force-pushed the betterInliningStable branch from eb7c214 to bdda5f9 Compare July 18, 2025 12:00
@guillep guillep merged commit afdaa93 into pharo-project:pharo-12 Jul 18, 2025
1 check was pending
@guillep
Copy link
Member

guillep commented Jul 18, 2025

Thanks @RenaudFondeur !

@guillep guillep deleted the betterInliningStable branch July 18, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants