Skip to content

New lazy vals implementation #15207

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

Closed
wants to merge 9 commits into from
Closed

Conversation

szymon-rd
Copy link
Contributor

@szymon-rd szymon-rd commented May 17, 2022

Cleaned up version of #14545

Implementing the new lazy vals scheme mentioned in #6979, fixing #7140

New PR to avoid force pushing to main branch of the previous author.

Fixes #15149 as well

@szymon-rd
Copy link
Contributor Author

szymon-rd commented May 18, 2022

Applied #14780

@szymon-rd
Copy link
Contributor Author

Fixed #15149

@szymon-rd szymon-rd marked this pull request as ready for review May 18, 2022 15:01
@szymon-rd szymon-rd requested review from Kordyjan and odersky and removed request for Kordyjan May 18, 2022 15:02
@szymon-rd
Copy link
Contributor Author

Wouldn't it be a better idea to use MethodHandles instead of Unsafe?

@szymon-rd
Copy link
Contributor Author

szymon-rd commented May 18, 2022

TODO: Add test for serialization of non transient lazy val.

@sjrd
Copy link
Member

sjrd commented May 18, 2022

MethodHandles are only available on JDK 9+. We have to support 8+.

@bishabosha
Copy link
Member

MethodHandles are only available on JDK 9+. We have to support 8+.

for clarity I assume you both mean VarHandle, as method handles were added in JDK 7

@szymon-rd
Copy link
Contributor Author

@bishabosha I actually meant getter/setter method handles. As far as I know they provide direct access to the field and do not actually rely on getter/setters. It would be nice to perform some benchmarks for sure.

@bishabosha
Copy link
Member

@bishabosha I actually meant getter/setter method handles. As far as I know they provide direct access to the field and do not actually rely on getter/setters. It would be nice to perform some benchmarks for sure.

AFAIK these do not support atomic operations like CAS, but varhandle is a direct replacement for methods in Unsafe

@szymon-rd szymon-rd force-pushed the new-lazy-vals branch 3 times, most recently from e92d489 to 22c6539 Compare May 23, 2022 08:30
@szymon-rd
Copy link
Contributor Author

@odersky Could you take a look at this, please?

@odersky
Copy link
Contributor

odersky commented May 26, 2022

Can you re-push that to staging? That way we can collaborate on it.

@odersky odersky assigned szymon-rd and unassigned odersky May 26, 2022
@szymon-rd
Copy link
Contributor Author

Created a new PR to change the source branch: #15296

@szymon-rd szymon-rd closed this May 26, 2022
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.

@transient lazy val does not get marked as ACC_TRANSIENT
5 participants