-
Notifications
You must be signed in to change notification settings - Fork 396
Make default bridge generation smarter #2520
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
Labels
optimization
Optimization only. Does not affect semantics or correctness.
Milestone
Comments
Closed
gzm0
added a commit
to gzm0/scala-js
that referenced
this issue
Aug 6, 2023
- Fixes scala-js#2520 (make default bridge generation smarter) - Avoids traversal order dependent behavior. Since we potentially need to do a default target check on every method lookup, we memoize calculated default targets.
gzm0
added a commit
to gzm0/scala-js
that referenced
this issue
Aug 6, 2023
- Fixes scala-js#2520 (make default bridge generation smarter) - Avoids traversal order dependent behavior. Since we potentially need to do a default target check on every method lookup, we memoize calculated default targets.
gzm0
added a commit
to gzm0/scala-js
that referenced
this issue
Aug 6, 2023
- Fixes scala-js#2520 (make default bridge generation smarter) - Avoids traversal order dependent behavior. Since we potentially need to do a default target check on every method lookup, we memoize calculated default targets. Note that this might generate more default bridges than actually necessary. However, since they will not be marked as reachable, they will not even be synthesized.
gzm0
added a commit
to gzm0/scala-js
that referenced
this issue
Aug 6, 2023
- Fixes scala-js#2520 (make default bridge generation smarter) - Avoids traversal order dependent behavior. Since we potentially need to do a default target check on every method lookup, we memoize calculated default targets. Note that this might generate more default bridges than actually necessary. However, since they will not be marked as reachable, they will not even be synthesized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since 2.12.0-M5 does not generate explicit bridges to default methods in classes anymore, the linker has more responsibility in creating default method bridges. But the way it does this is suboptimal. Consider:
An ideal solution (and what happened when scalac generated the bridges) is to create the bridge in
A
:But the way the linker works for now is a bit stupid, and it will generate bridges in all the instantiated subclasses of
A
. So ifA
,B
andC
are all instantiated, we end up withWe should make the default bridge generation smarter so that it generates a bridge in the most appropriate place in the parent chain of a class.
The text was updated successfully, but these errors were encountered: