Skip to content
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

Remove unneeded lowerings and refactor needed ones #94

Open
1 of 5 tasks
krzema12 opened this issue Dec 23, 2021 · 1 comment
Open
1 of 5 tasks

Remove unneeded lowerings and refactor needed ones #94

krzema12 opened this issue Dec 23, 2021 · 1 comment
Labels
cleanliness Let's polish our code! development Anything related to making development more pleasant. No real influence on the product itself. optimization This change would result in a more optimal Python; "Pythonification".
Milestone

Comments

@krzema12
Copy link
Owner

krzema12 commented Dec 23, 2021

Lowerings are a big part of backend logic, so let's ensure we know what happens there and that we don't have anything surplus or weird.

  • [#94] Remove commented out code #95
  • analyze lowerings and dependencies between them
  • iteratively remove lowerings to get a minimal list of needed ones
  • remove unneeded Gradle module dependencies
  • add unit tests for each lowering, if possible. It's to be able to understand what they really do, so it serves documentation purposes
  • think outside the box: maybe for some case, the JS way is not the correct one? E. g. constructors, it may be a better way to lower them for Python. Now we base on JS version
@krzema12 krzema12 added optimization This change would result in a more optimal Python; "Pythonification". development Anything related to making development more pleasant. No real influence on the product itself. cleanliness Let's polish our code! labels Dec 23, 2021
@krzema12 krzema12 self-assigned this Dec 23, 2021
@krzema12 krzema12 added this to the MVP milestone Dec 23, 2021
krzema12 added a commit that referenced this issue Dec 23, 2021
krzema12 added a commit that referenced this issue Dec 24, 2021
* [#94] Remove commented out code

Co-authored-by: Sergei Bulgakov <[email protected]>
krzema12 added a commit that referenced this issue Dec 27, 2021
krzema12 added a commit that referenced this issue Dec 27, 2021
krzema12 added a commit that referenced this issue Dec 27, 2021
krzema12 added a commit that referenced this issue Dec 27, 2021
krzema12 added a commit that referenced this issue Dec 27, 2021
@krzema12
Copy link
Owner Author

krzema12 commented Dec 27, 2021

Thanks to the below snippet I was able to generate a dependency diagram of lowerings:

(to be pasted in compiler/ir/backend.py/src/org/jetbrains/kotlin/ir/backend/py/JsLoweringPhases.kt)

fun main() {
    println("@startuml")
    println("skinparam componentStyle rectangle")
    println("left to right direction")

    loweringList.forEach { lowering ->
        println("component \"${lowering.modulePhase.name}\"")
        lowering.modulePhase.prerequisite.forEach { prerequisite ->
            println("component \"${prerequisite.name}\"")
            println("[${lowering.modulePhase.name}] --> [${prerequisite.name}]")
        }
    }

    println("@enduml")
}

The generated code can be rendered with any PlantUML renderer, e.g. http://www.plantuml.com/

image

krzema12 added a commit that referenced this issue Dec 27, 2021
Anything that was marked as unused in IntelliJ was removed. The
analysis was very shallow, and didn't check e.g. if actually a lowering
is used. It's in scope of the next changes.
krzema12 added a commit that referenced this issue Dec 27, 2021
krzema12 added a commit that referenced this issue Dec 28, 2021
Anything that was marked as unused in IntelliJ was removed. The
analysis was very shallow, and didn't check e.g. if actually a lowering
is used. It's in scope of the next changes.

The only exceptions are some entities which symbols are not used in
compile time, but they are somehow used in runtime. Each such
occurrence was marked with a comment.
krzema12 added a commit that referenced this issue Dec 29, 2021
SerVB pushed a commit that referenced this issue Jan 29, 2022
Anything that was marked as unused in IntelliJ was removed. The
analysis was very shallow, and didn't check e.g. if actually a lowering
is used. It's in scope of the next changes.

The only exceptions are some entities which symbols are not used in
compile time, but they are somehow used in runtime. Each such
occurrence was marked with a comment.
@krzema12 krzema12 removed their assignment Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanliness Let's polish our code! development Anything related to making development more pleasant. No real influence on the product itself. optimization This change would result in a more optimal Python; "Pythonification".
Projects
None yet
Development

No branches or pull requests

1 participant