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
Offer stronger guarantees under the Java Memory model for List, Vector #7838
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7838?orig=1 |
@retronym said: |
@Ichoran said: |
@retronym said: |
@Ichoran said: |
@retronym said:
|
@adriaanm said: |
@SethTisue said (edited on Aug 12, 2016 2:18:52 AM UTC): scala/scala#5316 was Stefan's attempt at a real fix, but was not merged. possibly to be revisited |
@szeiger said:
|
@retronym said: ", we emit a trailing barrier ... A final field was written. Notice we do not care about what field was actually written, we unconditionally emit the barrier before exiting the (initializer) method" This is a HotSpot implementation detail that makes regularly constructed lists (ie, not with tail mutation) safe to share in that VM (the write the the final field Also: " Fastdebug build is needed to gain access to -XX:+StressLCM -XX:+StressGCM instruction scheduling fuzzers in Hotspot." These flags have since been made available in release builds of Java 9. They are useful to avoid relying on implementation details of the compliler + processor: "x86 is Total Store Order hardware, meaning the stores are visible for all processors in some total order. That is, if compiler actually presented the program stores in the same order to hardware, we may be reasonably sure the initializing stores of the instance fields would be visible before seeing the reference to the object itself. Even if your hardware is total-store-ordered, you can not be sure the compiler would not reorder within the allowed memory model spec. If you turn off -XX:+StressGCM -XX:+StressLCM in this experiment, all cases would appear correct since the compiler did not reorder much." |
@Blaisorblade said: |
@Ichoran said: |
@Blaisorblade said: |
WIP PR scala/scala#6425, see also scala/collection-strawman#50 |
Should we remove or change |
Yes! |
https://groups.google.com/forum/#!topic/scala-internals/P7WNVkJQdHk
The text was updated successfully, but these errors were encountered: