-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Stabilize new lazy vals #16614
Stabilize new lazy vals #16614
Changes from 3 commits
134c006
c8402b8
5863562
b0690ca
c27fe5d
cd5e644
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,28 +45,20 @@ object LazyVals { | |
|
||
/* ------------- Start of public API ------------- */ | ||
|
||
@experimental | ||
sealed trait LazyValControlState | ||
|
||
/** | ||
* Used to indicate the state of a lazy val that is being | ||
* evaluated and of which other threads await the result. | ||
*/ | ||
@experimental | ||
final class Waiting extends CountDownLatch(1) with LazyValControlState | ||
|
||
/** | ||
* Used to indicate the state of a lazy val that is currently being | ||
* evaluated with no other thread awaiting its result. | ||
*/ | ||
@experimental | ||
object Evaluating extends LazyValControlState | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wasn't the comment supposed to stay? |
||
* Used to indicate the state of a lazy val that has been evaluated to | ||
* `null`. | ||
*/ | ||
@experimental | ||
object NullValue extends LazyValControlState | ||
|
||
final val BITS_PER_LAZY_VAL = 2L | ||
|
@@ -86,7 +78,6 @@ object LazyVals { | |
unsafe.compareAndSwapLong(t, offset, e, n) | ||
} | ||
|
||
@experimental | ||
def objCAS(t: Object, offset: Long, exp: Object, n: Object): Boolean = { | ||
if (debug) | ||
println(s"objCAS($t, $exp, $n)") | ||
|
@@ -147,7 +138,6 @@ object LazyVals { | |
r | ||
} | ||
|
||
@experimental | ||
def getStaticFieldOffset(field: java.lang.reflect.Field): Long = { | ||
@nowarn | ||
val r = unsafe.staticFieldOffset(field) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Ylegacy-lazy-vals | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need that? I thought There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does work, the generated code differs. Mainly because the previous PR on lazy vals implemented .flag files for printing tests 😄 Is it the direction we are taking - to deprecate .flag files? |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the comment above.
Also would we now want to run all the
pos
andrun
tests instead of just the ones from the lists?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that no, we still want to run these tests, but now for legacy instead of the new lazy vals. New lazy vals will be now tested in standard
pos
andrun
tests. But the comment should be updated ofc.