Closed
Conversation
The motivation is to use the new fine-grained lock scoping that local lazies have since scala#5294. Fixes scala/scala-dev#235 Co-Authored-By: Jason Zaugg <jzaugg@gmail.com>
Member
Author
class C {
def foo = {
object O
def oh = O
}
}//2.11.8
public class C {
private O.2. O$1$lzycompute(VolatileObjectRef x$1) {
C c = this;
synchronized (c) {
if (x$1.elem == null) {
public class C$O$2$ {
public C$O$2$(C $outer) {
}
}
x$1.elem = new C$O$2$(this);
}
return (C$O$2$)x$1.elem;
}
}
public void foo() {
VolatileObjectRef O$module = VolatileObjectRef.zero();
}
private final O.2. O$1(VolatileObjectRef O$module$1) {
return O$module$1.elem == null ? this.O$1$lzycompute(O$module$1) : (O.2.)O$module$1.elem;
}
private final O.2. oh$1(VolatileObjectRef O$module$1) {
return this.O$1(O$module$1);
}
}// This PR
public class C {
public void foo() {
LazyRef O$lzy = new LazyRef();
}
private static final /* synthetic */ O.2. O$lzycompute$1(LazyRef O$lzy$1) {
C$O$2$ var2_2;
LazyRef lazyRef = O$lzy$1;
synchronized (lazyRef) {
public class C$O$2$ {
public C$O$2$(C $outer) {
}
}
var2_2 = O$lzy$1.initialized() ? (C$O$2$)O$lzy$1.value() : (C$O$2$)O$lzy$1.initialize((Object)new C$O$2$(null));
}
return var2_2;
}
private final O.2. O$1(LazyRef O$lzy$1) {
return O$lzy$1.initialized() ? (O.2.)O$lzy$1.value() : C.O$lzycompute$1(O$lzy$1);
}
private final O.2. oh$1(LazyRef O$lzy$1) {
return this.O$1(O$lzy$1);
}
} |
Contributor
|
Resubmitting since I can push to this PR. |
2 tasks
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.
The motivation is to use the new fine-grained lock scoping that
local lazies have since #5294.
Fixes scala/scala-dev#235
Co-Authored-By: Jason Zaugg jzaugg@gmail.com
Review by @adriaanm
TODO:
null:(C$O$2$)O$lzy$1.initialize((Object)new C$O$2$(null));versusx$1.elem = new C$O$2$(this);O$module->O$lzy