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 the lamba factory method. Use the static field or constructor directly. #83

Closed

Conversation

JakeWharton
Copy link
Contributor

Refs #81 item 3.

@JakeWharton
Copy link
Contributor Author

I suspect this one might have more feedback as it's much more involved. Let me know what you think!

@JakeWharton
Copy link
Contributor Author

Oh, and this saves 860 methods references from our app which is ~1.4%!

luontola added a commit that referenced this pull request Jan 10, 2016
@luontola
Copy link
Owner

I found a bug with this pull request. I added a test for it to master (commit 365b819).

// 5: invokevirtual #3 // Method java/lang/Object.getClass:()Ljava/lang/Class;
// 8: pop
// 9: invokedynamic #4, 0 // InvokeDynamic #0:call:(Ljava/lang/String;)Ljava/util/concurrent/Callable;
// Attempt to match whether these (4, 5, and 8) are the three preceding bytecodes and remove them if so.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those three instructions should not do any harm, so why are they being removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They screw up the calculation of how far "up" to place the new and dup instructions because they are between the argument loads and invokedynamic call. Instead of removing I can just walk backwards through the instructions until N loads are seen (where N is the number of arguments required).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR with different logic here which removes the special casing of this bytecode sequence.

@JakeWharton
Copy link
Contributor Author

Thanks for the test. I rebased the branch locally on your failing test to take a look. I'm about to hop on planes for 8 hours so hopefully will have something by tomorrow.

@JakeWharton
Copy link
Contributor Author

I found a bug with this pull request. I added a test for it to master (commit 365b819).

Updated and fixed!

@JakeWharton
Copy link
Contributor Author

This change is still fraught with problems and may not be viable to complete. Going to close while I work on it more.

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