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

Lambda inlining optimization #353

Open
wants to merge 87 commits into
base: master
Choose a base branch
from

Commits on Aug 3, 2023

  1. Added lambda inlining

    Co-authored-by: Maarten Steevens <maarten.steevens@gmail.com>
    Co-authored-by: Timothy Geerkens <timothy.geerkens@guardsquare.com>
    TimothyGeerkensGuardsquare and MaartenS11 committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    274fd19 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2023

  1. Fixes from inlining lambdas in the klox compiler

    We ran the inliner on a real world application and found a lot of issues, this commit aims to resolve those.
    MaartenS11 committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    043be3a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c098ad8 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2023

  1. Configuration menu
    Copy the full SHA
    7922f11 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bb66672 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    573995e View commit details
    Browse the repository at this point in the history
  4. Removed import .* in LambdaLocator

    Made LambdaUsageHandler a class
    Put loadJar inside testUtil.kt and removed LambdaLocator.Util
    Added comments in CastRemover
    TimothyGeerkensGuardsquare committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    e4ce1e0 View commit details
    Browse the repository at this point in the history
  5. Simplified the RecursiveInliner a bit

    We can do some of these changes because we don't modify the code in this version
    MaartenS11 committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    70e5966 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    aabc5bd View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f4a22fa View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7b2146e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3573c19 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    025571c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    845d044 View commit details
    Browse the repository at this point in the history
  12. Removed visitor staircase in LambdaLocator

    Refactored LambdaImplementationVisitor visitProgramMethod
    TimothyGeerkensGuardsquare committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    13b38d5 View commit details
    Browse the repository at this point in the history
  13. Removed wildcards in import

    Cleaned commented code in NullCheckRemover
    Removed unused class
    Removed staircase in LocalUsageRemover
    TimothyGeerkensGuardsquare committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    fb9fe7d View commit details
    Browse the repository at this point in the history
  14. Cleaned up the while loop in the LambdaUsageFinder by using the new I…

    …terativeInstructionVisitor class
    MaartenS11 committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    cf74760 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    2090514 View commit details
    Browse the repository at this point in the history
  16. Merge pull request #1 from MaartenS11/klox-fixes

    Fixes from inlining lambdas in the klox compiler
    MaartenS11 committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    fb5eedb View commit details
    Browse the repository at this point in the history
  17. Removed unused class and method

    added a logger in lambda locator
    TimothyGeerkensGuardsquare committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    6ae5fc3 View commit details
    Browse the repository at this point in the history
  18. merge

    TimothyGeerkensGuardsquare committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    e90c5c9 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    33aa83d View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    1d49b49 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    cb60c13 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    3d3bf8f View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2023

  1. Configuration menu
    Copy the full SHA
    8c354ab View commit details
    Browse the repository at this point in the history
  2. Use argument index from LambdaUsageFinder instead of searching in the…

    … descriptor
    
    This is better because it fixes the case where a lambda is attempted to be inlined into a method that takes object as argument which is then later casted back into a lambda.
    MaartenS11 committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    813be34 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f155107 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7d82d2d View commit details
    Browse the repository at this point in the history
  5. WIP commit (please amend)

    MaartenS11 committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    047719c View commit details
    Browse the repository at this point in the history
  6. Merge branch 'lambda-inlining' of github.com:MaartenS11/proguard into…

    … recursive-inliner-adjustments
    MaartenS11 committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    5cc6748 View commit details
    Browse the repository at this point in the history
  7. Merge pull request #2 from MaartenS11/recursive-inliner-adjustments

    Recursive inliner adjustments + comments
    MaartenS11 committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    1f5c85b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    54233a5 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ef37241 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    beeadd5 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    343df22 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    71213fe View commit details
    Browse the repository at this point in the history
  13. Cleaned up a bit

    MaartenS11 committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    42493c6 View commit details
    Browse the repository at this point in the history
  14. Merge pull request #3 from MaartenS11/more-fixes

    Fixed the cast remover so it works in all cases
    MaartenS11 committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    8cfd505 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2023

  1. Configuration menu
    Copy the full SHA
    cff6565 View commit details
    Browse the repository at this point in the history
  2. Added logging when a lambda has been inlined and only print method le…

    …ngth when decided to not inline the lambda
    MaartenS11 committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    5644a9d View commit details
    Browse the repository at this point in the history
  3. Log the consuming method and invoke method so the use knows which met…

    …hod is not inlined when it is too long
    MaartenS11 committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    48c52e5 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #4 from MaartenS11/inline-conditionally

    Conditionally inline lambdas
    MaartenS11 committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    badf492 View commit details
    Browse the repository at this point in the history
  5. Fixed typo in comment

    Co-authored-by: rubenpieters <rubenpieters@users.noreply.github.com>
    MaartenS11 and rubenpieters committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    61e1e98 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    00664b2 View commit details
    Browse the repository at this point in the history
  7. Fixed typo in comment

    Co-authored-by: rubenpieters <rubenpieters@users.noreply.github.com>
    MaartenS11 and rubenpieters committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    fca2cde View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f8f1155 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    bcab91e View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    2710ff3 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    49bd302 View commit details
    Browse the repository at this point in the history
  12. Use result of lambdaUsageHandler.handle() directly instead of storing…

    … and then reading it again from the iterativeInstructionVisitor
    MaartenS11 committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    55b4f0e View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    7613999 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    ee3e3ab View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    f1ba773 View commit details
    Browse the repository at this point in the history
  16. Renamed isSourceInstruction to isNotSourceInstruction

    Resolved infinite loop when tracing source instruction of unreachable code
    TimothyGeerkensGuardsquare committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    7d602c9 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    4d18370 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    2648338 View commit details
    Browse the repository at this point in the history
  19. Apply suggestions from code review

    Co-authored-by: rubenpieters <rubenpieters@users.noreply.github.com>
    MaartenS11 and rubenpieters committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    b431cb7 View commit details
    Browse the repository at this point in the history
  20. Use Optional in MethodLengthFinder so the programmer is made aware th…

    …at some methods don't have a length
    MaartenS11 committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    11f21f1 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    028e8c4 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    0cc53cd View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    a440b45 View commit details
    Browse the repository at this point in the history
  24. Renamed constantInstruction and offset to be more precise also added …

    …javadoc to Lambda class to explain what each argument/field represents
    MaartenS11 committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    7e652b3 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2023

  1. Configuration menu
    Copy the full SHA
    607bf86 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f69fd14 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    95b23ab View commit details
    Browse the repository at this point in the history
  4. merge

    TimothyGeerkensGuardsquare committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    c5bca4a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    23d4efe View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7cdac26 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    03ae5c6 View commit details
    Browse the repository at this point in the history
  8. Add large javadoc comment explaining all the steps taken when using t…

    …he BaseLambdaInliner.inline() method
    MaartenS11 committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    ad8b5ff View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    26d9850 View commit details
    Browse the repository at this point in the history
  10. Move a lot of code from the BaseLambdaInliner into a private inner cl…

    …ass because the visitors are not part of the API of the BaseLambdaInliner
    MaartenS11 committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    a5ebb5e View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    71b63a4 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    7da8e01 View commit details
    Browse the repository at this point in the history
  13. Add -inlinekotlinlambdas command line option to enable and disable la…

    …mbda inlining without recompiling
    MaartenS11 committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    751cc74 View commit details
    Browse the repository at this point in the history
  14. Moved lambda inlining optimization from inline to lambdainline packag…

    …e so it matches the package name used in the tests and it also is just more informative, the MethodInliner for example was not in there
    MaartenS11 committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    f4f84e4 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    9d080b2 View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2023

  1. Configuration menu
    Copy the full SHA
    b8fbcd0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3a866fc View commit details
    Browse the repository at this point in the history
  3. Added WIP README file to the lambdainline package

    (Location can maybe be changed not sure exactly where we should put it, putting it in the official documentation seems incorrect this is not really something a proguard user should know it's more of a developer oriented piece of documentation.)
    MaartenS11 committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    a910309 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0cf13a7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1ba33ba View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2023

  1. Be more specific when using the ClassReferenceInitializer, not all re…

    …ferences have to be updated, just the classes involved in the inlining process
    
    This should improve performance a bit.
    MaartenS11 committed Aug 12, 2023
    Configuration menu
    Copy the full SHA
    ceea1b6 View commit details
    Browse the repository at this point in the history
  2. Only re-run the ClassReferenceInitializer on the consuming class

    This should also improve performance a bit.
    MaartenS11 committed Aug 12, 2023
    Configuration menu
    Copy the full SHA
    93d3bb6 View commit details
    Browse the repository at this point in the history
  3. Only run AccessFixer on consumingClass instead of the entire programC…

    …lassPool
    
    This should again improve performance of the pass a bit.
    MaartenS11 committed Aug 12, 2023
    Configuration menu
    Copy the full SHA
    ac7f42d View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2023

  1. Adjust conditional inlining attempt condition to use sum of consuming…

    … method and lambda length
    MaartenS11 committed Aug 13, 2023
    Configuration menu
    Copy the full SHA
    370704b View commit details
    Browse the repository at this point in the history