Merged
Conversation
Contributor
|
LGTM! |
18 tasks
| map.put("lsh", PRIV_LOOKUP.findStatic(clazz, "lsh", shift)); | ||
| map.put("rsh", PRIV_LOOKUP.findStatic(clazz, "rsh", shift)); | ||
| map.put("ush", PRIV_LOOKUP.findStatic(clazz, "ush", shift)); | ||
| return map; |
Contributor
There was a problem hiding this comment.
I think this map should also be unmodifiable like the outer one. It is not so important, because the whole thing is private, but for consistency. Alternatively remove the unmodifiable from outer map, too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This refactors operators on dynamic types to use invokedynamic (and fixes several bugs/consistency issues/tests).
The idea here is that the math operators we have now aren't that slow. Each one has a little hand written decision tree and works ok. But this gives no chance to make things better.
Instead, let the current functions be "fallback" impls, and add impls for the basic types: int, float, long, double, boolean (other types promoted). We limit the cache to a size of 1, if types change, we just revert to what we have today. The idea is to help the 90% case.
These will use all the type information we give it (which today is zero), but it gives us the opportunity to fix that, by just using a more specific indy signature. Even one argument or return value can reduce some boxing, use a simpler guard, and so on.
I fixed some consistency issues and bugs between static and dynamic cases around shifts, unary +, and bitwise operators, and added tests around this.